REST API for the gamified coding platform.
- CRUD API for
/missions
- Gamification:
/profile
that supports missions and badges - PostgreSQL + simple migrations (
golang-migrate
) - Middleware: structured logging with slog, CORS, panic/recovery
- Unit tests (
httptest
) - Clean Architecture:
handlers
,repository
,service
,config
.
├── cmd/main.go # Entrypoint
├── config/ # Env-variables loader
├── internal/http/ # Handlers, routers, middleware
├── migrations/ # Sql-files for migrations
├── models/ # DTO-models (Mission, Profile)
├── repository/ # PostgreSQL-repo
├── service/ # Business logic
- Install dependecies:
go mod tidy
- Prepare PostgreSQL:
docker run --name=missions-db \
-e POSTGRES_PASSWORD=missions \
-p 5436:5432 \
-d postgres
- Create
.env
file:
PORT=8080
DATABASE_URL=postgres://postgres:missions@localhost:5436/postgres?sslmode=disable
- Migrate:
migrate -path migrations -database "$DATABASE_URL" up
- Launch application:
go run ./cmd
Create new mission:
curl -X POST http://localhost:8080/missions \
-H "Content-Type: application/json" \
-d '{"title": "Hello, World!", "points": 100}'
Get all missions:
curl http://localhost:8080/missions
Get profile:
curl http://localhost:8080/profile
Delete missions:
curl -X DELETE http://localhost:8080/missions/1
- Dockerfile + docker-compose
- CI (Go test + lint)
- Swagger/OpenAPI
- Frontend-interface