Databases
Run Redis or Postgres on the phone, next to your apps. Your apps get the connection URL by themselves.
Make one
On the phone, tap Templates at the bottom, or open Templates in the dashboard. Pick Redis or Postgres, tick the apps that need it and tap Create. Or from your computer:
$ dukoi db create redis --app my-api Starting Redis on pixel-10a…
✓ redis is running on port 6380
my-api got REDIS_URL and restarted.Your app reads process.env.REDIS_URL, or process.env.DATABASE_URL for Postgres. Use a JavaScript client, like redis or ioredis, and pg or postgres.
import { createClient } from 'redis'
const redis = createClient({ url: process.env.REDIS_URL })
await redis.connect()
await redis.incr('visits')What runs
- Redis is Valkey 9.1, the open-source Redis. Every Redis client and command works. It uses about 10 MB of memory to start.
- Postgres is PGlite, real Postgres 18 that runs on the phone’s Node. Several connections work, and queries run one at a time, so it suits small apps. It uses about 400 MB of memory, so check your phone has room.
Data is saved on the phone, so it survives restarts, reboots and deploys.
Connect and disconnect apps
$ dukoi db connect redis worker ✓ worker got REDIS_URL and restartedConnecting sets the app’s REDIS_URL or DATABASE_URL setting and restarts it once. dukoi db disconnect redis worker takes it away. Several apps can share one database.
Use it from your computer
A database is for the phone’s apps until you turn on Wi-Fi access. Then devices on your Wi-Fi can connect, with the same password:
$ dukoi db wifi postgres ✓ postgres is reachable on your Wi-Fi
URL: dukoi db url postgres --wifi$ psql "$(dukoi db url postgres --wifi)" On the phone and in the dashboard, it’s the Also reachable on Wi-Fi box on the database’s page. Databases never get a public link.
Passwords
Every database has its own password, already in its URL. Dukoi shows URLs with the password hidden. dukoi db url redis and the copy buttons give you the full one.
dukoi db password redis makes a new one. Connected apps get the new URL and restart, and the old password stops working at once.
Everything else
dukoi dblists your databases.dukoi db logs redisshows a database’s log.dukoi db stop,startandrestartwork like they do for apps.dukoi db remove redisdeletes the database and its data, and takes its URL from your apps. It asks first.