Skip to content

A recipe project I have made using FastAPI as backend and Tailwind.css and javascript for frontend

Notifications You must be signed in to change notification settings

Ilyasks95/FastAPI_Powered

Repository files navigation

Recipe Management App

Project Overview

This is a Recipe Management App built using FastAPI for the backend, PostgreSQL as the database, and Celery with Redis for asynchronous task processing. The app allows users to upload recipe images, process them using OCR (Tesseract), and save structured recipe details such as title, description, ingredients, and instructions.

Features

  • User Authentication: Secure login and access control for recipe owners.
  • Recipe Management: Create, edit, delete, and view recipes.
  • OCR Integration: Extract text from uploaded recipe images.
  • Asynchronous Processing: Celery and Redis handle image processing in the background.
  • Database Storage: PostgreSQL database to store recipe details.
  • Dynamic Frontend: Templates with Tailwind CSS for modern UI.

Tech Stack

  • Backend: FastAPI (Python 3.12)
  • Database: PostgreSQL
  • Task Queue: Celery with Redis
  • OCR: Tesseract OCR
  • Frontend: Jinja2 Templates with Tailwind CSS
  • Containerization: Docker (Optional for deployment)

Installation

1. Clone the repository:

$ git clone <repository_url>
$ cd fastapi_postgresql

2. Create a Virtual Environment:

$ python -m venv venv
$ source venv/bin/activate  # Linux/MacOS
$ .\venv\Scripts\activate  # Windows

3. Install dependencies:

$ pip install -r requirements.txt

4. Configure Environment Variables:

Create a .env file and specify the following:

DATABASE_URL=postgresql://user:password@localhost/recipes_db
REDIS_URL=redis://localhost:6379/0
SECRET_KEY=your_secret_key

5. Database Migration:

$ alembic upgrade head

6. Start Redis Server:

$ redis-server

7. Start Celery Worker:

$ celery -A celery_worker.celery_app worker --pool=solo --loglevel=info

8. Start FastAPI Server:

$ uvicorn app.main:app --reload

Usage

  1. Open the browser at http://127.0.0.1:8000/
  2. Register/Login to create a user account.
  3. Upload a recipe image or add recipes manually.
  4. View and edit recipes in the dashboard.

API Endpoints

  • POST /recipes/upload - Upload and process a recipe image.
  • GET /recipes/{id} - Fetch a recipe by ID.
  • DELETE /recipes/{id} - Delete a recipe.
  • GET /tasks/{task_id}/status - Check the status of an OCR task.

Troubleshooting

Common Commands:

  • Check Redis keys:
$ redis-cli keys *
  • Check Celery Workers:
$ celery -A celery_worker.celery_app status
  • Inspect Queues:
$ celery -A celery_worker.celery_app inspect active_queues

Future Improvements

  • Add recipe image preview.
  • Implement user comments and ratings for recipes.
  • Deploy the app using Docker and AWS services.

**Author Ilyas - Owner and Developer

License: MIT License

About

A recipe project I have made using FastAPI as backend and Tailwind.css and javascript for frontend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published