⚠️ ALPHA SOFTWARE - This project is in active development and is considered experimental. Use at your own risk. APIs may change without notice.
Clutch Hub API is a backend service designed to manage and provide data for the Clutch Hub application. It handles various operations such as user authentication, data retrieval, and data manipulation.
Created and maintained by Mehran Mazhar
- User authentication and authorization
- CRUD operations for various resources
- Data validation and error handling
- Integration with external services
- Detailed API documentation
- Data modeling for resources
- Example requests and responses
Registers a new user.
Request Body:
{
"username": "string",
"password": "string",
"email": "string"
}Response:
{
"id": "string",
"username": "string",
"email": "string",
"token": "string"
}Logs in a user.
Request Body:
{
"username": "string",
"password": "string"
}Response:
{
"token": "string"
}GET /users: Retrieve a list of users.POST /users: Create a new user.GET /users/{id}: Retrieve a user by ID.PUT /users/{id}: Update a user by ID.DELETE /users/{id}: Delete a user by ID.
- id: string
- username: string
- email: string
- createdAt: Date
- updatedAt: Date
- Docker and Docker Compose (recommended)
- OR Rust (1.70+) and Cargo for local development
For the complete Clutch stack (node + API + monitoring), use the clutch-deploy repository:
git clone https://github.com/clutchprotocol/clutch-deploy.git
cd clutch-deploy
cp .env.example .env
docker-compose up -d# Copy environment and start (builds from source)
cp env.example .env
docker-compose up --buildOr run a single container:
docker build -t clutch-hub-api .
docker run -p 3000:3000 --env-file .env clutch-hub-apiPre-built image:
docker pull 9194010019/clutch-hub-api:latest
docker run -p 3000:3000 --env-file .env 9194010019/clutch-hub-api:latestThe API will be available at http://localhost:3000
# Use the development script (Windows)
.\scripts\docker-dev.ps1 build # Build image
.\scripts\docker-dev.ps1 up # Start services
.\scripts\docker-dev.ps1 logs # View logs
.\scripts\docker-dev.ps1 health # Check health
.\scripts\docker-dev.ps1 clean # Clean updocker pull 9194010019/clutch-hub-api:latest
docker run -p 3000:3000 --env-file .env 9194010019/clutch-hub-api:latest- Rust (1.76+)
- Cargo
- Clone the repository:
git clone https://github.com/MehranMazhar/clutch-hub-api.git
- Navigate to the project directory:
cd clutch-hub-api - Copy environment configuration:
cp env.example .env
- Build the project:
cargo build --release
- Start the API server:
cargo run
- The API will be available at
http://localhost:3000(or configured port).
Example API calls:
- Register a new user:
curl -X POST http://localhost:3000/auth/register \ -H "Content-Type: application/json" \ -d '{"username": "john_doe", "password": "securepassword", "email": "john@example.com"}'
- Login:
curl -X POST http://localhost:3000/auth/login \ -H "Content-Type: application/json" \ -d '{"username": "john_doe", "password": "securepassword"}'
- Update the
.envfile with your environment variables.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature-branch). - Open a pull request.
Mehran Mazhar
- GitHub: @MehranMazhar
- Website: MehranMazhar.com
- Email: mehran.mazhar@gmail.com
This project is licensed under the MIT License.