Skip to content

Database Configuration

Deckyard supports multiple storage backends for your data.

By default, Deckyard uses JSON file-based storage. No additional configuration required.

Data locations:

  • Presentations: server/data/presentations/
  • Uploads: server/uploads/

This is ideal for:

  • Local development
  • Single-instance deployments
  • Simple self-hosted setups

For production deployments, PostgreSQL is recommended. It provides:

  • Better performance at scale
  • Multi-instance support
  • Reliable data persistence
  • Full-text search capabilities

Set the storage mode in your environment:

Terminal window
STORAGE_MODE=postgres

Using individual variables (recommended):

Terminal window
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=deckyard
DATABASE_USER=deckyard
DATABASE_PASSWORD=your-secure-password

Using connection URL:

Terminal window
DATABASE_URL=postgres://deckyard:password@localhost:5432/deckyard

SSL is enabled by default for non-localhost connections.

Terminal window
# Disable SSL (e.g., for local Docker networks)
DATABASE_SSL=false
# Allow self-signed certificates (e.g., managed database services)
DATABASE_SSL_REJECT_UNAUTHORIZED=false

Configure the connection pool size:

Terminal window
DATABASE_POOL_MIN=2 # Minimum connections (default: 2)
DATABASE_POOL_MAX=10 # Maximum connections (default: 10)

Deckyard uses Kysely for database migrations.

Migrations run automatically on server startup when using PostgreSQL mode. You can also run them manually:

Terminal window
npm run db:migrate

Check which migrations have been applied:

Terminal window
npm run db:migrate:status

For development, create a new migration:

Terminal window
npm run db:migrate:create migration-name

If you’re upgrading from file-based storage to PostgreSQL:

Create the database and run migrations:

Terminal window
STORAGE_MODE=postgres npm run db:migrate

Run the migration script:

Terminal window
npm run db:migrate:data

This migrates:

  • All presentations and their slides
  • Tags and metadata
  • Image library entries
  • Published presentation data

The script reports what was migrated. Verify your presentations are accessible before removing file-based data.

For safe migration, you can enable dual-write mode:

Terminal window
# Write to both, read from file, compare results
DUAL_WRITE_MODE=shadow
# Write to both, read from file
DUAL_WRITE_MODE=primary-file
# Write to both, read from PostgreSQL
DUAL_WRITE_MODE=primary-postgres

This allows you to validate PostgreSQL behavior before fully switching.

VariableDefaultDescription
STORAGE_MODEfileStorage backend: file or postgres
DATABASE_HOSTlocalhostPostgreSQL host
DATABASE_PORT5432PostgreSQL port
DATABASE_NAMEdeckyardDatabase name
DATABASE_USERdeckyardDatabase user
DATABASE_PASSWORD(empty)Database password
DATABASE_SSLtrue (non-localhost)Enable SSL
DATABASE_SSL_REJECT_UNAUTHORIZEDtrueReject self-signed certs
DATABASE_POOL_MIN2Minimum pool connections
DATABASE_POOL_MAX10Maximum pool connections
DUAL_WRITE_MODEoffMigration dual-write mode