Supported Databases
| Database | Connection String | Recommended For |
|---|---|---|
| SQLite | sqlite:./path/to/db.db | Development, single-node |
| PostgreSQL | postgres://user:pass@host:5432/dbname | Production |
| MySQL | mysql://user:pass@host:3306/dbname | Production (alternative) |
SQLite
SQLite is the default and requires no external dependencies. Ideal for development, testing, and single-node deployments.Configuration
Environment Variable
SQLite stores everything in a single file. Make sure the directory exists and is writable by the TinyCloud process (UID
1000 in Docker).PostgreSQL
PostgreSQL is the recommended database for production deployments. It supports concurrent connections, replication, and scales well with traffic.Configuration
Environment Variable
Setup
Connection String Format
| Component | Description | Example |
|---|---|---|
user | Database username | tinycloud |
password | Database password | password |
host | Database host | localhost, db, 10.0.0.5 |
port | Database port | 5432 |
database | Database name | tinycloud |
MySQL
MySQL is supported as an alternative to PostgreSQL.Configuration
Environment Variable
Setup
Automatic Migrations
TinyCloud runs database migrations automatically when the node starts. This means:- No manual migration commands are needed
- Schema updates happen on deploy when you upgrade the node version
- The node will exit with an error if migrations fail
Migration logs appear at startup. Check them if the node fails to start after an upgrade.
Connection Pooling
TinyCloud uses connection pooling to manage database connections efficiently:- Maximum connections: 100 (default)
- Connections are shared across all concurrent requests
- Idle connections are released back to the pool
max_connections is typically 100, which you may need to increase:
Choosing a Database
- SQLite
- PostgreSQL
- MySQL
Best for: Development, testing, low-traffic single-node deployments.Advantages:
- Zero configuration
- No external dependencies
- Single file, easy to back up
- Single writer at a time
- Not suitable for multi-node deployments
- Performance degrades under high concurrency