REST API for managing user subscriptions, built with Go.
- Go — Chi router, slog logger
- PostgreSQL — data storage
- Docker — containerization
- Swagger — API docs
cmd/api → entrypoint internal/ config → config loading database → postgres + repository domain → interfaces & models service → business logic transport/http → handlers, DTOs, router migrations/ → SQL migrations pkg/ctxutil → request ID helper
1. Clone
git clone https://github.com/Asilbeek1/Subscription-Service
cd Subscription-Service2. Configure
cp .env.example .env # edit DB credentials inside3. Run
docker compose up --build| Method | Endpoint | Description |
|---|---|---|
| POST | /subscriptions |
Create subscription |
| GET | /subscriptions |
List all |
| GET | /subscriptions/{id} |
Get by ID |
| DELETE | /subscriptions/{id} |
Delete |
| GET | /subscriptions/total |
Calculate total cost |
| Param | Type | Required |
|---|---|---|
user_id |
uuid | No |
service_name |
string | No |
from |
MM-YYYY | No |
to |
MM-YYYY | No |
http://localhost:8080/swagger/index.html
make migrate-up
make migrate-down