Skip to content

cht42/fastapi-react-postgres-keycloak

Repository files navigation

fastapi-react-postgres-keycloak

To launch all the services just execute:

docker-compose up -d

Keycloak installation

Create a .env file based on the .env.example file.

⚠️ Don't forget to put values for the password fields

Next step is to launch keycloak:

docker-compose up -d keycloak

To initialize Keycloak with a client and a user, you can use the script in the keycloak folder. Find out more about the API calls made in the Keycloak doc.

You can change the script to have different values for the client name, username, password...

bash keycloak/init.sh

In the output of the script you will find the client secret. Copy it and put it the .env.

You can then access the keycloak console and login with the admin credentials: http://localhost:8080

Running database migrations using Alembic.

First, modify your models in the file database/models.py. Then run the following command to generate the migration:

docker-compose exec backend alembic revision --autogenerate -m "<Your message>"

⚠️ Check this page to see what alembic detects for the Autogenerate

Check the migration file in the alembic/versions folder. If you are happy with it, you can run the migration:

docker-compose exec backend alembic upgrade head

Your database is now up to date !

Generate fake data

To facilitate development, you can generate some fake data by running the following command:

docker-compose exec backend python fake_data.py

Create frontend app

In frontend folder, run:

npx create-react-app app --template typescript --use-npm

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published