Sign inSign up

mahmoudaboelfotouh/little-lemon-api

By mahmoudaboelfotouh

•Updated 30 days ago

Production-ready Django REST Framework API containerized with Python 3.13-slim and PostgreSQL 16.

Image
Languages & frameworks
Developer tools
0

57

mahmoudaboelfotouh/little-lemon-api repository overview

ā šŸ‹ Little Lemon Restaurant - Django REST Framework API

A fully containerized, high-performance RESTful API for the Little Lemon Restaurant management system, built with Django REST Framework and orchestrated with PostgreSQL 16.


⁠🌟 Architecture & Features

  • Optimized Python Runtime: Built on top of python:3.13-slim for a minimal attack surface and small footprint (~97MB compressed).
  • Modern Database Driver: Powered by psycopg 3 for robust and high-speed PostgreSQL connectivity.
  • Microservices Orchestration: Fully orchestrated with PostgreSQL 16 via Docker Compose.
  • Environment Isolation: Decoupled database credentials and configuration via environment variables (.env).
  • Data Persistence: Persistent storage using dedicated Docker Named Volumes (postgres_data).
  • Developer Experience: Configured for local development with Bind Mounts for live hot-reloading.

ā šŸš€ Quick Start with Docker Compose

To spin up the entire API stack along with the PostgreSQL database, create a docker-compose.yaml:

services:
  web:
    image: mahmoudaboelfotouh/little-lemon-api:v1.0
    container_name: little_lemon_api
    restart: always
    ports:
      - "8000:8000"
    environment:
      - DB_ENGINE=django.db.backends.postgresql
      - DB_NAME=littlelemon_db
      - DB_USER=lemon_user
      - DB_PASSWORD=secretpassword
      - DB_HOST=db
      - DB_PORT=5432
    depends_on:
      - db

  db:
    image: postgres:16-alpine
    container_name: little_lemon_postgres
    restart: always
    environment:
      - POSTGRES_DB=littlelemon_db
      - POSTGRES_USER=lemon_user
      - POSTGRES_PASSWORD=secretpassword
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

volumes:
  postgres_data:
⁠Run the Stack:
docker compose up -d
⁠Run Database Migrations:
docker compose exec web python manage.py migrate

Access the API at: http://localhost:8000/api/


ā šŸ› ļø Tech Stack

LayerTechnology
Language & RuntimePython 3.13-slim
Web FrameworkDjango 5.x / Django REST Framework (DRF)
DatabasePostgreSQL 16
Package ManagerPipenv
ContainerizationDocker & Docker Compose

ā šŸ”— Source Code & Documentation

Full project source code, database schemas, and API endpoints are available on GitHub: šŸ‘‰ GitHub: Little-Lemon-DRF⁠

Tag summary

Content type

Image

Digest

sha256:ef288b5ed…

Size

97.6 MB

Last updated

30 days ago

docker pull mahmoudaboelfotouh/little-lemon-api:v1.0