Storyden

Database

Configure database storage for your Storyden deployment.

Storyden supports multiple database backends, from lightweight embedded SQLite to distributed PostgreSQL-compatible systems. Each option offers different trade-offs between simplicity, performance, and operational requirements.

Configuration

Database configuration is controlled via the DATABASE_URL environment variable. The URL scheme determines which database driver Storyden uses.

Database Options

The comparison table below summarizes the key differences:

FeatureSQLitePostgreSQLTurso
InfrastructureNone requiredSeparate serviceManaged service
Setup complexityNoneMediumLow
Write scalabilitySingle writerHighHigh
Read scalabilityExcellentExcellentGlobal edge replicas
Multi-instanceWith LitestreamYesYes
Disk usageLocal fileSeparate volumeManaged
BackupsFile copypg_dump/WALAutomatic

Schema Management

Storyden handles database schema migrations automatically. On startup, the application compares the current schema against the expected schema and applies any necessary migrations. This means you never need to run manual migration commands.

The migration system is transactional and safe. If a migration fails, the database remains in its previous consistent state. Schema changes are versioned and tracked in the codebase, making it easy to understand what changed between versions.

Quick Reference

Environment Variables

See full configuration docs here.

VariableRequiredDefaultDescription
DATABASE_URLNosqlite://data/data.db?_pragma=foreign_keys(1)Database connection URL

Supported URL Schemes

  • sqlite:// or sqlite3:// - SQLite database (local file)
  • postgres:// or postgresql:// - PostgreSQL and CockroachDB.
  • libsql:// - Turso remote SQLite

On this page