π AutoService Book
AutoService Book is a Django web application designed to manage car service records, fuel logs, parts, and related expenses.
Built as a portfolio project, it highlights hands-on experience with Django (forms, models, auth, i18n), database design, data validation, pagination, and a maintainable, user-oriented interface.
- π οΈ Track Service History and Car Parts: Add, edit, and delete service and part records.
- π Manage Vehicles: Keep track of multiple cars with details (brand, model, year, mileage, VIN).
- π Monitor Fuel Expenses: Record fuel purchases, calculate distances, and track costs.
- β½ Check Fuel Levels and Consumption: Automatically calculate remaining fuel and average consumption.
- π Analyze Expenses: View all expenses and service history in one place.
- π‘οΈ Authentication: protected with CAPTCHA: Login & registration are protected with Cloudflare Turnstile CAPTCHA (Implemented via
django-turnstile) - π Monitoring Stack: This project includes an optional monitoring module located in
/monitoring. It can be started alongside the main application using a merged Docker Compose setup, without modifying the core stack. - π₯ CSV Export: Download service, fuel, part, and other expense data as CSV files.
- π Dark/Light Theme Switcher: Toggle between light and dark themes for a comfortable experience.
- π Authorisation by Google available
- π Localization by i18n: full Germanπ©πͺ UI translation added (π¬π§ as default) with a convenient language switcher
- π§ Snowfall Effect: Modern snowfall animation rendered on a full-page canvas with automatically adapts to the active UI theme (
light/dark) for optimal contrast
- Backend: Django 5.2, Python 3.14
- Frontend: Bootstrap 5 (via
crispy-bootstrap5), HTML, CSS, JavaScript - Database: PostgreSQL 16 (managed cloud instance)
- Authentication:
django-allauthfor email-based login - Security Features: Integrated Cloudflare Turnstile
CAPTCHAon all authentication forms to prevent brute-force and automated attacks. - Monitoring: Grafana Β· Prometheus Β· Alertmanager
- Caching: Django Cache Framework for optimized queries
- Additional: Django
signalsfor automatic mileage and fuel updates, CSV export functionality - Production: Docker, Django Admin panel, safe admin URL
- Localization: π©πͺ/π¬π§ by i18n
- Testing: Pytest
- Sign Up/Login: Register or log in via email using
django-allauth. - Add Vehicles: Go to the "Autos" section to add cars (brand, model, year, mileage, VIN).
- Manage Records:
- Add service records, fuel expenses, car parts, or other expenses.
- View detailed history and analytics for each car.
- Export data to CSV for offline use.
- Monitor Fuel: Check remaining fuel and average consumption on the dashboard.
- Toggle Themes: Switch between dark and light themes for a better experience.
Copy .env.example to .env and adjust values.
Docker Compose will pick it up if you add env_file: .env (or map specific environment: keys).
Key variables in .env.example:
ALLOWED_HOSTSDJANGO_SUPERUSER_USERNAMEDJANGO_SUPERUSER_EMAILDJANGO_SUPERUSER_PASSWORDGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRET
docker compose up --build
# car brands test data upload
docker compose exec web python manage.py loaddata service_book/fixtures/brands.jsonThis project uses an entry script (entrypoint.sh) to bootstrap the app in containers. Itβs idempotent
and safe to run on every container start.
- Waits for the database using the
DATABASE_URL(TCP check with timeout/retries). - (Dev only) Auto generate migrations if
AUTO_MAKEMIGRATIONS=1. - Apply migrations:
python manage.py migrate --noinput. - Load fixtures (brands) only if the table is empty (or forcibly, if requested).
- Optional table sanity check via
CHECK_TABLEenv. - Collect static files:
python manage.py collectstatic --noinput. - Ensure superuser with
manage.py createsuperuser --noinput(idempotent).
The project includes a ready-to-use Django Admin for managing core entities (cars, service records, fuel expenses, parts, other expenses, users).
NOTES:
- Docker Compose can auto-create(
entrypoint.sh) a superuser on startup if you provide vars in your .env - Entry URL is customized via
ENV(to avoid /admin/ being a predictable target).
URL: http://localhost:8000/<ADMIN_URL>/
Example: http://localhost:8000/backoffice/
This project ships with an optional monitoring module located in /monitoring.
Run it alongside the main app using a merged Docker Compose setup.
# clean run
docker compose -f docker-compose.yml -f monitoring/docker-compose.monitoring.yml down --remove-orphans \
&& docker network prune -f \
&& docker compose -f docker-compose.yml -f monitoring/docker-compose.monitoring.yml up --build| Tool | URL | What itβs for |
|---|---|---|
| Grafana | http://localhost:3000 | Dashboards & visualization |
| Prometheus | http://localhost:9090 | Metrics, queries, targets, alerts |
| Alertmanager | http://localhost:9093 | Alert routing, silences, notifications |
Grafana default credentials: admin / admin (change via .env if needed) |
Prometheus targets: http://localhost:9090/targets
Alert rules (if configured): http://localhost:9090/alerts
Create an OAuth client (Web) in Google Cloud and set:
- Redirect URI (dev):
http://localhost:8000/accounts/google/login/callback/ - Redirect URI (prod):
https://<your-domain>/accounts/google/login/callback/
Then export:
GOOGLE_CLIENT_ID=xxxx.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=yyyy
You can alternatively configure a SocialApp (Google) in Django Admin and bind it to your Site.
The application ships with full German localization π©πͺ while English remains the default language π¬π§.
- All UI texts are translated via Django i18n (.po/.mo)
- Language switcher is available in the navigation bar
- User language preference is stored in session
- Seamless switching without page reload issues
Make sure the following settings are enabled:
USE_I18N = True
USE_L10N = True
LANGUAGES = [
("en", "English"),
("de", "Deutsch"),
]
LOCALE_PATHS = [BASE_DIR / "locale"]
- To update translations:
python manage.py makemessages -l de- Edit
locale/de/LC_MESSAGES/django.po - To compile(save) translations:
django-admin compilemessages- (Optional) Recreate docker container
docker compose down -v
docker compose up --buildThe project uses Pytest and runs tests inside Docker to ensure a consistent environment (Python, dependencies, and PostgreSQL).
# clean start (app only) + run tests
docker compose down --remove-orphans -v \
&& docker network prune -f \
&& docker compose up -d --build \
&& docker compose exec web poetry run python -m pytest -qNote:
- Tests are executed inside the web container.
- Volumes are removed (-v), so the database is reset (expected for tests).
This project is licensed under the MIT License. See the LICENSE file for details.
-
One-command service startup via Docker Compose (
docker compose up --build) -
Comprehensive container init script (
entrypoint.sh) -
Fixture set for fast, end-to-end service testing (
fixtures/) -
Hide the admin URL in urls via .env
-
Auth via Google (OAuth2)
-
Grafana + Prometheus + Alertmanager integration
-
Auth protected with CAPTCHA (django-turnstile)
-
CI for tests/linters (flake8)
-
Snowfall visual effect for the UI
-
Test coverage of the service
Author: Maksym Petrykin
Email: m.petrykin@gmx.de
Telegram: @max_p95