LodgixHub is a Django-based backend MVP for a short-term accommodation booking platform similar to Airbnb or Booking.com. The project covers hotels, hostels, and apartments through a unified listing model and is designed to be developed incrementally with explicit task approval before each implementation step.
The MVP target is to deliver a working backend by July 22, 2026. The system must provide authentication, role-based access, property listings, media upload, booking flows, dynamic price calculation, moderation, reviews, basic analytics, documentation, and deployment infrastructure.
This repository contains the foundational backend setup and application structure for the platform (Release Version 1.0.1).
Every task and every code or configuration change must be approved before implementation.
Before making changes, the assistant must explain:
- what task is being implemented;
- which files are expected to change;
- whether migrations will be created;
- whether dependencies will be added;
- which commands may need to be run.
If a requirement is unclear, ambiguous, or has multiple valid implementation options, the assistant must ask clarification questions before proceeding.
- JWT authentication.
- Route protection middleware.
- Custom middleware for token refresh behavior.
- User access model with multiple capabilities instead of a single exclusive role.
- Supported access levels and permissions:
- guest;
- authenticated user;
- landlord;
- moderator;
- administrator.
- A user may act as both tenant and landlord through flags, groups, or permissions.
- Unified
Listingmodel for:- apartment;
- hotel;
- hostel.
- Listing type is represented by a
typefield. - Related
Roommodel for hotel and hostel inventory. - Listing publication statuses:
- draft;
- published;
- hidden;
- rejected.
- Listing status can be edited by a moderator.
- Search, filtering, and sorting over listings.
- Soft delete through a shared base model.
- Photo upload for listings.
- Photo upload for rooms.
- Multiple photos per listing or room.
- Main photo selection.
- Photo display ordering.
- Soft delete for media records.
- Local media storage for development.
- S3-ready media storage for AWS deployment.
- Booking creation.
- Booking viewing.
- Booking cancellation.
- Booking confirmation.
- Cancellation requires a reason selected from
CancellationReason. - Unconfirmed bookings are automatically cancelled after 30 minutes, taking business hours into account.
- Dynamic price calculation on demand.
- Early-booking and late-booking discounts.
- No real payment processing in the MVP.
- Payment integration remains a placeholder outside the MVP.
PriceHistorytable:- append-only;
- updated by a daily cron-driven management command;
- cannot be deleted;
- cannot change the price for "today to today".
- Deposit configuration:
- deposit required or not required;
- percentage value;
- refundable or non-refundable.
- Reviews and ratings.
- One review per completed booking.
- Review window is limited to one week after booking completion.
- Review statuses:
- draft;
- published;
- hidden;
- rejected.
- Review status can be edited by a moderator.
- Search history.
- Listing view history.
- Basic listing popularity statistics using regular SQL aggregations.
- Kafka is intentionally excluded from the MVP.
- Synchronous email notifications.
- Emails are sent directly from signals or views.
- Exception handling with
try/exceptwhere appropriate. - Logging.
- Validation.
- Signals for alerts and notifications.
- Automatic booking cancellation through a system cron inside the container.
- Daily price setup through a system cron inside the container.
- Faker-based database seeding for development and demonstration data.
- Synchronous email notifications sent directly from signals or views.
- Exception handling with
try/exceptwhere appropriate. - Logging and signal handlers for platform alerts.
- Asynchronous Task Execution: Asynchronous job processing powered by Celery workers backed by Redis brokers.
- Dynamic Task Scheduling: Automated booking auto-cancellation and daily pricing updates controlled via
django-celery-beatdatabase schedules.
- Interactive Swagger/OpenAPI documentation powered by
drf-spectacularavailable at/api/v1/schema/swagger-ui/. - Native support for UUID path parameters across all domain endpoints (
/api/v1/listings/{id}/, /api/v1/bookings/{id}/, etc.).- Complete authentication schema integration via
CustomJWTAuthenticationwith native Swagger UI "Authorize" button - support (
Bearer <token>). - Zero-error OpenAPI schema compilation pipeline.
- Black.
- isort.
- flake8.
- PEP 8 oriented formatting and linting.
- Docker Compose for local/containerized execution.
- MySQL for local development and external database setups.
- Production Stack: Gunicorn + Nginx reverse proxy, Celery worker, Celery beat, and dual-purpose Redis broker/cache.
- AWS Deployment (IaC): Terraform module (
deploy/terraform/) for automated EC2 instance provisioning with dynamic - public IP detection via IMDSv2.
- Secure user creation and editing via Django Admin with properly masked input fields (
type="password") and automatic - password confirmation validation (
password1/password2).
The following items are intentionally postponed for post-defense self-development:
- RabbitMQ for email queues.
- Kafka for analytics or search logging.
- Redis for caching or as a broker.
- Node.js frontend and backend integration.
- Real payment processing.
- Discount and bonus system beyond on-demand price recalculation.
- 80% unit test coverage.
- Integration tests.
- Playwright UI tests.
- GitHub Actions CI/CD.
- Radon.
- Varnish.
- Nginx in front of the frontend.
- Domain setup.
- SSL.
- Cloudflare.
All core application modules planned for the platform MVP have been successfully migrated to a stabilized 3-Tier Layered
Architecture (Controller β Service β Repository) and are fully connected via API version v1 routes as of
release v0.6.0.
To populate your local database with realistic German test data (users, listings, reviews, bookings), use the custom management command:
# Quick start with default settings (70 landlords, 100 tenants, etc.)
python manage.py seed_fake_data
python manage.py seed_fake_data --landlords 100 --listings-per-landlord 4 --tenants 300 --moderators 3
## Planned Backend Modules
The backend is split into focused Django apps:
- `config` - Django project configuration, settings, root URLs, ASGI, and WSGI entrypoints.
- `core` - shared base models, utilities, exceptions, validators, logging helpers.
- `apps/users` - custom user model, authentication, permissions, gender records, choices layout.
- `apps/security` - token rotation middleware layer, authorization access rules, and custom DRF permission authenticators.
- `apps/listings` - listings, rooms, photos, moderation, search filters.
- `apps/content` - listing and room photos, main photo selection, ordering, storage integration.
- `apps/bookings` - booking lifecycle, cancellation reasons, confirmation, auto-cancellation.
- `apps/pricing` - dynamic price calculation, deposits, price history.
- `apps/reviews` - reviews, ratings, moderation.
- `apps/analytics` - search history, view history, popularity aggregations.
- `apps/notifications` - email notifications and signal handlers.
The existing `config` package remains the Django project configuration package. The `core` app is a separate reusable
application for shared domain and infrastructure helpers.
### Standardized Application Directory Layout
To maintain strict separation of concerns, predictable developer experience, and micro-component modularity, every
application within the `apps/` directory is standardized to use the following package layout (enforced in
Milestone 0.3.0):
```text
app_name/
βββ migrations/ # Database ledger version files
βββ choices/ # Enum-like classes for field states and type definitions
βββ constants/ # App-specific business logic limits, timeouts, and thresholds
βββ models/ # Multi-file domain entity definitions (exposed via __init__.py)
βββ dto/ # Data Transfer Objects, request/response schemas, and serializers
βββ errors/ # Domain-specific custom exception classes and error codes
βββ filters/ # Advanced query search, filter, and sorting logic
βββ paginations/ # Custom list response pagination definitions
βββ repositories/ # Isolated database access layer (QuerySets, complex ORM logic)
βββ services/ # Pure business logic orchestration layer
βββ controller/ # Thin API request/response handling layer (views/endpoints)
βββ admin.py # Django Admin site panel registration
βββ apps.py # App config mapping
βββ urls.py # Module routing layout
## Local Development Setup
The real `.env` file is local-only and must not be committed. Use `.env.example` as a safe template.
### 1. Create and Activate a Virtual Environment
**Windows (PowerShell):**
```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1macOS / Linux:
python -m venv .venv
source .venv/bin/activateThis project uses requirements.txt for managing dependencies. Ensure your virtual environment is active, then run:
pip install -r requirements.txtWindows (PowerShell):
Copy-Item .env.example .envmacOS / Linux:
cp .env.example .envGenerate a secure random key for your local environment:
Windows (PowerShell):
.\.venv\Scripts\python.exe -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"macOS / Linux:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"Copy the generated value into SECRET_KEY in the local .env file.
For local MySQL development, fill these variables in .env:
USE_MYSQL=True
MYSQL_NAME=db_name
MYSQL_USER=db_user_user
MYSQL_PASSWORD=change-me
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306Note: The exact local MySQL database and user creation commands will be added after the database setup task is approved.
python manage.py migratepython manage.py createsuperuserpython manage.py runserverAs of release v0.5.0, the application is fully containerized for local development to ensure environment consistency
and eliminate host machine dependency mismatches.
- Docker and Docker Compose installed on your host machine.
- Ports
8000(application) and3307(MySQL external map) free from conflicts.
Create a dedicated .env.docker file based on .env.example:
- Change
MYSQL_HOSTtodb(the service orchestrator name). - Configure
DJANGO_SUPERUSER_USERNAME,DJANGO_SUPERUSER_EMAIL, andDJANGO_SUPERUSER_PASSWORDto automate admin - creation.
-
Build and run the services in the foreground:
docker compose up --build
-
Run services in the background (detached mode):
docker compose up -d
-
Stop containers while preserving state (volume data):
docker compose down
-
Completely wipe container volumes and reset the database environment:
docker compose down -v
Once operational, the Django application will serve traffic at http://127.0.0.1:8000/. External database clients can attach to the isolated MySQL engine via 127.0.0.1:3310.
As of release v0.8.0, the background processing pipeline relies on Redis and Celery.
To run the full async infrastructure locally in development mode:
-
Start Redis Broker & Cache Containers:
docker run -d --name django-redis -p 6379:6379 redis:alpine
-
Start Celery Worker (In a dedicated terminal):
celery -A config worker --loglevel=info -P solo
-
Start Celery Beat Scheduler (In a dedicated terminal):
celery -A config beat --loglevel=info
Populates the database with default parameters predefined in the argument parser:
python manage.py seed_fake_data
python manage.py seed_fake_data --landlords 100 --listings-per-landlord 4 --tenants 300 --moderators 3For production deployments on AWS EC2:
- Provision Infrastructure:
Navigate to
deploy/terraform/and apply the Terraform configuration:cd deploy/terraform terraform init terraform plan terraform apply - Deploy Application Stack:
docker compose -f docker-compose.prod.yml up -d --build chmod +x ./scripts/deploy.sh ./scripts/deploy.sh
Copyright (c) 2026 devsmish. All rights reserved.
This software and its source code are proprietary and confidential. Unauthorized copying, modification, distribution, or use of this file, via any medium, is strictly prohibited.