The Social Media Backend is a production-ready REST API built with FastAPI, PostgreSQL, and SQLAlchemy. It provides everything you need to power a social media application: user registration and authentication, full CRUD for posts, and a vote/unvote system — all secured with JWT bearer tokens.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pvnm4/Social-Media-Backend/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
Run the API locally in under 5 minutes with a working PostgreSQL connection.
API Reference
Explore all endpoints — authentication, users, posts, and votes.
Configuration
Set up environment variables for your database, JWT secret, and more.
Deployment
Deploy to Render.com with a free PostgreSQL database in minutes.
What’s included
Authentication
OAuth2 password flow with JWT bearer tokens and bcrypt password hashing.
Posts
Create, read, update, and delete posts with ownership enforcement.
Votes
Vote and unvote on posts with conflict detection and aggregated counts.
Users
Register users with email validation and fetch user profiles by ID.
Database Migrations
Alembic-managed schema migrations for safe, version-controlled changes.
Architecture
Layered FastAPI + SQLAlchemy architecture with Pydantic v2 validation.
Tech stack
| Layer | Technology |
|---|---|
| Framework | FastAPI 0.136+ |
| Database | PostgreSQL via psycopg2 |
| ORM | SQLAlchemy 2.0 |
| Migrations | Alembic |
| Auth | PyJWT + passlib (bcrypt) |
| Validation | Pydantic v2 + pydantic-settings |
| Server | Uvicorn |
The API requires Python 3.14+ and a running PostgreSQL instance. See Local Deployment to get your environment set up.