Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SocialAPI 🚀

An enterprise-grade, high-performance asynchronous RESTful social media backend engine built using modern Python paradigms, strict relational data modeling, and robust automated validation pipelines.


One-line description

An asynchronous Python API engine featuring Pydantic schema constraints, robust PostgreSQL relational abstractions, automated Alembic migrations, unified integration test matrices, and automated Git-driven CI/CD delivery rails.


Problem

Many backend architectures encounter performance bottlenecks and maintenance friction due to slow, synchronous blocking processes, untracked relational database drift, and a lack of reliable testing structures. Developers often struggle to transition APIs from local sandbox environments to secure, self-healing cloud instances safely. This project provides a robust, production-ready solution by utilizing FastAPI's asynchronous engine, enforcing strict runtime typing via Pydantic, managing infrastructure schemas using Alembic, writing resilient Pytest validation suites, and deploying containerized or native setups through automated continuous pipelines.


Features

  • High-Performance Asynchronous Routing: Leveraging FastAPI's modern ASGI engine for fast processing with zero-overhead routing metrics.
  • Declarative Data Engineering: Extensive relational data modeling using PostgreSQL, featuring explicit constraints, indices, primary/foreign keys, and data normalization.
  • Dual Persistence Layer Abstractions: Complete implementation coverage utilizing both raw relational SQL execution layers and advanced Object-Relational Mapping (ORM) design patterns via SQLAlchemy.
  • Deterministic Runtime Data Contracts: Strict validation and automated sanitization of data schemas for inbound and outbound HTTP payloads using Pydantic models.
  • Incremental Schema Evolution Control: Version-controlled database migration sequences managed through Alembic, eliminating data drift across staging and production branches.
  • Automated Regression Defense Matrices: Comprehensive suite of integration, unit, and authentication test suites powered by Pytest, executing against isolated temporary database containers.
  • Self-Documenting API Discovery Gateway: Instantly generated interactive API exploration platforms (Swagger UI / ReDoc) updating automatically alongside source modifications.
  • Hardened Production Deployment & CI/CD Pipelines: Enterprise-grade environment isolation utilizing Docker containers, Nginx reverse-proxies, systemd supervisors, and complete GitHub Actions continuous testing and automated delivery workflows.

Tech Stack

  • Core Runtime & Web Framework: Python (v3.10+), FastAPI (ASGI).
  • Database & Client Engine: PostgreSQL, PGAdmin4.
  • Data Layer & Migration Engineering: SQLAlchemy ORM, Alembic.
  • Validation & Schema Management: Pydantic.
  • Testing & Quality Assurance: Pytest, Postman.
  • Server Orchestration & Edge Control: Nginx (Reverse Proxy), Uvicorn (ASGI Server), systemd.
  • Automation & Container DevOps: Docker, GitHub Actions CI/CD.

Architecture

SocialAPI handles requests using a decoupled tier-based structure, passing clear boundaries down from the public gateway into the underlying storage layer.

+------------------------------------------------------------+
|                  1. UI / API Gateway Layer                 |
|         (Postman / Web Clients / Swagger Interactive UI)   |
+------------------------------------------------------------+
                              |
                     [HTTP REST JSON Payloads]
                              |
                              v
+------------------------------------------------------------+
|                 2. Fast API Asynchronous Core              |
|        (Pydantic Models / Router Middlewares / JWT Auth)   |
+------------------------------------------------------------+
                              |
               [SQLAlchemy ORM / Alembic Migrations]
                              |
                              v
+------------------------------------------------------------+
|                 3. Relational Storage Layer                |
|           (PostgreSQL Server / Normalized Tables)          |
+------------------------------------------------------------+

Installation

Generate the virtual environment container

python -m venv venv

Activate the environment context (Windows Bash)

source venv/Scripts/activate

Install all package matrices

pip install -r requirements.txt

Environment Configuration

DATABASE_HOSTNAME=localhost DATABASE_PORT=5432 DATABASE_PASSWORD=your_secure_postgres_password DATABASE_NAME=social_api_db DATABASE_USERNAME=postgres SECRET_KEY=your_cryptographically_secure_jwt_signing_key_string ALGORITHM=HS256 ACCESS_TOKEN_EXPIRE_MINUTES=30

Scehma Migration

alembic upgrade head

Running Locally

uvicorn app.main:app --reload

Testing

Run the test runner suite

pytest -v -s

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages