Getting Started
Set up mdxdb for your project
Getting Started with mdxdb
This guide walks you through setting up mdxdb for your project.
Choose an Adapter
First, decide which storage backend fits your needs:
| Adapter | Best For |
|---|---|
@mdxdb/fs | Local development, static sites, Git-based workflows |
@mdxdb/sqlite | Embedded applications, edge computing, serverless |
@mdxdb/clickhouse | Analytics, time-series data, large datasets |
Installation
Each adapter is a standalone package. Install the one you need:
The mdxdb root package is the schema-first DB() facade that picks an
adapter from DATABASE_URL. Install it too if you want typed entities and
relationships instead of the document-level API shown below:
Basic Setup
File System
SQLite
ClickHouse
CRUD Operations
Create
Read
Update
Delete
Listing Documents
Searching
Organizing Content
By Type
By Date
TypeScript Types
Every adapter exports the shared Database interface and its option/result types:
Error Handling
get() resolves to null for a missing document; it does not throw. Writes
that violate an option (for example set() on an existing path without
overwrite) reject with a plain Error:
The schema-first DB() facade in mdxdb also returns null from get(),
and throws typed errors from writes:
Next Steps
- Adapters - Detailed adapter documentation
- Fumadocs Integration - Use with Fumadocs