For this project we need:
- Clone the repository
- Install the dependencies
- Start the compose files
- Create
*.env
files - Run the migrations
- Create administrator user
- Use the API
# HTTPS
git clone https://github.com/Wandering-Cursor/Samurai-Backend.git
# OR SSH
git clone [email protected]:Wandering-Cursor/Samurai-Backend.git
# OR GitHub CLI
gh repo clone Wandering-Cursor/Samurai-Backend
All the dependencies are managed by PDM, so you just need to:
- Install PDM
- Install the dependencies
You can refer to PDM Docs on that matter
pdm install
docker compose -f compose/dev-docker-compose.yml up -d
This will start the database and the redis server.
This project needs two .env
files:
security_env
- Handles the security settings (JWT, CORS, etc.)settings_env
- Handles general settings (Debug mode, DB connection, etc.)
Examples are provided in security.env.md and settings.env.md
You can also refer to settings models for more details
They should be placed in /run/secrets/
folder. (Unless you are running Docker. Then you should use ./compose/.secrets/
folder.)
To run migrations you have to be in: src/samurai_backend/
folder.
## Assuming you are in the root of the project
cd src/samurai_backend/
alembic upgrade head
For more information on alembic migrations (creation, reversal, applying), you can refer to CLI docs, or Alembic Docs
alembic --help
Creating an administrator user is done through the CLI.
pdm create_admin
Then follow prompts to create the user.
Start the api with your editor (there's a launch configuration for VSCode) or with the following command:
pdm run_server
P.S. You can also use any other configuration for the server, like gunicorn
, uvicorn
, etc.
The app is invoked through samurai_backend.app:app
module.