
TychoDB - A Simple Document Database for .NET
- Michael Stonis
- Dotnet
- February 9, 2026
Table of Contents
The Problem
Have you ever wanted something like Azure Cosmos DB, but for your mobile or desktop application? That ability to just throw objects at a database without worrying about schemas, migrations, or table definitions? I certainly have. And after years of looking for a solution that fit my needs, I ended up building one.
What Is TychoDB
TychoDB is a lightweight document database for .NET that stores JSON objects using SQLite as its storage engine. At its core, it is really just a wrapper around Microsoft.Data.Sqlite that makes working with JSON data easier. The goal was to create something that feels natural to .NET developers while providing the flexibility of a document store.
Library
Source Code
The Magic of JSON1
The secret sauce behind TychoDB is SQLite’s JSON1 extension. If you are not familiar with it, JSON1 adds functions to SQLite that let you query and manipulate JSON data stored in text columns. You can extract values from JSON paths, filter based on nested properties, and even update specific parts of a JSON document without deserializing the whole thing.
This is important because it means the database engine itself understands your data structure. When you query for all customers where their home address country equals “USA”, SQLite can actually parse that JSON path and filter efficiently. You are not pulling everything out of the database and filtering in memory. The database does the heavy lifting.
No Schema Required
One of the biggest selling points is that there are no schema definitions to manage. You register your types, and TychoDB figures out the rest. Want to add a new property to your class? Just add it. Remove one? Go for it. The JSON storage model means your data structure can evolve without migration scripts or breaking changes.
Registration is straightforward. You tell TychoDB how to identify your objects, and it handles storage and retrieval from there. You can register types with explicit ID selectors, custom key generators, or let it discover ID properties by convention.
Why Not LiteDB
For years, I was a huge fan of LiteDB. It solved the same problem I was trying to solve: a simple document database for .NET applications. But over time, I ran into issues. Development has stagnated, and I encountered odd bugs that were difficult to diagnose and work around. Some of these issues would only appear under specific conditions, making them frustrating to track down.
TychoDB was my answer to wanting something similar but built on a foundation I could trust. SQLite is battle-tested. It is used everywhere. When something goes wrong, there is a massive community and decades of documentation to help figure out what happened.
When You Need Raw Performance
I want to be upfront about something. If your primary concern is raw performance, TychoDB is probably not the right choice. Libraries like sqlite-net are built specifically for speed and will outperform TychoDB in scenarios where you need maximum throughput.
TychoDB trades some of that performance for flexibility and developer convenience. The JSON serialization and parsing add overhead compared to directly mapping to SQLite columns. For most mobile and desktop applications, this overhead is negligible. But if you are building something that needs to process thousands of records per second, you should look elsewhere.
LINQ Support
TychoDB includes comprehensive LINQ support that makes querying feel natural. You can write type-safe queries with IntelliSense and compile-time checking. Filter with Where clauses, sort with OrderBy and OrderByDescending, page results with Take, and chain multiple conditions together.
The LINQ interface translates your expressions into the appropriate SQLite queries using JSON1 functions. This means you get the familiar LINQ syntax you know from Entity Framework or LINQ to Objects, but operating against a document store.
Nested Object Queries
One feature I am particularly proud of is the ability to query nested object properties. If you have a Customer class with a HomeAddress property, you can filter customers based on their address country or city without any special configuration. The filter builder understands property paths and generates the correct JSON extraction queries.
You can also extract just the nested objects themselves. Need a list of all addresses from your customers? There is a method for that. Want the addresses paired with their parent customer IDs? That works too. This makes working with complex object graphs much more manageable.
Serialization Options
TychoDB supports multiple serialization options. You can use System.Text.Json, including the source generators for improved performance and trimmer compatibility. If you prefer Newtonsoft.Json for its flexibility and feature set, that is fully supported as well. The library is designed to be serializer-agnostic, so you can choose based on your project’s needs or extend it to a different json serializer, if desired.
Know Your Use Case
I built TychoDB for mobile and desktop applications. It is designed for scenarios where you need local data storage with flexible schemas and reasonable performance. Think offline-first apps, caching layers, or applications where the data model evolves frequently.
This is explicitly not designed for backend systems. If you are building a server application, you should be using a proper database server. TychoDB is for client-side scenarios where SQLite makes sense.
Wrapping Up
TychoDB is not for everyone. If you need maximum performance, use sqlite-net. If you are building a server application, use a real database. But if you want a flexible, easy-to-setup document database for your mobile or desktop .NET application, give it a shot.
The library handles the complexity of working with JSON in SQLite so you can focus on building your application. No schemas to manage, no migrations to run, just store your objects and query them with LINQ.
Check out the GitHub repository for full documentation, examples, and to see if it fits your needs.
Header photo from https://www.flickr.com/photos/gsfc/6505453171/in/photostream/ by NASA Goddard Photo and Video is licensed under CC BY 2.0


