A RESTful task management API built with Go and MongoDB.
- JWT-based authentication
- CRUD operations for tasks
- Pagination and filtering
- Soft delete functionality
- Health checks
- Docker support
flowchart LR
subgraph Client
A["User Agents
Web/Mobile/CLI"]
end
subgraph Ingress
B["Ingress / API Gateway"]
end
subgraph API
C["Go API Pods
(Chi Router)"]
C --> D["Handlers & Services"]
D --> E["MongoDB Replica Set"]
end
subgraph Observability
F["Prometheus"]
G["Log Collector"]
H["OpenTelemetry"]
end
A --> B --> C
C --> E
C --> F
C --> G
C --> H
docker compose up --build- Install MongoDB:
brew install mongodb-community@7.0
brew services start mongodb-community@7.0- Set environment variables:
export TASKAPI_DATABASE_URI="mongodb://localhost:27017"
export TASKAPI_JWT_SECRET="your_secret_key"- Run the server:
go run cmd/server/main.gocurl -X POST http://localhost:8080/v1/login \
-H "Content-Type: application/json" \
-d '{"email":"admin@example.com","password":"admin123"}'curl -X POST http://localhost:8080/v1/tasks \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"title":"Sample Task","description":"Task description","status":"open"}'curl -X GET http://localhost:8080/v1/tasks \
-H "Authorization: Bearer <token>"curl http://localhost:8080/healthzTASKAPI_SERVER_PORT: Server port (default: 8080)TASKAPI_DATABASE_URI: MongoDB connection stringTASKAPI_DATABASE_DATABASE: Database name (default: taskdb)TASKAPI_JWT_SECRET: JWT signing secretTASKAPI_JWT_EXPIRY_HOURS: Token expiry in hours (default: 24)