FIM One supports two database backends: SQLite (default, zero-config) and PostgreSQL (recommended for production). The backend is determined by theDocumentation Index
Fetch the complete documentation index at: https://docs.fim.ai/llms.txt
Use this file to discover all available pages before exploring further.
DATABASE_URL environment variable.
SQLite vs PostgreSQL
| SQLite | PostgreSQL | |
|---|---|---|
| Setup | Zero-config, file-based | Requires a separate server |
| Concurrency | Single-writer (global lock) | Full MVCC, row-level locking |
| Multi-worker | Not supported (WORKERS must be 1) | Fully supported |
| SSE streaming | Connections held during streams may block other requests | Concurrent reads and writes are unaffected |
| Backup | Copy the .db file | pg_dump or streaming replication |
| Best for | Development, single-user, demos | Production, multi-user, teams |
Known Limitation: SQLite Concurrent Streaming
Connection Pool Configuration
FIM One configures SQLAlchemy connection pool settings internally for each backend. These are tuned defaults that do not require environment variables — they are applied automatically based on theDATABASE_URL scheme. Understanding them helps explain runtime behavior.
SQLite Pool Settings
| Setting | Value | Description |
|---|---|---|
pool_size | 20 | Base number of persistent connections in the pool |
max_overflow | 10 | Additional connections created under load (up to 30 total) |
| WAL journal mode | Enabled | Write-Ahead Logging allows concurrent reads while a write is in progress, significantly reducing lock contention |
busy_timeout | 30s | When the write lock is held, other writers wait up to 30 seconds before raising an error, instead of failing immediately |
synchronous | NORMAL | Safe with WAL mode; provides better write throughput than the default FULL |
PostgreSQL Pool Settings
| Setting | Value | Description |
|---|---|---|
pool_size | 10 | Base number of persistent connections in the pool |
max_overflow | 20 | Additional connections created under load (up to 30 total) |
pool_timeout | 30s | Maximum time to wait for a free connection from the pool before raising a timeout error |
pool_recycle | 1800s | Connections are recycled every 30 minutes to prevent stale connections (important for cloud-hosted databases that close idle connections) |
Switching to PostgreSQL
Step 1: Start a PostgreSQL Instance
The quickest way is with Docker:Step 2: Set the DATABASE_URL
Add or update the following line in your.env file:
Step 3: Restart FIM One
Existing SQLite data is not migrated automatically. Switching
DATABASE_URL from SQLite to PostgreSQL starts with a fresh database. If you have existing conversations, agents, or connectors in SQLite that you need to preserve, see the Data Migration section below.Docker Compose (Recommended for Production)
If you deploy with Docker Compose, PostgreSQL and Redis are already included and auto-configured — there is nothing extra to set up. Thedocker-compose.yml sets DATABASE_URL internally — your .env value is overridden:
Data Migration
There is no built-in migration tool from SQLite to PostgreSQL. For most deployments, the recommended approach depends on your situation: Fresh deployment (no existing data): Simply setDATABASE_URL to your PostgreSQL connection string and start FIM One. All tables are created automatically.
Existing data that must be preserved: Manual export/import is required. The general approach:
- Export data from SQLite using a tool like
sqlite3CLI or a Python script - Transform the data as needed (SQLite and PostgreSQL have minor type differences)
- Import into PostgreSQL using
psql,pg_restore, or application-level insert scripts