https://github.com/arcbjorn/arc-social-media-platform-api
Social media platform backend using FastAPI, SQLAlchemy, PostgreSQL, Alembic, Docker
https://github.com/arcbjorn/arc-social-media-platform-api
alembic docker docker-compose fastapi postgresql pydantic pytest python sqlalchemy
Last synced: 3 months ago
JSON representation
Social media platform backend using FastAPI, SQLAlchemy, PostgreSQL, Alembic, Docker
- Host: GitHub
- URL: https://github.com/arcbjorn/arc-social-media-platform-api
- Owner: arcbjorn
- Created: 2021-11-03T20:37:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-15T18:59:00.000Z (over 4 years ago)
- Last Synced: 2025-06-26T08:44:30.475Z (about 1 year ago)
- Topics: alembic, docker, docker-compose, fastapi, postgresql, pydantic, pytest, python, sqlalchemy
- Language: Python
- Homepage:
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Social media platform backend
using FastAPI, SQLAlchemy, PostgreSQL, Alembic, Docker
### Clone repository
```sh
git clone
```
### Make sure you have Python installed
```sh
python -V
```
### Setup virtual environment (venv)
```sh
python3 -m venv venv
```
### Activate venv and install dependencies
**Important:** check the correct way of activation depending on your shell. Consult [here.](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments) (I use [fish shell](https://fishshell.com/))
```sh
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
```sh
# generate SQL
alembic revision --autogenerate -m "Create users, posts, votes tables"
# run SQL
alembic revision upgrade head
```
### Run app in Development mode
```sh
uvicorn app.main:app --reload
```
**Run app with Docker**
```sh
# 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
```sh
# 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
```sh
pytest tests/ -v -s
```