Recipes
Complete, step-by-step answers to tasks most apps need. Each recipe starts from what you want to build, shows the Kotlin and the Svelte side together, and uses only Ktor, SvelteKit and what ktor-svelte already does, so you can copy it and adapt the names.
Pick a recipe
| You want to... | Recipe | Level | Time |
|---|---|---|---|
| Go from a Kotlin class to a table, a detail page and forms | CRUD in minutes | Beginner | 10 min |
| Let people sign in and stay signed in | Sign in with a session cookie | Beginner | 20 min |
| Give users roles that decide what they may do | A role-based app | Intermediate | 30 min |
| Add pages and routes that only admins can use | Add an admin area | Intermediate | 20 min |
| Accept files with progress and shared size and type rules | Upload files | Beginner | 15 min |
| Show long lists one page at a time | Page through long lists | Beginner | 15 min |
| Update results while someone types | Search as you type | Beginner | 10 min |
| Push changes from the server to open pages | Stream live updates | Intermediate | 15 min |
| Offer the site in several languages, with local dates and prices | A multilingual site | Intermediate | 30 min |
Build an app from them
The recipes fit together. A typical team app uses them in this order:
- CRUD in minutes for the first resource.
- Sign in with a session cookie to put it behind a login.
- A role-based app and Add an admin area when not everyone may do everything.
- Page through long lists and Search as you type once the lists grow.
- Upload files, Stream live updates and A multilingual site as the app needs them.
examples/showcase is such an app: a team board with sign-in, roles, an admin area, uploads, paged tables and two languages. Read its source next to the recipes, or see Examples.
Smaller answers
Some tasks are a few lines and live on the feature pages:
| You want to... | Where |
|---|---|
| Keep a typed value in a cookie | Typed cookies |
| Ask for consent before setting a cookie | Cookie consent |
| Warn before a session ends | When the session ends |
| Check one field on the server while someone types | Checks only the server can make |
| Show a message from a route as a toast | Toasts from the server |
| Check health from a load balancer | Health endpoint |