A simple yet realistic task management REST API built with Go. Manage tasks with priorities, statuses, and due dates.
- RESTful API - Clean HTTP endpoints for task management
- Authentication - API key-based authentication
- Task Management - Create, read, update, and delete tasks
- Status Tracking - Track tasks through pending, in-progress, and completed states
- Priority System - Assign priority levels (1-5) to tasks
- Due Dates - Set and track task due dates
- Filtering - Filter tasks by status
- Health Checks - Monitor API health
taskmaster-api/
├── cmd/
│ └── server/ # Application entry point
├── internal/
│ ├── handlers/ # HTTP request handlers
│ ├── middleware/ # HTTP middleware (auth, logging)
│ ├── models/ # Domain models
│ └── storage/ # Data storage layer
├── pkg/
│ └── auth/ # Authentication utilities
└── go.mod
GET /health
GET /api/tasks # List all tasks (supports ?status= filter)
POST /api/tasks # Create a new task
GET /api/tasks/{id} # Get a specific task
PUT /api/tasks/{id} # Update a task
DELETE /api/tasks/{id} # Delete a task
All /api/* endpoints require authentication using an API key:
X-API-Key: taskmaster-secret-key-123Or using Bearer token:
Authorization: Bearer taskmaster-secret-key-123- Go 1.21 or higher
# Clone the repository
git clone https://github.com/example/taskmaster-api
cd taskmaster-api
# Download dependencies
go mod download
# Run the server
go run cmd/server/main.goThe server will start on port 8080 by default. Set PORT environment variable to change it.
go test ./...Run with coverage:
go test -cover ./...curl -X POST http://localhost:8080/api/tasks \
-H "X-API-Key: taskmaster-secret-key-123" \
-H "Content-Type: application/json" \
-d '{
"title": "Complete project documentation",
"description": "Write comprehensive API documentation",
"status": "pending",
"priority": 4
}'curl http://localhost:8080/api/tasks \
-H "X-API-Key: taskmaster-secret-key-123"curl http://localhost:8080/api/tasks?status=in_progress \
-H "X-API-Key: taskmaster-secret-key-123"curl http://localhost:8080/api/tasks/{task-id} \
-H "X-API-Key: taskmaster-secret-key-123"curl -X PUT http://localhost:8080/api/tasks/{task-id} \
-H "X-API-Key: taskmaster-secret-key-123" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated title",
"status": "completed",
"priority": 5
}'curl -X DELETE http://localhost:8080/api/tasks/{task-id} \
-H "X-API-Key: taskmaster-secret-key-123"curl http://localhost:8080/health{
"id": "uuid",
"title": "Task title",
"description": "Task description",
"status": "pending|in_progress|completed",
"priority": 1-5,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"due_date": "2024-12-31T00:00:00Z"
}PORT- Server port (default: 8080)- API key is currently hardcoded for demo purposes. In production, use environment variables.
- Handlers - Process HTTP requests and responses
- Middleware - Handle cross-cutting concerns (logging, auth)
- Models - Define domain entities and business logic
- Storage - Manage data persistence (currently in-memory)
- Database integration (PostgreSQL, MongoDB)
- User authentication with JWT
- Task assignment to users
- Task comments and attachments
- WebSocket support for real-time updates
- Rate limiting
- Comprehensive test coverage
MIT