This repository demonstrates building a RESTful API using the FastAPI framework. The API allows users to:
Create posts by submitting JSON data Retrieve or list posts from other users Delete and update their own posts All post data is stored in a PostgreSQL database, a popular open-source relational database.
Tools and Frameworks Used FastAPI
The main web framework powering the API, known for speed and intuitive syntax. Provides routing, request handling, dependency injection, and OpenAPI schema generation. SQLAlchemy
An Object Relational Mapper (ORM) for Python. Handles model definitions, table creation, and database operations in Pythonic code instead of raw SQL. Connection to the PostgreSQL database is managed via SQLAlchemy. Alembic
Database migration tool for SQLAlchemy. Used to generate, run, and manage migrations (upgrades/downgrades) of the database schema over time. PostgreSQL
The actual database used for persisting posts and user accounts. Integrated using SQLAlchemy connection strings. psycopg2
PostgreSQL database adapter for Python, used internally for direct database access if needed. Pydantic / pydantic-settings
Used for defining, validating, and parsing data schemas (for request/response models). Also manages configuration via environment variables for things like database credentials and security secrets. jose
Used for JWT (JSON Web Token) encoding/decoding. Enables authentication and authorization via secure token-based login. FastAPI OAuth2 utilities
Handles secure user authentication (login, password hashing, access tokens). CORS middleware
Ensures cross-origin resource sharing is enabled for specific frontend origins. Summary Midhun134/Python-API-development is a backend API server built with FastAPI. It demonstrates how to:
Design models/schemas for posts and users Securely handle authentication (including JWT tokens and password hashing) Interact with a robust relational database via SQLAlchemy ORM Keep database schema versioned and up-to-date using Alembic migrations This is an educational or template project for building scalable Python APIs with modern tools, best suited for learning or kickstarting new FastAPI projects.