1
0
Fork
You've already forked rust-svelte-template
0
An opinionated full-stack web app template with a Rust/Axum backend and a SvelteKit frontend
  • Rust 68.9%
  • TypeScript 13.2%
  • Nix 9.1%
  • HTML 3.3%
  • Svelte 3.1%
  • Other 2.4%
2026年03月15日 17:38:28 +01:00
.cargo refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
src refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
src-app refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
static refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
.envrc feat: initial commit 2026年03月15日 13:13:56 +01:00
.gitignore refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
.prettierrc refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
biome.json chore: biome config 2026年03月15日 17:38:28 +01:00
build.rs refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
Cargo.lock chore: update versions in Cargo.toml 2026年03月15日 13:55:40 +01:00
Cargo.toml chore: update versions in Cargo.toml 2026年03月15日 13:55:40 +01:00
clippy.toml feat: error handling 2026年03月15日 13:51:18 +01:00
flake.lock feat: initial commit 2026年03月15日 13:13:56 +01:00
flake.nix feat: initial commit 2026年03月15日 13:13:56 +01:00
package.json refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
pnpm-lock.yaml refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
README.md refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
rust-toolchain.toml feat: initial commit 2026年03月15日 13:13:56 +01:00
svelte.config.js chore: simplify config 2026年03月15日 17:06:03 +01:00
tsconfig.json refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00
vite.config.ts refactor: move frontend project to root 2026年03月15日 16:06:07 +01:00

Rust + Svelte Template

An opinionated full-stack web application template with a Rust/Axum backend and a SvelteKit frontend, which compiles to a single binary.

Stack

  • Backend: Rust, Axum, Tokio, Tracing
  • Frontend: SvelteKit, Svelte 5 (SPA)
  • Type definitions generation: ts-rs
  • Assets embedding: rust-embed

Development

# Enter the nix devShell
nix develop
# Or with direnv
direnv allow
# (Re-)generate the TypeScript bindings
cargo test export_bindings
# Start the backend (http://localhost:3000)
cargo run
# Start the frontend dev server (http://localhost:5173)
pnpm dev

The frontend dev server proxies /api requests to the Rust backend, so both servers must be running during development.

Build

# (Re-)generate the TypeScript bindings
cargo test export_bindings
# Build the release binary
cargo build -r

The SvelteKit project is automatically built when compiling the rust binary, so it's not necessary to run pnpm build manually.

Project structure

.
├── src/
│ ├── main.rs # Axum router setup, AppJson extractor
│ ├── error.rs # AppError type, IntoResponse impl, logging middleware
│ ├── types.rs # Shared types (exported to TypeScript)
│ └── handlers/
│ ├── health.rs # GET /api/health
│ └── assets.rs # Static asset fallback handler
├── src-app/
│ ├── routes/ # SvelteKit pages
│ └── lib/
│ └── bindings/ # Auto-generated TypeScript types (do not edit)
├── build.rs # Builds the frontend as part of cargo build
├── package.json
└── Cargo.toml