Building This Site: Svelte, Bun, and Dokploy
Building This Site
I wanted a personal site that felt mine - not another cookie-cutter template on a managed platform. After watching Dreams of Code’s video on self-hosting with Dokploy, I knew I wanted to deploy on my own VPS.
The Stack
| Tool | Why |
|---|---|
| SvelteKit 2 | File-based routing, SSR, and feels like writing HTML |
| Svelte 5 | Runes are genuinely better than the old $: syntax |
| Bun | Fast installs, TypeScript out of the box |
| Tailwind CSS 4 | CSS without leaving my markup |
| Dokploy | Self-hosted Vercel on my own VPS |
I’d used React and Next.js professionally, but Svelte always felt more intuitive. When Svelte 5 landed with runes, it was the push I needed.
Why Bun?
Bun replaced npm/yarn/pnpm for me. The difference is noticeable:
# npm install: ~45 seconds
# bun install: ~8 seconds
It also runs TypeScript directly, handles the dev server, and works seamlessly with SvelteKit. One tool, less config.
Dokploy: Your Own PaaS
This is the interesting part. Dokploy is an open-source deployment platform - think Vercel or Netlify, but self-hosted on any VPS.
Why not just use Vercel?
- Full control over my infrastructure
- No surprise bills from traffic spikes
- Learning opportunity (the real reason)
- I had a VPS sitting idle anyway
Dokploy handles:
- Automatic builds from GitHub pushes
- SSL certificates via Let’s Encrypt
- Docker container management
- Zero-downtime deployments
The setup was straightforward. After installing Dokploy on my VPS, I connected my GitHub repo and it detected the SvelteKit app automatically.
The Nixpacks Config
Dokploy uses Nixpacks for builds. My config is minimal:
[variables]
NODE_ENV = "production"
CI = "true"
[phases.install]
cacheDirectories = [".bun/install/cache"]
[phases.build]
cacheDirectories = ["node_modules/.cache", ".svelte-kit"]
[start]
cmd = "node build/index.js"
It caches dependencies between builds, so subsequent deploys are fast.
GitHub Actions + Dokploy
I run CI checks (linting, type checking, tests) in GitHub Actions before Dokploy deploys:
- Push to
main - GitHub Actions runs lint, typecheck, unit tests, e2e tests
- If all pass, Dokploy auto-deploys
This keeps broken code off production while letting Dokploy handle the actual deployment.
What I Learned
Svelte 5 runes are worth learning. The $state(), $derived(), and $props() pattern is cleaner than the old reactive syntax. It’s explicit without being verbose.
Bun is production-ready. I was skeptical, but it’s been solid. The speed gains are real.
Self-hosting isn’t that hard. Dokploy removes most of the complexity. If you have basic Linux knowledge and a $5/month VPS, you can run your own PaaS.
Resources
The source code for this site is on GitHub.