[!CAUTION] Under active development - breaking changes often. Some documentation may be out of date, or not aligned with function. Wait until first release.
The web-template is a project that will enable the quick-start for a high-performance web application. The project goals are:
This foundation is built using a SvelteKit frontend and a Rust backend, further detailed in the Architecture section.
To achieve the above, the project will deliver on the following specific requirements:
sqlx
).The project is structured into two main components:
client/
: A SvelteKit application responsible for the user interface and client-side logic. It is written in TypeScript and uses Bun for package management.server/
: A Rust application using the Axum framework for the backend REST API. It handles business logic, database interaction (via sqlx
), and integrations with external services. Cargo is used for package management.clippy
(Linting)sqlx-cli
(for database migrations)just
(Command runner for managing project tasks)overmind
(or similar, for running multiple processes locally, e.g., client and server dev servers)direnv
(for managing environment variables via .envrc
- which is gitignored)For detailed information about the project:
documentation/ARCHITECTURE.md
for organized architecture documentation covering system design, data flow, authentication mechanisms, and component interactions.documentation/UI_UX_THEME.md
for theming guidelines, CSS variables, dark/light mode implementation, and component styling standards.documentation/PRD.md
for detailed feature specifications.CLAUDE.md
for coding standards and development workflow.Prerequisites:
just
: https://github.com/casey/just#installationsqlx-cli
: Run cargo install sqlx-cli --no-default-features --features rustls,postgres,sqlite
direnv
: https://direnv.net/docs/installation.html and hook it into your shell.pre-commit
: https://pre-commit.com/#installClone the repository.
git clone <repository-url> # Replace <repository-url> with the actual URL
cd <repository-name>/web-template # Replace <repository-name>
Setup Environment:
web-template/example.envrc
to web-template/.envrc
.cp .envrc.example .envrc
.envrc
:DATABASE_URL
: SQLite database connection string (e.g., sqlite:./db/dev.sqlite3?mode=rwc
)JWT_SECRET
: A secure 32+ character secret key for JWT token signingGOOGLE_CLIENT_ID
: Your Google OAuth client ID from Google ConsoleGOOGLE_CLIENT_SECRET
: Your Google OAuth client secret from Google ConsoleSERVER_URL
: Your server URL (default: http://localhost:8081
)direnv allow
in the project root (web-template/
) to load the environment variables.Install Pre-commit Hooks:
pre-commit install
to set up the git hooks defined in .pre-commit-config.yaml
. This ensures code quality checks are run before each commit.Initial Project Setup (Clean Install & Build):
just setup
. This command cleans previous build artifacts and dependencies, then installs fresh dependencies for both client and server, and performs an initial build.Database Setup:
just db-setup
to apply database migrations using sqlx
. This will create the necessary tables in your database.OAuth Configuration (Required for Authentication):
http://localhost:8081/api/auth/oauth/google/callback
(development).envrc
fileRun the application (Development):
just dev
. This will start both the client and server development servers using Overmind (ensure Procfile.dev
is configured in web-template/
).http://localhost:5173
(or as configured by Vite/SvelteKit).http://localhost:3000
(or as configured in server/.env
if applicable, or Rocket.toml
for Rocket).All common development tasks are managed via the justfile
located in the web-template
directory. Run just
in the terminal from this directory to see a list of available commands.
Key command categories include:
setup
: For initial project setup (cleans, installs all dependencies, and builds). (just setup
)dev
: For running development servers using Overmind. (just dev
). For individual servers: just client-dev-server
or just server-dev-server [--hotreload]
.build
: For building client and server for production. (just build
, just build-client
, just build-server
)check
: For running linters, type checkers, and formatters (in check mode). (just check
, just check-client
, just check-server
)format
: For auto-formatting code. (just format
, just format-client
, just format-server
)test
: For running unit, integration, and e2e tests. (just test [server_pattern] [client_pattern] [e2e_pattern]
, just server-test [pattern]
, just test-client [pattern]
, just test-e2e [pattern]
)db-*
: For database migration tasks using sqlx
. (just db-setup
, just db-migrate
, just db-rollback
, just db-new-migration <name>
)clean
: For cleaning build artifacts, dependencies, and temporary files. (just clean
, just clean-client
, just clean-server
)Refer to CLAUDE.md
for detailed guidelines on development practices, code style, and contributing to this project.
This template includes a CLI tool for scaffolding new projects:
# Build the template CLI tool
just template-build
# Create a new project interactively
./scripts/create-web-template/target/release/create-web-template new my-project
# Create a project with specific features
./scripts/create-web-template/target/release/create-web-template new my-project \
--features local_auth,stripe_payment,chat
# Update an existing project with latest template changes
./scripts/create-web-template/target/release/create-web-template update
See the template usage documentation for detailed instructions.
This project enforces high code quality through several mechanisms:
Pre-commit Hooks: Configured in web-template/.pre-commit-config.yaml
, these hooks automatically run on every git commit
attempt. They perform checks like:
gitleaks
).cargo fmt
for server).cargo clippy -D warnings -D clippy::pedantic
for server).Cargo.lock
, bun.lockb
) are up-to-date and consistent with Cargo.toml
/package.json
.
If any hook fails, the commit will be aborted, allowing you to fix the issues. You must run pre-commit install
once in the repository (from the web-template
directory or the repo root if configured project-wide) to enable these hooks.Manual Quality Checks: Use the just check
command to run all linters, formatters (in check mode), and type checkers for both client and server.
just check-client
: Runs all checks for the SvelteKit client.just check-server
: Runs all checks for the Rust server.
It's good practice to run these before pushing changes, even with pre-commit hooks enabled.Continuous Integration (CI): (To be configured) CI pipelines will eventually run all checks (just check
), builds (just build
), and tests (just test
) automatically on pull requests and merges to the main branch to ensure ongoing quality and stability.