This project aims to develop the necessary REST API endpoints for a simple social media platform using FastAPI.
Create a virtual environment with your preferred name <venv>:
python3 -m venv <venv><venv>/bin/activateTo install all required dependencies:
pip install -r requirements.txtYou have two options to set up PostgreSQL:
- Install a local instance of PostgreSQL and create an empty database named
fastapi. - Use Docker: From the project root directory, run the following command to spin up PostgreSQL using Docker:
docker compose up -dWe use Alembic for database migrations. Run the following command to create the required tables in the database:
alembic upgrade headTo run the server locally:
uvicorn app.main:app --reloadOnce the server is running, the API documentation is automatically generated. You can access it by visiting:
http://127.0.0.1:8000/docsNow you're all set to experiment with the available API endpoints! 🎉
Alternatively, you could play with the API on AWS without building the app locally: https://www.alinaseri.xyz/docs
🛠️ Tech Stack: Python, FastAPI, PostgreSQL, Alembic, Docker