Storage Without a Database Server
Most projects reach for Postgres on day one - and take on a server to run, secure and back up. Often you don't need to. larzdb gives you crash-safe, single-file storage with zero setup.
Reaching for a database server like Postgres on day one is a common reflex - and often overkill for a new app, a tool, or a prototype. It's a whole service to run, secure, back up and pay for. The stack's larzdb offers an alternative: a crash-safe database in a single file, with zero setup and zero dependencies, that's genuinely enough for a lot of real work.
A whole database in one file
larzdb is a log-structured, crash-safe embedded database - your whole dataset lives in one file, and it survives interrupted writes.
| Feature | What it gives you |
|---|---|
| Single-file, embedded | No server to run, secure or back up |
| Crash-safe (CRC + fsync) | Interrupted writes can't corrupt your data |
| JSON document collections | Store and query objects, not just rows |
| Indexes + transactions | Fast lookups and all-or-nothing changes |
It's log-structured with CRC-checked frames and fsync-on-commit, so a power loss mid-write drops the torn tail on replay rather than corrupting the database - real durability in a file.
Use it like a database
You get key-value storage and JSON document collections with a Mongo-style query language - enough for most app data.
from larzdb import Database
db = Database('app.db')
users = db.collection('users')
users.insert({'email': 'ada@x.com', 'plan': 'pro'})
users.find({'plan': 'pro'}) # query by fields
with db.transaction(): # atomic
users.update({'email':'ada@x.com'}, {'plan':'free'})When to use it
- Prototypes & tools - a real DB with zero setup.
- Small-to-medium apps - crash-safe, indexed, transactional.
- JSON documents - store objects with a query language.
- Graduate later - move to a server via larzsql when you outgrow it.
๐งฉ Do it with LarzOS
Turn this lesson into action with the exact free tools and AI workflows for the job:
๐ฏ Key takeaways
- You often don't need a database server on day one - larzdb is a crash-safe DB in a single file.
- It's log-structured with CRC + fsync, so interrupted writes drop the torn tail instead of corrupting data.
- You get key-value storage plus JSON document collections with queries, indexes and transactions.
- Great for prototypes/tools/small-medium apps; graduate to a server via larzsql when you truly outgrow it.
Frequently asked
Is a single-file database really safe for real data?
For a lot of real use, yes. larzdb is specifically engineered for durability: it's log-structured, checksums every frame with CRC, and fsyncs on commit, so if the process or power dies mid-write, the incomplete tail is detected and dropped on the next open rather than corrupting your data - it's tested against exactly these crash scenarios. That makes it genuinely appropriate for prototypes, background tools, and small-to-medium applications. Its limits are concurrency and scale: for many simultaneous writers or very large datasets you'd move to a database server. But 'single file' doesn't mean 'unsafe' - it means simple, and larzdb takes durability seriously.
When should I use larzdb versus a real database server?
Use larzdb when simplicity wins: prototypes, personal tools, single-server apps, and small-to-medium workloads where you'd rather not run, secure and back up a separate database service. Move to a database server (Postgres, etc.) when you genuinely hit its limits - high write concurrency from many processes, very large datasets, or a need for features a server provides. The good news is the transition isn't a rewrite: you build queries with larzsql and manage schema with larzmigrate (the next sessions), which work against real DB-API databases too, so your data layer stays familiar. Start simple, and upgrade only when the need is real, not hypothetical.
Related lessons
Injection-Safe Queries with larzsql
SQL injection is one of the oldest and most damaging bugs - and it's still everywhere. larโฆ
Data & Storage with the Larz StackEvolving Your Schema with Migrations
Data outlives code, and its shape changes over time. Migrations let you evolve your databaโฆ
Building with the Larz StackData & Storage โ Persisting Without a Server
Most apps don't need a database server on day one. This family gives you crash-safe storagโฆ