DEV Community

Alex Spinov
Alex Spinov

Posted on

SQLite Is Probably Enough for Your Side Project

Stop Over-Engineering Your Database

For 99% of side projects, SQLite is enough. Zero setup. Single file. Full SQL.

Python (Built-in)

import sqlite3
db = sqlite3.connect("app.db")
db.execute("CREATE TABLE IF NOT EXISTS items (id INTEGER PRIMARY KEY, name TEXT, data JSON)")
db.execute("INSERT INTO items (name, data) VALUES (?, ?)", ("test", "{}"))
db.commit()
for row in db.execute("SELECT * FROM items"): print(row)
Enter fullscreen mode Exit fullscreen mode

JSON + Full-Text Search

-- JSON support
SELECT json_extract(data, $.type) FROM events;

-- Full-text search
CREATE VIRTUAL TABLE docs_fts USING fts5(title, content);
SELECT * FROM docs_fts WHERE docs_fts MATCH python;
Enter fullscreen mode Exit fullscreen mode

When You Actually Need Postgres

  • Multiple servers writing simultaneously
  • Need PostGIS or advanced extensions
  • Millions of concurrent writes/second

Everything else: SQLite is enough.

What database do YOU use for side projects?


More


More from me: 10 Dev Tools I Use Daily | 77 Scrapers on a Schedule | 150+ Free APIs

Top comments (0)