π LittleLemon β Restaurant Management API
A RESTful backend API built using Django and Django REST Framework to manage restaurant menu items and table bookings with token-based authentication.
This project was developed as part of the Meta Back-End Developer Professional Certificate on Coursera.
π Tech Stack
Python
Django
Django REST Framework
Djoser (Authentication)
Token Authentication
MySQL
Pipenv
π Features π Authentication (Djoser)
User Registration
Login (Token-based)
Logout
Retrieve authenticated user profile
π½ Menu Management
View all menu items
Create new menu item
Retrieve menu item by ID
Update menu item
Delete menu item
π Booking Management
View all bookings
Create booking
Retrieve booking by ID
Update booking
Delete booking
Protected using IsAuthenticated permission
π Project Structure LittleLemon/ β βββ littlelemon/ # Django project settings β βββ settings.py β βββ urls.py β βββ restaurant/ # Core app β βββ models.py β βββ serializers.py β βββ views.py β βββ urls.py β βββ Pipfile βββ Pipfile.lock βββ manage.py
π API Endpoints π Authentication
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/users/ |
Register new user |
| GET | /auth/users/me/ |
Get authenticated user |
| POST | /auth/token/login/ |
Login and receive token |
| POST | /auth/token/logout/ |
Logout and invalidate token |
| Method | Endpoint | Description |
|---|---|---|
| GET | /restaurant/menu/ |
List all menu items |
| POST | /restaurant/menu/ |
Create menu item |
| GET | /restaurant/menu/<id>/ |
Retrieve single item |
| PUT | /restaurant/menu/<id>/ |
Update item |
| DELETE | /restaurant/menu/<id>/ |
Delete item |
| Method | Endpoint |
|---|---|
| GET | /restaurant/bookings/ |
| POST | /restaurant/bookings/ |
| GET | /restaurant/bookings/<id>/ |
| PUT | /restaurant/bookings/<id>/ |
| DELETE | /restaurant/bookings/<id>/ |
π Installation & Setup 1οΈβ£ Clone Repository git clone https://github.com/ki3ki/LittleLemon.git cd LittleLemon 2οΈβ£ Install Dependencies (Using Pipenv) pipenv install pipenv shell 3οΈβ£ Configure Database
Update settings.py with your MySQL credentials: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'littlelemon', 'USER': 'your_username', 'PASSWORD': 'your_password', 'HOST': 'localhost', 'PORT': '3306', } } 4οΈβ£ Apply Migrations python manage.py makemigrations python manage.py migrate 5οΈβ£ Create Superuser python manage.py createsuperuser 6οΈβ£ Run Server python manage.py runserver Server runs at: http://127.0.0.1:8000/