This guide walks you through cloning the project, connecting it to a local PostgreSQL database, and making your first authenticated API call — all in under five minutes. By the end you will have a running server, a registered user account, and a freshly created post.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.
Install dependencies
Install the project dependencies using uv. The project requires Python ≥ 3.14 and is managed via
pyproject.toml with a lockfile — uv sync installs the exact pinned versions.Configure environment
Create a Make sure the PostgreSQL database named
.env file in the project root (the same directory that contains pyproject.toml). The application uses pydantic-settings to load every value from this file at startup — all variables are required..env
social_media (or whatever you set for DATABASE_NAME) already exists before continuing. You can create it with:Run database migrations
Apply all Alembic migrations to create the schema in your database.On success Alembic prints the revision IDs it applied. If you see an error connecting to the database, double-check the credentials in your
.env file.Start the server
Launch the development server with hot-reload enabled.You should see output similar to:
Register a user
Create your first user account. The A successful response returns the new user’s ID, email, and creation timestamp with HTTP
POST /users/ endpoint does not require a token.201 Created:Attempting to register with an email that already exists returns HTTP
409 Conflict.Login to get a token
Exchange your credentials for a JWT access token. The login endpoint expects form-encoded data (not JSON), because it uses FastAPI’s The response contains your Bearer token:Copy the value of
OAuth2PasswordRequestForm.access_token — you need it for all subsequent requests. Providing wrong credentials returns HTTP 403 Forbidden.Create your first post
Pass the access token in the A successful response returns the created post with HTTP You are now set up and ready to explore the full API. Head to http://localhost:8000/docs to browse all available endpoints interactively.
Authorization header to create a post. Replace TOKEN with the value you received in the previous step.201 Created: