Skip to content

Hungle2911/rarecipe-api

Repository files navigation

Rarecipe API Project

A robust REST API built with Django REST Framework that allows users to manage recipes, ingredients, and tags. The API includes features like user authentication, image upload, and filtering capabilities.

🚀 Features

  • User Authentication
  • Create, Read, Update, and Delete Recipes
  • Manage Recipe Tags and Ingredients
  • Image Upload for Recipes
  • Filtering and Sorting
  • Comprehensive Test Suite
  • Docker Support
  • CI/CD with GitHub Actions

🛠 Tech Stack

  • Python 3.9
  • Django & Django REST Framework
  • PostgreSQL
  • Docker & Docker Compose
  • GitHub Actions for CI/CD
  • Pillow for Image Processing
  • DRF Spectacular for automating Django REST APIs documentation

📋 Prerequisites

  • Docker and Docker Compose installed
  • Python 3.9 or higher (if running locally)
  • Git

🔧 Installation & Setup

Using Docker (Recommended)

  1. Clone the repository:
git clone https://github.com/Hungle2911/rarecipe-api
cd rarecipe-api
  1. Create environment file:
cp .env.example .env
  1. Build and run the containers:
docker-compose up --build
  1. Run migrations:
docker-compose run --rm app sh -c "python manage.py migrate"

Local Development

  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up the database:
python manage.py migrate
  1. Run the development server:
python manage.py runserver

🧪 Running Tests

With Docker:

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

Locally:

python manage.py test

📚 API Documentation

API Documentation Endpoints

  • /api/docs/ - See what endpoints available

API Endpoints

🐳 Docker Commands

Common commands for managing the application:

# Build and start containers
docker-compose up --build

# Run migrations
docker-compose exec app python manage.py migrate

# Run tests
docker-compose run --rm app sh -c "python manage.py test"

# Stop containers
docker-compose down

🧑‍💻 Development

  1. Create a new branch for your feature:
git checkout -b feature/your-feature-name
  1. Make your changes and commit them:
git commit -m "Add your message"
  1. Push to your branch:
git push origin feature/your-feature-name
  1. Create a Pull Request

🧪 Testing

The project includes comprehensive tests for:

  • User Authentication
  • Recipe Management
  • Tag and Ingredient Operations
  • Image Upload Functionality

Ensure all tests pass before submitting pull requests:

python manage.py test

📝 Code Style

This project follows PEP 8 guidelines. Install and run flake8:

pip install flake8
flake8

👥 Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

🙏 Acknowledgments

  • Django REST Framework documentation
  • Docker documentation
  • GitHub Actions documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published