this demo shows off how to use river with sveltekit. there are two examples:
clone the repo, then cd into sveltekit-river-demo
install deps: bun i
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
start the dev server: bun dev
test it out at: http://localhost:5173
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
create a railway account (if you don't have one) and then make a new project
create a new railway project in the dashboard, and then create the following resources:
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
install the railway cli (if you don't have it), then login https://docs.railway.com/guides/cli
link this project to a railway project: bun run link (script just calls railway link)
deploy the project to railway: bun run deploy (script just calls railway up)
generate a domain for your project to access it in the railway dashboard (under service settings)