Additional Settings
Production-Ready Authentication & Dashboard features¶
This template comes with a pre-configured authentication system and a simple dashboard interface, allowing you to start building your application with user management features immediately.
Hot Reload on development¶
The project includes two hot reloads running the application, one for the backend and one for the frontend. These automatically restart local servers when they detect changes, ensuring that the application is always up to date without needing manual restarts.
- The backend hot reload monitors changes to the backend code.
- The frontend hot reload monitors changes to the frontend code and the
openapi.json
schema generated by the backend.
Manual Execution of Hot Reload Commands¶
You can manually execute the same commands that the hot reloads call when they detect a change:
-
To export the
openapi.json
schema:or using Docker:cd fastapi_backend && uv run python -m commands.generate_openapi_schema
docker compose run --rm --no-deps -T backend uv run python -m commands.generate_openapi_schema
-
To generate the frontend client:
or using Docker:cd nextjs-frontend && npm run generate-client
docker compose run --rm --no-deps -T frontend npm run generate-client
Testing¶
To run the tests, you need to run the test database container:
make docker-up-test-db
Then run the tests locally:
make test-backend
make test-frontend
Or using Docker:
make docker-test-backend
make docker-test-frontend
Pre-Commit Setup¶
To maintain code quality and consistency, the project includes two separate pre-commit configuration files:
- .pre-commit-config.yaml
is used to run pre-commit checks locally.
- .pre-commit-config.docker.yaml
is used to run pre-commit checks within Docker.
Installing and Activating Pre-Commit Hooks¶
To activate pre-commit hooks, run the following commands for each configuration file:
-
For the local configuration file:
pre-commit install -c .pre-commit-config.yaml
-
For the Docker configuration file:
pre-commit install -c .pre-commit-config.docker.yaml
Localhost Email Server Setup¶
To set up the email server locally, you need to start MailHog by running the following command:
make docker-up-mailhog
- Email client: Access the email at
http://localhost:8025
.
Running Pre-Commit Checks¶
To manually run the pre-commit checks on all files, use:
pre-commit run --all-files -c .pre-commit-config.yaml
or
pre-commit run --all-files -c .pre-commit-config.docker.yaml
Updating Pre-Commit Hooks¶
To update the hooks to their latest versions, run:
pre-commit autoupdate
Alembic Database Migrations¶
If you need to create a new Database Migration:
make docker-db-schema migration_name="add users"
make docker-migrate-db
GitHub Actions¶
This project has a pre-configured GitHub Actions setup to enable CI/CD. The workflow configuration files are inside the .github/workflows directory. You can customize these workflows to suit your project's needs better.
Secrets Configuration¶
For the workflows to function correctly, add the secret keys to your GitHub repository's settings. Navigate to Settings > Secrets and variables > Actions and add the following keys:
DATABASE_URL: The connection string for your primary database.
TEST_DATABASE_URL: The connection string for your test database.
ACCESS_SECRET_KEY: The secret key for access token generation.
RESET_PASSWORD_SECRET_KEY: The secret key for reset password functionality.
VERIFICATION_SECRET_KEY: The secret key for email or user verification.
Makefile¶
This project includes a Makefile
that provides a set of commands to simplify everyday tasks such as starting the backend and frontend servers, running tests, building Docker containers, and more.
Available Commands¶
You can see all available commands and their descriptions by running the following command in your terminal:
make help