Skip to content

SheikhIshere/django-recipe-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Recipe API ๐Ÿณ

A robust, well-tested RESTful API for managing recipes with full CRUD operations, authentication, and image uploads.

Django DRF Docker PostgreSQL

โœจ Features

Feature Description
๐Ÿ” Authentication Token-based auth with custom email user model
๐Ÿ“ Recipe Management Full CRUD with image uploads & filtering
๐Ÿท๏ธ Tag System Organize recipes with customizable tags
๐Ÿฅ— Ingredient System Manage recipe ingredients efficiently
๐Ÿ“š API Documentation Interactive Swagger/OpenAPI docs
๐Ÿณ Docker Ready Production-ready containerization
โœ… Well Tested 1000+ lines of comprehensive tests

๐Ÿš€ Quick Start

Prerequisites

  • Docker
  • Docker Compose

Installation

  1. Clone & Setup
git clone https://github.com/SheikhIshere/django-recipe-api
cd recipe_api
  1. Build & Run
docker-compose build
docker-compose up
  1. Access the API
  1. Create Superuser (optional)
docker-compose run --rm app sh -c 'python manage.py createsuperuser'

๐Ÿ“ Project Structure

recipe_api/
โ”œโ”€โ”€ App/
โ”‚   โ”œโ”€โ”€ core/                 # Project settings & config
โ”‚   โ”œโ”€โ”€ users/               # Custom user model & auth
โ”‚   โ”œโ”€โ”€ recipe/              # Recipe, Tag, Ingredient models
โ”‚   โ””โ”€โ”€ test/               # 1000+ lines of comprehensive tests
โ”œโ”€โ”€ docker-compose.yml       # Multi-service setup
โ”œโ”€โ”€ Dockerfile              # App container definition
โ””โ”€โ”€ requirements.txt        # Python dependencies

๐Ÿ”Œ API Endpoints

Method Endpoint Description
POST /api/users/ User registration
POST /api/users/token/ Get auth token
GET /api/recipes/ List recipes
POST /api/recipes/ Create recipe
GET /api/recipes/{id}/ Get recipe details
PUT /api/recipes/{id}/ Update recipe
DELETE /api/recipes/{id}/ Delete recipe
GET/POST /api/tags/ Manage tags
GET/POST /api/ingredients/ Manage ingredients

๐Ÿ› ๏ธ Development

Running Tests

docker-compose run --rm app sh -c 'python manage.py test'

Database Migrations

docker-compose run --rm app sh -c 'python manage.py migrate'

Accessing Container Shell

docker-compose exec app sh

๐ŸŽฏ Key Features Deep Dive

๐Ÿ” Secure Authentication

  • Custom user model with email authentication
  • Token-based security for API access
  • Protected endpoints with DRF permissions

๐Ÿ“ Advanced Recipe Management

  • Image upload with UUID filename handling
  • Many-to-many relationships with Tags & Ingredients
  • Advanced filtering (?tags=1,2, ?ingredients=3)
  • assigned_only query parameter for clean responses

โœ… Production Ready

  • PostgreSQL for production database
  • Docker containerization
  • Comprehensive test suite
  • Modular and scalable architecture

๐Ÿšฆ Example Usage

Create Recipe

POST /api/recipes/
Content-Type: application/json
Authorization: Token <your-token>

{
  "title": "Pasta Carbonara",
  "time_minutes": 30,
  "price": 12.50,
  "tags": [1, 2],
  "ingredients": [1, 3, 5]
}

Filter Recipes

GET /api/recipes/?tags=1&ingredients=3

๐Ÿ“Š Testing Coverage

The project includes extensive testing with:

  • โœ… Model tests
  • โœ… API endpoint tests
  • โœ… Authentication tests
  • โœ… Serializer validation tests
  • โœ… Image upload tests
  • โœ… Filter and search tests

๐Ÿ”ฎ Future Enhancements

  • Recipe rating system
  • Advanced search with Elasticsearch
  • Social features (sharing, comments)
  • Meal planning functionality
  • Recipe import from URLs

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Built with โค๏ธ using Django REST Framework | 100% Test Coverage

About

REST API for managing recipes, ingredients, and tags using Django, DRF, and Docker

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors