This is a mini social media project that I created to learn more about the FastAPI and React frameworks. It is a simple social media site that allows users to create accounts and make posts. It is a work in progress and I plan to add more features in the future.
This repo contains the backend code of the project made with FastAPI.
The frontend code can be found here.
- Create accounts
- User posts
- Docker
- Docker Compose
- Python >= 3.10
- Pipenv
- Traefik (optional)
- Clone the repo
git clone https://github.com/fhilipecrash/social-network-api
- Run the project
- Without Docker python container
docker-compose up -d pgsql # Run the postgres container pipenv shell # Activate the virtual environment pipenv install # Install the dependencies pipenv run dev # Run the project
- With Docker python container
docker-compose up -d # Run the postgres and python container
- With Devcontainer If you have Devcontainer extension just open the project in VSCode and it will automatically create the container for you.
- Without Docker python container
When you enter the project for the first time you will need to run the migrations to create the database tables.
pipenv run migrate
Checkout the Swagger documentation at http://localhost:8000/docs
You can use traefik to use a basic proxy to the project. If you have trakif binary on your PATH, you can run the following command to start the proxy:
Note: Traefik is started automatically when you run the project with docker-compose.
Note: This command will use your current terminal session to run the proxy and you don't be able to use the terminal while the proxy is running. So open a new terminal session to run the project.
pipenv run proxy # Run the proxy
Now you can access the documentation at http://localhost:9999/api/v1/docs just like any other application route and it is recommended to use the same url and port to test the endpoints.