Choosing the Right Database for Your Self-Hosted App
PostgreSQL, MySQL, SQLite, MongoDB, Redis — when to use what. A practical guide to database choices for self-hosted applications.
databasepostgresqlmysqlsqliteguide
The Major Options
PostgreSQL
The most advanced open-source relational database.
Use when: You need advanced features (JSON, full-text search, GIS)
Resource: 512 MB+ RAM
Self-hosted apps that use it: Nextcloud, Gitea, Outline, Supabase
MySQL/MariaDB
The most popular open-source relational database.
Use when: The app requires MySQL, or you're familiar with it
Resource: 512 MB+ RAM
Self-hosted apps: WordPress, Kimai, Matomo
SQLite
Embedded database in a single file.
Use when: Simplicity matters, single-user, low traffic
Resource: 0 (embedded)
Self-hosted apps: Vaultwarden, PocketBase, Memos, many more
MongoDB
Document database (NoSQL).
Use when: The app requires MongoDB
Resource: 1 GB+ RAM
Self-hosted apps: Rocket.Chat, Wekan
Redis
In-memory key-value store.
Use when: Caching, sessions, queues
Resource: 128 MB+ RAM
Used alongside: Nextcloud, Authentik, Chatwoot
Decision Framework
Start with SQLite If
Single user or small team
Low to moderate traffic
Want simplest backup (copy one file)
App supports it
Upgrade to PostgreSQL If
Multiple concurrent users
Need advanced queries
Want replication
Performance at scale matters
Use Shared Databases
Run one PostgreSQL instance for multiple apps. Most self-hosted apps can share a database server — each gets its own database within the same instance.
Backup Strategy
SQLite: Copy the file (stop app first, or use .backup)
PostgreSQL: pg_dump or pg_basebackup
MySQL: mysqldump
Redis: RDB snapshots or AOF
The right database is usually the simplest one that meets your needs. For most self-hosted apps on small servers, SQLite is underrated.