Workout Plans & Assignment System for FitCall.me — a Django REST Framework microservice.
- Python 3.11+
- PostgreSQL 14+ running locally
# 1. Create the database
psql -U postgres -c "CREATE DATABASE fitcall_plans;"
# 2. Run setup (creates venv, installs deps, runs migrations)
bash setup.sh
# 3. Start the server
venv/bin/python manage.py runserverThen open http://127.0.0.1:8000 — the interactive API tester loads automatically.
| Variable | Default | Description |
|---|---|---|
SECRET_KEY |
dev key | Django secret key |
DEBUG |
True | Debug mode |
DB_NAME |
fitcall_plans | Postgres database name |
DB_USER |
postgres | Postgres user |
DB_PASSWORD |
postgres | Postgres password |
DB_HOST |
localhost | Postgres host |
DB_PORT |
5432 | Postgres port |
JWT_SECRET_KEY |
dev-jwt-secret | Shared secret with Go auth service |
| Method | Endpoint | Role | Description |
|---|---|---|---|
| POST | /api/v1/auth/dev-token/ |
Any | Generate a dev JWT (DEBUG only) |
| GET | /api/v1/me/ |
Any | Current user info |
| GET | /api/v1/plans/ |
Trainer | List plans |
| POST | /api/v1/plans/ |
Trainer | Create plan |
| GET | /api/v1/plans/{id}/ |
Trainer | Get plan |
| PUT | /api/v1/plans/{id}/ |
Trainer | Update plan |
| DELETE | /api/v1/plans/{id}/ |
Trainer | Delete/archive plan |
| POST | /api/v1/plans/{id}/assign/ |
Trainer | Assign to client |
| GET | /api/v1/assignments/ |
Both | List assignments |
| GET | /api/v1/assignments/{id}/ |
Both | Get assignment |
venv/bin/python -m pytest
# With coverage:
venv/bin/python -m coverage run -m pytest && venv/bin/python -m coverage reportThe root URL / serves an interactive UI. Workflow:
- Click Generate Token (choose Trainer or Client role)
- Select an endpoint from the sidebar
- Fill fields — Plan ID and Assignment ID auto-fill after creation
- Hit Send Request and inspect the response
Full OpenAPI docs at http://127.0.0.1:8000/api/docs/