fastapi-sveltekit

Fastapi Sveltekit

Fullstack template using Fastapi[Psql + Redis] & Sveltkit[SkeletonUI]

Fastapi[psql + redis] & ⚡ Svelte[Skeleton-UI] Docker container 🐳

Fullstack app container using Fastapi, Svelte, Postgres, Redis, and Docker.

Requirements

  • Docker
  • Docker-compose

Installation

1. First clone the repository

git clone https://github.com/olaracode/fast-svelte-docker

2. Then set up your environment variables, for easier maintainability we use a single .env file for all services.

cp .env.example .env

3. Fill .env

    1. Set the POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB to your desired values.
    1. Generate a KEY and REFRESH_KEY

    Both the KEY and REFRESH_KEY are used to sign the JWT tokens, you can generate them using the following command.

    We use the simple openssl command to generate the keys.

    openssl rand -hex 32
    

4. Build the containers

docker-compose up --build

5. With the containers running you need to run:

  • DB Migrations

    docker-compose exec web alembic revision --autogenerate
    
  • DB Upgrade

    docker-compose exec web alembic upgrade head
    

Misc docker commans

Start & build containers

docker-compose up --build

access to the docker terminal

docker-compose exec <service_name> bash

Down all containers and remove volumes

docker-compose down -v

To recreate services(when you change the docker-compose file and want to apply the changes)

docker-compose up --build

To recreate services and remove volumes

docker-compose up --build -V

To recreate services and remove volumes and build the images

docker-compose up --force-recreate

Top categories

Loading Svelte Themes