The Theater Service is a RESTful API built with Django REST Framework that manages a theater system — actors, genres, plays, halls, performances, and reservations. It supports JWT authentication, an admin panel, and auto-generated Swagger documentation. Everything runs inside Docker containers for easy deployment.
- 📑 Full CRUD for:
- Theatre halls
- Actors
- Genres
- Plays
- Performances
- 🔐 JWT-based authentication
- 👤 Role-based access:
- Admins: full access
- Authenticated users: read-only access
- 🧑💼 Django Admin Panel
- 📄 Swagger/OpenAPI documentation via drf-spectacular
- 🐳 Docker support with Gunicorn for production-ready deployment
- 📁 Modular structure:
users,theater,reservations,theater_service
git clone https://github.com/your-username/theater-service.git
cd theater-servicecp .env.sample .envit should look like this
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=db
DB_PORT=5432docker-compose up --buildThe application will start with Gunicorn server on http://localhost:8000
docker-compose exec web python manage.py migrate
docker-compose exec web python manage.py createsuperuserTo create a new user account:
POST /api/users/register/
Request body:
{
"username": "your_username",
"password": "your_password"
}This project uses JWT for user authentication.
POST /api/users/token/
Request body:
{
"username": "your_username",
"password": "your_password"
}Response:
{
"access": "your_access_token",
"refresh": "your_refresh_token"
}POST /api/users/token/refresh/
Request body:
{
"refresh": "your_refresh_token"
}You can access the Swagger UI documentation at:
/api/doc/swagger/
- Python 3.12
- Django 5.2.1
- Django REST Framework
- Simple JWT
- drf-spectacular
- PostgreSQL
- Gunicorn (Production WSGI Server)
- Docker & Docker Compose
The project includes a fixture file with sample data that you can use to populate the database. This includes:
- Admin and regular user accounts
- Theater halls
- Genres
- Actors
- Plays
- Performances
- Sample reservations and tickets
To load the sample data:
- Make sure you have applied all migrations first:
python manage.py migrate- Load the fixture data:
python manage.py loaddata initial_data.jsonAfter loading the fixtures, you can use these accounts:
-
Admin User:
- Username: admin
- Email: admin@example.com
- Password: testpass123
-
Regular User:
- Username: john_doe
- Email: john@example.com
- Password: testpass123
/api/theater/theatre_halls/- Theater halls management/api/theater/plays/- Plays management/api/theater/performances/- Performances management/api/theater/actors/- Actors management/api/theater/genres/- Genres management/api/reservations/tickets/- Ticket reservations/api/user/register/- User registration/api/user/token/- JWT token obtain/api/user/token/refresh/- JWT token refresh
