This is a full-stack web application template using FastAPI for the backend and SvelteKit for the frontend.
git clone <repository-url>
cd fastapi-sveltekit-starter
The fastest way to get started is using VS Code's devcontainer feature:
Note: Always run docker compose
commands in a terminal on your host machine, not inside the devcontainer.
Install prerequisites:
curl -LsSf https://astral.sh/uv/install.sh | sh
)Create a virtual environment:
cd backend
uv venv --python 3.13
source .venv/bin/activate
Install dependencies:
uv pip install -r requirements.txt
Install dependencies:
cd frontend
npm install
Start the development server:
npm run dev
Start the development environment with Docker:
The services will be available at:
When adding or updating dependencies:
[project].dependencies
[project.optional-dependencies].dev
Recompile pinned requirements:
cd backend
uv pip compile pyproject.toml -o requirements.txt
uv pip compile pyproject.toml --extra dev -o requirements-dev.txt
Install:
uv pip install -r requirements.txt
# Or for dev environment:
uv pip install -r requirements-dev.txt
The backend uses Ruff for linting and formatting, and Pyright for type checking. Configuration is in backend/pyproject.toml.
Ruff is an extremely fast Python linter and formatter that replaces tools like Flake8, isort, and Black.
Run linting:
cd backend
ruff check .
Auto-fix issues:
ruff check --fix .
Format code:
ruff format .
VS Code Integration: The devcontainer automatically configures Ruff for format-on-save and auto-fix-on-save via the Ruff extension.
Pyright is a fast, feature-rich static type checker for Python.
Run type checking:
cd backend
pyright
Configuration:
Type checking is set to strict
mode in backend/pyproject.toml. You can adjust the strictness level or enable/disable specific rules as needed.
The frontend uses ESLint for linting, Prettier for formatting, and svelte-check for type checking.
Run linting:
cd frontend
npm run lint
Configuration is in frontend/eslint.config.js.
Format code:
cd frontend
npm run format
Configuration is in frontend/prettier.config.js.
Run type checking:
cd frontend
npm run check
VS Code Integration: The devcontainer automatically configures ESLint and Prettier for format-on-save via the Svelte extension.
This project uses pre-commit to run various hooks before each commit:
Devcontainer: pre-commit and the Git hook are installed automatically after the container is created.
Local setup (outside the Dev Container):
# Install pre-commit
pip install pre-commit # or: uv pip install pre-commit
# Install frontend dependencies (required for frontend hooks)
cd frontend && npm install && cd ..
# Install the git hooks
pre-commit install
# Optional: run on all files immediately
pre-commit run --all-files
cd backend
pytest
cd backend
docker build -t fastapi-backend .
cd frontend
docker build -t sveltekit-frontend .
Use Conventional Commits for all commit messages to keep history consistent and automatable.
Format:
Common types:
Examples:
Enforcement: