๐Ÿ’Ž

Rails 8 + SQLite โ€” Why It Works in Production

The era of no PostgreSQL has arrived โ€” SQLite in production proven by 37signals

Starting with Rails 8, SQLite is officially recommended as a production database. The perception that "SQLite is for development only" is now outdated.

Why SQLite Now?

The Solid series introduced in Rails 8 (Solid Queue, Solid Cache, Solid Cable) is the game changer. Previously you needed Redis (cache, job queue) and PostgreSQL (DB) separately, but now one SQLite handles DB + cache + job queue + WebSocket entirely.

37signals (makers of Basecamp, HEY) uses this setup in actual production. DHH (Rails creator) himself said "PostgreSQL is overkill for most web apps."

Why SQLite Works in Production

  1. Serverless โ€” runs as a single file with no separate process/port. No DB server management
  2. WAL mode โ€” Write-Ahead Logging dramatically improves read/write concurrency
  3. Solid series โ€” cache, jobs, cable all handled by SQLite without Redis/Memcached
  4. Simplified deployment โ€” no DB server config, connection pool management, or migration ordering worries
  5. Cost reduction โ€” zero managed DB costs (RDS/CloudSQL)
  6. Easy backup โ€” one file copy = complete backup

When PostgreSQL Is Still Needed

  • Very high concurrent writes (thousands of INSERTs per second)

  • Multiple servers accessing the same DB (SQLite is single-server)

  • PostgreSQL-specific features needed (jsonb, Full Text Search, PostGIS)

  • Large teams with existing PostgreSQL infrastructure

For most small-to-medium apps, solo/small team projects, SaaS MVPs, and side projects, SQLite is sufficient.

Rails 8 Solid Series โ€” All SQLite, No Redis/PostgreSQL

Feature Before (Rails 7) Now (Rails 8)
Database PostgreSQL / MySQL SQLite (WAL mode)
Background Jobs Sidekiq + Redis Solid Queue (SQLite)
Cache Redis / Memcached Solid Cache (SQLite)
WebSocket Action Cable + Redis Solid Cable (SQLite)
External Services PostgreSQL + Redis (min 2) None (files only)

Choose SQLite

  • ✓ Solo or small team
  • ✓ SaaS MVP, side projects
  • ✓ Minimize infrastructure costs
  • ✓ Read-heavy apps
  • ✓ Single server sufficient

Choose PostgreSQL

  • ✓ Thousands of concurrent writes/sec
  • ✓ Multi-server setup needed
  • ✓ jsonb, PostGIS, FTS needed
  • ✓ Existing PostgreSQL infrastructure
  • ✓ Horizontal scaling plans

Key Points

1

Rails 8 projects use SQLite by default (no extra setup needed)

2

Verify WAL mode enabled in config/database.yml (Rails 8 default)

3

Enable Solid Queue (jobs), Solid Cache (cache), Solid Cable (WebSocket)

4

Deploy with Kamal or Fly.io โ€” no DB server setup at all

5

Use json type instead of jsonb (SQLite doesn't support jsonb)

Pros

  • Zero infrastructure โ€” no DB server, Redis, or Memcached needed
  • Simplified deployment โ€” DB migration by simple file copy
  • Zero RDS/CloudSQL costs โ€” saves tens of dollars monthly
  • Minimal latency โ€” direct disk access with no network hop
  • Production-proven by 37signals

Cons

  • Single server only โ€” no multi-server concurrent access
  • Write contention โ€” performance may degrade with heavy INSERTs
  • No PostgreSQL-specific features (jsonb, PostGIS, Full Text Search)
  • No horizontal scaling โ€” only vertical scaling for traffic spikes

Use Cases

Solo/small team SaaS MVP Side projects, personal blogs, portfolios Startups wanting to minimize infrastructure costs Read-heavy apps (blogs, docs, catalogs, etc.)