Skip to content

Amirshox/FastAPI-Architecture

Repository files navigation

FastAPI Architecture Project

Introduction

This project demonstrates architecture implemented with FastAPI, aiming to provide a scalable and efficient backend solution. The architecture is organized into various modules, including API routes, database models, and service classes, promoting clean code practices and easy maintenance.

Features

  • API Versioning: Supports versioning to accommodate future changes seamlessly.
  • Service Layer Abstraction: Includes a robust service layer for business logic separation.
  • Database Models: Utilizes SQLAlchemy for ORM with asynchronous support.
  • Authentication: Implements basic authentication mechanisms.
  • Pagination: Offers utility functions for data pagination.
  • Error Handling: Enhanced error handling for database integrity and transaction management.

Project Structure

FastAPI-Architecture/
│
├── src/ # Source files
│ ├── api/ # API route definitions
│ ├── core/ # Business logic and database interaction
│ ├── db/ # Database models and session management
│ └── utils/ # Utility functions and helpers
│
├── tests/ # Test suite for the application
├── Dockerfile # Dockerfile for containerization
├── docker-compose.yml # Docker Compose configuration
└── requirements.txt # Project dependencies

Getting Started

Prerequisites

  • Docker
  • Python 3.9+

Installation

  1. Clone the repository:
    git clone https://github.com/Amirshox/FastAPI-Architecture.git
    
  2. Navigate to the project directory:
    cd FastAPI-Architecture
    
  3. Build and run the Docker container:
    docker-compose up --build
    

Usage

  • Access the FastAPI application at http://localhost:8000/docs to view the Swagger UI.
  • Test the API endpoints using the interactive documentation.
  • Make requests to the API routes using tools like curl or Postman.