Ideon Logo
Ideon
GitHub

Storage and Persistence

Ideon stores application data in a primary relational database and uses the local filesystem for realtime persistence (Yjs) and file uploads.

Database

Ideon supports both SQLite and PostgreSQL, managed via Kysely query builder and migrations.

  • Development: Uses SQLite. The database file is located at storage/dev.db.
  • Production: Uses PostgreSQL. Connection is configured via individual environment variables:
    • DB_HOST
    • DB_PORT
    • DB_NAME
    • DB_USER
    • DB_PASS
    • DB_SSL (optional)

Realtime Persistence

Collaborative features (Yjs) require persistence to maintain state across server restarts.

  • Storage Engine: LevelDB (via y-leveldb).
  • Location: storage/yjs.
  • Purpose: Persists CRDT (Conflict-free Replicated Data Type) updates for project canvases.

File Uploads

Files uploaded to projects are stored in the local filesystem.

  • Location: storage/uploads/project-<projectId>/<filename>.
  • Sanitization: Filenames are sanitized to prevent directory traversal and filesystem issues.
  • Serving: Files are served securely via the /api/projects/[id]/files endpoint, which enforces project access control.

Supported File Types

The system handles various content types, including but not limited to:

  • Images (.png, .jpg, .jpeg)
  • Documents (.pdf)

Production Considerations

When deploying with Docker, the storage/ directory must be mounted as a persistent volume to ensure data retention (database, Yjs history, and uploads) across container restarts.