explaingit

litedb-org/litedb

9,392C#Audience · developerComplexity · 2/5LicenseSetup · easy

TLDR

LiteDB is a tiny embedded NoSQL document database for .NET apps that stores everything in a single file, no server needed, with a MongoDB-like API, full transactions, encryption, and concurrent read support.

Mindmap

mindmap
  root((litedb))
    What it does
      Embedded document database
      Single file storage
      No server needed
    Key features
      MongoDB-like API
      LINQ and SQL queries
      Full transactions
      AES encryption
    Tech
      C# and .NET
      BSON documents
      NuGet package
    Use cases
      Desktop apps
      Small web APIs
      Per-user data files
    Audience
      .NET developers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a local document database to a .NET desktop app without running or deploying a database server.

USE CASE 2

Store per-user data in a single encrypted file for a multi-account desktop application.

USE CASE 3

Build a small .NET web API that persists data locally without a cloud database dependency.

USE CASE 4

Browse and query existing LiteDB files without writing code using the LiteDB Studio visual tool.

Tech stack

C#.NETNuGetBSONLINQ

Getting it running

Difficulty · easy Time to first run · 5min
MIT license, use freely in any project, commercial or open-source, just keep the copyright notice.

In plain English

LiteDB is an embedded database for .NET applications, meaning it runs inside your application without needing a separate database server. All data is stored in a single file on disk, similar to how SQLite works for relational data, but LiteDB stores documents rather than tables. It is free and open-source under the MIT license, and the compiled library weighs less than 450 kilobytes. The API is intentionally similar to MongoDB. You define your data as plain C# classes, and LiteDB handles serializing them into a document format called BSON and back again. You can query documents using LINQ, which is a standard C# query syntax, or using SQL-like commands if you prefer. Version 5 introduced a new storage engine that allows multiple readers at the same time and write locks that only block at the collection level rather than the whole database, which improves performance for concurrent access. LiteDB supports full transactions, meaning a write operation either completes fully or is rolled back, and it writes a log file to recover data after an unexpected crash. Optionally, the database file can be encrypted using AES. There is also support for storing binary files and streams in the database directly, similar to how MongoDB handles large file storage. The README suggests LiteDB is best suited for desktop applications, small web applications, and cases where you want one database file per user or account. There is a separate graphical tool called LiteDB Studio for browsing and querying the database without writing code. The library is available as a NuGet package with a straightforward install command.

Copy-paste prompts

Prompt 1
I'm building a C# desktop app and want to store user settings and history in LiteDB. Show me how to define a model class, open a database file, insert documents, and query them with LINQ.
Prompt 2
How do I enable AES encryption on a LiteDB database file in .NET, walk me through the connection string or API options.
Prompt 3
Set up LiteDB in a .NET 8 web API project: install the NuGet package, create a singleton database instance, and expose a GET endpoint that queries a collection.
Prompt 4
Explain LiteDB's transaction and crash-recovery model, how does the write-ahead log work, and what happens if my app crashes mid-write?
Prompt 5
I'm switching from SQLite to LiteDB for a .NET project. Show me the equivalent of a SQL INSERT, SELECT with a WHERE clause, and a JOIN using LiteDB's document model and LINQ.
Open on GitHub → Explain another repo

← litedb-org on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.