API for Nevroth – an app to help users track and improve their progress in overcoming harmful habits.
- Modern REST Architecture: JWT authentication, OpenAPI 3.0 docs, and DRF-powered endpoints.
- Django ORM: PostgreSQL-optimized queries with atomic transactions.
- Admin Dashboard: Pre-configured Django Admin.
Use Docker Compose for easy local setup. It starts the API and PostgreSQL database automatically.
-
Clone the repository.
-
Start the services:
docker compose up -d
-
The API will be available at http://127.0.0.1:8000/
-
Database connection details:
- Host:
localhost
- Port:
5432
- User:
postgres
- Password:
password
- Database:
nevroth_db
- Host:
Access the admin panel at http://127.0.0.1:8000/admin
This project includes a GitHub Actions workflow:
- Automatically runs on
push
andpull_request
events to themain
branch. - Spins up PostgreSQL and Redis services for integration testing.
- Runs code quality checks with Ruff.
- Builds a Docker image tagged with the commit SHA.
- Executes Django database migrations and tests inside the Docker container.
To ensure fast API response times and a smooth user experience, Nevroth offloads time-consuming tasks to Celery workers.
Implemented asynchronous tasks:
-
📧
send_mail_task
— used to send password recovery emails. -
🧠
follow_up_no_habits_selected_task
— reminds users to select habits if they forgot to. -
🧹
cleanup_old_messages_task
— regularly purges outdated chat messages to keep the database clean.
All tasks are run asynchronously via Celery and can be monitored using tools like Flower or logs inside Docker.
Nevroth supports real-time features via Django Channels and WebSockets:
-
🔁
ws/chats/<chat_id>/
— new messages inside a selected chat. -
📥
ws/chat-list/
— receive real-time updates from other chats.
This allows seamless user experience for chat interactions and live updates without page reloads.
-
Check management commands:
docker compose exec api python manage.py help
-
View logs:
docker compose logs -f api
-
Run tests inside container:
docker compose exec api python manage.py test
- API Docs URL: http://127.0.0.1:8000/api/docs/
- Admin panel: Use to view and edit test data during development.