Skip to content

A Template backend with FastAPI and Flask APIs, Nginx, Redis, and PGSQL in docker

License

Notifications You must be signed in to change notification settings

S3L1M/Backend-System

Repository files navigation

Backend-System

A template backend project with FastAPI and Flask APIs, Nginx, Redis, and PostgreSQL in Docker.

Table of Contents

Description

This project provides a template backend with two APIs built using FastAPI and Flask frameworks. It includes an Nginx server as the API gateway, Redis for caching, and PostgreSQL as the database. The Docker environment ensures easy setup and deployment, making it convenient for developers to use this template as a starting point for their backend projects.

Installation

To use this template backend, you need to have Docker installed on your system. Follow the steps below to set up and run the project:

  1. Clone this repository to your local machine:

    git clone https://github.com/S3L1M/Backend-System.git
  2. Navigate to the project directory:

    cd Backend-System
  3. Build the Docker images and start containers:

    ./run.sh

The APIs will be accessible through API gateway (Ngnix) at https://localhost:8000/inventory (FastAPI) and https://localhost:8000/accounts (Flask) once the containers are up and running.

Usage

This template backend provides two different APIs using FastAPI and Flask frameworks. You can use any of these APIs based on your preference and requirements. The API endpoints are detailed in endpoints section.

Architecutre

Inventory dummy data

By defualt, inventory database will be populated with dummy data with the following code in inventory-service/app.py file.

# Add dummy product data
db = SessionLocal()
for i in range(1, 101):
    name = f'Product_{i}</