A production-ready starter kit for building secure, data-driven applications with SvelteKit and Bun.js runtime.
bun install
Copy env_template to .env and fill in your values:
cp env_template .env
bun run db:push
bun --bun run dev
| Variable | Description | Example |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgresql://user:pass@localhost:5432/dbname |
REDIS_URL |
Redis connection string | redis://localhost:6379 |
BETTER_AUTH_SECRET |
Secret for signing tokens | Random secure string |
BETTER_AUTH_URL |
Base URL of your app | http://localhost:5173 |
KEYCLOAK_ISSUER |
Keycloak realm URL | https://keycloak.example.com/realms/myrealm |
KEYCLOAK_CLIENT_ID |
OAuth client ID | my-app |
KEYCLOAK_CLIENT_SECRET |
OAuth client secret | From Keycloak console |
KEYCLOAK_LOGOUT_ENABLED |
Enable single logout (optional) | true |
BETTER_AUTH_SESSION_EXPIRES_IN |
Session expiration time in seconds | 604800 (7 days) |
BETTER_AUTH_SESSION_UPDATE_AGE |
Session update interval in seconds | 86400 (1 day) |
bun --bun run dev # Start dev server
bun --bun run build # Production build
bun --bun run preview # Preview production build
# Database
bun run db:generate # Generate migrations
bun run db:migrate # Apply migrations
bun run db:push # Push schema to database
bun run db:studio # Open Drizzle Studio UI
# Code quality
bun run check # Type check
bun run lint # Lint code
bun run format # Format code
src/
├── lib/
│ ├── components/ # Reusable components (AgGrid)
│ ├── server/
│ │ ├── auth.ts # Better-Auth configuration
│ │ ├── db/ # Drizzle schema and client
│ │ └── redis/ # Redis client
│ └── auth-client.ts # Client-side auth utilities
├── routes/
│ ├── app/ # Protected routes
│ ├── login/ # Authentication entry
│ ├── sales/ # AG Grid example page
│ └── +page.svelte # Home page
└── hooks.server.ts # Session handling
drizzle/ # Database migrations
Build and run with Docker Compose:
docker compose up -d
Or build the image directly:
docker build -t sveltekit-starter .
docker run -p 3000:3000 --env-file .env sveltekit-starter
This starter uses experimental Svelte features:
query() wrapperMIT