Skip to content

Social media platform backend using FastAPI, SQLAlchemy, PostgreSQL, Alembic, Docker

Notifications You must be signed in to change notification settings

arcbjorn/arc-social-media-platform-api

Repository files navigation

Social media platform backend

using FastAPI, SQLAlchemy, PostgreSQL, Alembic, Docker

Clone repository

git clone <this-repo>

Make sure you have Python installed

python -V

Setup virtual environment (venv)

python3 -m venv venv

Activate venv and install dependencies

Important: check the correct way of activation depending on your shell. Consult here. (I use fish shell)

source ./venv/bin/activate
python -m pip install -r requirements.txt

Create .env file & set up environmental variables using .env.example

Set up database (create tables & relations) with Alembic

# generate SQL
alembic revision --autogenerate -m "Create users, posts, votes tables"
# run SQL
alembic revision upgrade head

Run app in Development mode

uvicorn app.main:app --reload

Run app with Docker

# build container
docker build -t social-media-platform-api .
# start container
docker run social-media-platform-api

Run app with Docker Compose in Development mode

# build & start services
docker-compose -f docker-compose-dev.yaml up -d
# stop services
docker-compose -f docker-compose-dev.yaml down -d

Run tests

pytest tests/ -v -s

About

Social media platform backend using FastAPI, SQLAlchemy, PostgreSQL, Alembic, Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages