74cd2ec84d4818f0403b79179f1b78fb40c9ee20
Implement all missing endpoints for full habit management:
- GET /api/v1/habits - List all user habits
- GET /api/v1/habits/{id} - Get specific habit
- PUT /api/v1/habits/{id} - Update habit
- DELETE /api/v1/habits/{id} - Archive habit (soft delete)
- GET /api/v1/habits/{id}/entries - Get habit entry history
- DELETE /api/v1/habits/{id}/entries/{date} - Unmark habit (soft delete entry)
All endpoints include:
- TDD approach with comprehensive test coverage
- JWT authentication and ownership validation
- Proper error handling (404, 403, 400, 500)
- Clean architecture with separated commands/queries
Apocapoc
Self-hosted habit tracking service with a clean, hexagonal architecture.
Features
- Multiple habit types: Boolean (check), Counter, Value
- Flexible scheduling: Daily, Weekly, Monthly with specific days
- Carry-over support: Choose if incomplete habits persist or expire
- Full history tracking: Complete audit trail of all interactions
- Charts & Analytics: Heatmaps, line charts, and statistics
- Self-hosted first: Easy deployment with SQLite or PostgreSQL
Quick Start
Using the binary
- Download the latest release
- Copy
.env.exampleto.envand configure - Run:
./apocapoc-api
The API will be available at http://localhost:8080
Development
Prerequisites
- Go 1.23+
- SQLite (or PostgreSQL)
Running locally
cp .env.example .env
go run cmd/api/main.go
API Documentation
Once running, visit http://localhost:8080/api/v1/docs for interactive API documentation.
Architecture
This project follows hexagonal (ports & adapters) architecture:
domain/: Core business logic and entitiesapplication/: Use cases (commands & queries)infrastructure/: External adapters (database, HTTP, etc.)shared/: Common utilities and errors
License
MIT
Languages
Go
99.5%
HTML
0.4%