river-sveltekit-demo Svelte Themes

River Sveltekit Demo

a demo app showing a durable stream and a basic custom stream with river

SvelteKit River Demo

this demo shows off how to use river with sveltekit. there are two examples:

  • question asker: fully resumable ai sdk agent with a tool call
  • character classifier: a basic example of a custom stream

this project uses:

run this locally:

  1. clone the repo, then cd into sveltekit-river-demo

  2. install deps: bun i

  3. create a .env.local file and add the following env vars:

# railway and upstash are both great providers, or you can run it locally
REDIS_URL=redis://...

# get one from the openrouter dashboard
OPENROUTER_API_KEY=

# the password to protect your app
SECRET_APP_PASSWORD=my_very_secure_password
  1. start the dev server: bun dev

  2. test it out at: http://localhost:5173

deploy to railway:

used railway as the deployment example here because you can also setup a redis instance with private networking right next to it which is really convenient and it's stupid fast

  1. create a railway account (if you don't have one) and then make a new project

  2. create a new railway project in the dashboard, and then create the following resources:

    • a redis instance
    • an empty service
  3. add your env vars to the empty service you just created. make sure to use the private redis url for your redis url, the rest can just be what you have locally

  4. install the railway cli (if you don't have it), then login https://docs.railway.com/guides/cli

  5. link this project to a railway project: bun run link (script just calls railway link)

  6. deploy the project to railway: bun run deploy (script just calls railway up)

  7. generate a domain for your project to access it in the railway dashboard (under service settings)

Top categories

Loading Svelte Themes