Frontend: SvelteKit 3 / Svelte 5 + Tailwind 4 + Lucide icons. Backend: Rust + Axum. Deploy: Vercel.
No auth, no database, no required .env: clone, install, run.
This template is built for Bun. Use
bunfor everything (install, scripts, adding packages). Do not use npm/yarn/pnpm: the lockfile isbun.lock, and mixing package managers creates conflicting lockfiles.
Arch Linux: sudo pacman -S rustup && rustup default stable, and Bun via curl -fsSL https://bun.sh/install | bash.
bun install
bun run dev # starts Vite (5173) + the Rust server (3001) togetherOpen http://localhost:5173. Vite proxies /api/* to Rust, so the frontend calls /api/... the same way in dev and in production.
api/server.rs Rust entry point (Vercel Function or local server)
src-rs/lib.rs main router (everything under /api)
src-rs/routes/ one file per route (health.rs, hello.rs)
src/routes/ SvelteKit pages
src/lib/api.ts fetch helper for the backend
bun.lock Bun lockfile (commit it)
src/app.css Tailwind (@import 'tailwindcss')
vite.config.ts Vite + SvelteKit (adapter) config + /api proxy
vercel.json rewrite /api/* -> Rust function
Cargo.toml Rust deps (axum, tokio, serde, vercel_runtime)
- Create
src-rs/routes/ping.rs:pub async fn ping() -> &'static str { "pong" }
- In
src-rs/routes/mod.rs: addpub mod ping;and.route("/ping", get(ping::ping)) - Call it from the frontend:
await api('/ping')→GET /api/ping
Icons come from @lucide/svelte. Import them one by one to keep the bundle small:
<script lang="ts">
import Rocket from '@lucide/svelte/icons/rocket';
</script>
<Rocket class="size-5 text-orange-500" />Browse all icons at https://lucide.dev/icons. Size and color are controlled with Tailwind classes.
| command | what it does |
|---|---|
bun run dev |
frontend + backend together |
bun run dev:web / dev:api |
only one side |
bun run build |
SvelteKit production build |
bun run check |
svelte-check (types) |
bun run check:api / bun run fmt |
cargo check / cargo fmt |
- Push the repo to GitHub (including
bun.lock) and import it in Vercel. The SvelteKit preset is auto-detected, and Vercel installs with Bun when it findsbun.lock. - Deploy. The Rust function is compiled by Vercel's Rust runtime (beta) from
Cargo.toml+api/server.rs.
- SvelteKit 3: Kit config lives in
vite.config.ts(there is nosvelte.config.js), and the import alias is#lib/...(defined inpackage.json > imports), with the file extension in the import ('#lib/api.js'). - Lightweight: Rust
releaseprofile uses LTO +strip; the frontend has no extra dependencies beyond the essentials (Tailwind via the Vite plugin). - Rust on Vercel is in beta. For heavier or long-running workloads, consider a separate service.