Skip to content

Latest commit

 

History

History
115 lines (87 loc) · 2.33 KB

File metadata and controls

115 lines (87 loc) · 2.33 KB

Fuudiy Backend

This is the backend service for the Fuudiy application, built with FastAPI and MongoDB.

Features

  • RESTful API built with FastAPI
  • MongoDB database integration
  • Google Cloud Storage for file storage
  • JWT-based authentication
  • PySpark integration for data processing
  • Docker containerization support

Prerequisites

  • Python 3.9+
  • MongoDB
  • Google Cloud Storage account (for file storage)
  • Java 11 (required for PySpark)

Installation

  1. Clone the repository:
git clone [repository-url]
cd Fuudiy-Backend
  1. Create and activate 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 environment variables: Create a .env file in the root directory with the following variables:
MONGODB_URL=your_mongodb_url
JWT_SECRET=your_jwt_secret
GCS_BUCKET_NAME=your_gcs_bucket_name
  1. Place your Google Cloud Storage key file (gcs-key.json) in the root directory.

Running the Application

Development Mode

uvicorn app.app:app --reload

The API will be available at http://localhost:8000

Using Docker

  1. Build the Docker image:
docker build -t fuudiy-backend .
  1. Run the container:
docker run -p 8000:8000 fuudiy-backend

API Documentation

Once the server is running, you can access:

  • Swagger UI documentation: http://localhost:8000/docs
  • ReDoc documentation: http://localhost:8000/redoc

Testing

Run tests using pytest:

pytest

Project Structure

Fuudiy-Backend/
├── app/                 # Main application code
├── tests/              # Test files
├── requirements.txt    # Python dependencies
├── Dockerfile         # Docker configuration
├── .dockerignore      # Docker ignore file
├── .gitignore         # Git ignore file
└── gcs-key.json       # Google Cloud Storage credentials

Dependencies

Key dependencies include:

  • FastAPI: Web framework
  • Motor: Async MongoDB driver
  • PySpark: Data processing
  • Google Cloud Storage: File storage
  • PyJWT: JWT authentication
  • Pydantic: Data validation
  • Uvicorn: ASGI server

Contributing

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