Back to projects

Personal

FastAPI API template

FastAPI template with a modular architecture and PostgreSQL and Oracle connections through SQLAlchemy.

Images

Context

Reusable base to start new APIs and microservices.

Problem

Starting a new API means repeating the project structure and the database connection setup.

My role

End-to-end design and implementation.

Solution

Structure split into api, services, models and schemas, with connection modules for PostgreSQL (psycopg) and Oracle (oracledb) on SQLAlchemy and configuration through environment variables.

Technical decisions

  • Database sessions injected as FastAPI dependencies, with a controlled lifecycle.
  • Configuration through environment variables, with no credentials in the code.
  • Separate connection modules for PostgreSQL and Oracle.

Outcome

Accelerates project setup and onboarding.

Stack

  • Python
  • FastAPI
  • SQLAlchemy
  • Pydantic
  • PostgreSQL
  • Oracle