An open API service indexing awesome lists of open source software.

https://github.com/ashfromsky/yaradb

In-memory-first document DB (Python/FastAPI) with JSON persistence and a "smart" data model.
https://github.com/ashfromsky/yaradb

database db json nosql nosql-database python

Last synced: about 1 month ago
JSON representation

In-memory-first document DB (Python/FastAPI) with JSON persistence and a "smart" data model.

Awesome Lists containing this project

README

          

YaraDB Banner


๐Ÿ“ฆ
YaraDB

๐Ÿš€ Lightning-fast โ€ข ๐Ÿ›ก๏ธ Crash-safe โ€ข ๐ŸŽฏ Developer-friendly



Docker Pulls


Python


License


CI/CD


Quick Start โ€ข
Documentation โ€ข
Docker Hub โ€ข
Python Client


---

## ๐Ÿ’Ž What Makes YaraDB Special?

### โšก **Blazing Performance**

```python
# O(1) lookups - Always fast
doc = client.get(doc_id)
# Sub-millisecond response time
```

โœจ **In-memory operations**
โœจ **Hash-based indexing**
โœจ **Zero query overhead**

### ๐Ÿ›ก๏ธ **Enterprise Reliability**

```python
# Crash? No problem.
# WAL recovery restores everything
```

โœจ **Write-Ahead Logging (WAL)**
โœจ **Automatic crash recovery**
โœจ **SHA-256 integrity checks**

### ๐ŸŽฏ **Developer Experience**

```python
# One line to start
docker run -p 8000:8000 ashfromsky/yaradb
```

โœจ **RESTful API + OpenAPI docs**
โœจ **Zero configuration**
โœจ **Native Python client**

### ๐Ÿ”ง **Smart Flexibility**

```python
# Free mode or strict schemas
# Your choice, your rules
```

โœจ **Schema-free OR JSON Schema**
โœจ **Optimistic locking (OCC)**
โœจ **Soft deletes built-in**


---

## ๐Ÿš€ Get Started in 30 Seconds

### ๐Ÿณ Docker

**Linux / macOS:**
```bash
docker pull ashfromsky/yaradb:latest
docker run -d \
--name yaradb_server \
-p 8000:8000 \
-v $(pwd)/data:/data \
ashfromsky/yaradb:latest
```

**Windows (PowerShell):**
```powershell
docker pull ashfromsky/yaradb:latest
docker run -d `
--name yaradb_server `
-p 8000:8000 `
-v ${PWD}/data:/data `
ashfromsky/yaradb:latest
```

**Windows (CMD):**
```cmd
docker pull ashfromsky/yaradb:latest
docker run -d ^
--name yaradb_server ^
-p 8000:8000 ^
-v %cd%/data:/data ^
ashfromsky/yaradb:latest
```

**Recommended** โ€ข Production-ready

### ๐Ÿ“ฆ Docker Compose

```yaml
services:
yaradb:
image: ashfromsky/yaradb
ports: ["8000:8000"]
volumes: ["./data:/data"]
```

**Easy** โ€ข One command deploy

### ๐Ÿ From Source

```bash
git clone https://github.com/illusiOxd/yaradb
cd yaradb
pip install -r requirements.txt
python main.py
```

**Development** โ€ข Full control

**Verify it's running:**

```bash
curl http://localhost:8000/ping
# {"status":"alive"} โœ…
```

**Explore the API:**
๐Ÿ‘‰ **http://localhost:8000/docs** ๐Ÿ‘ˆ


---

## ๐Ÿ’ป Usage Examples

### ๐ŸŒ REST API

```bash
# Create a document
curl -X POST http://localhost:8000/document/create \
-H "Content-Type: application/json" \
-d '{
"table_name": "users",
"body": {
"name": "Alice",
"email": "alice@example.com",
"role": "admin"
}
}'
```

```bash
# Get by ID
curl http://localhost:8000/document/get/{doc_id}
```

```bash
# Update with version control
curl -X PUT http://localhost:8000/document/update/{doc_id} \
-d '{"version": 1, "body": {"name": "Alice Smith"}}'
```

```bash
# Soft delete
curl -X PUT http://localhost:8000/document/archive/{doc_id}
```

### ๐Ÿ Python Client

**Install:**
```bash
pip install yaradb-client
```

**Use:**
```python
from yaradb_client import YaraClient

client = YaraClient("http://localhost:8000")

# Create
doc = client.create(
table_name="users",
body={
"name": "Alice",
"email": "alice@example.com",
"level": 5
}
)

# Read
user = client.get(doc["_id"])

# Update (with optimistic locking)
updated = client.update(
doc_id=doc["_id"],
version=doc["version"],
body={"name": "Alice", "level": 6}
)

# Search
results = client.find({"level": 6})

# Archive (soft delete)
client.archive(doc["_id"])
```


---

## ๐Ÿ—๏ธ How It Works

```
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ๐ŸŒ FastAPI REST API โ•‘
โ•‘ (OpenAPI โ€ข JSON โ€ข HTTP/2) โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โ”‚
โ–ผ
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ๐Ÿ’พ In-Memory Hash Index โ•‘
โ•‘ { UUID โ†’ Document } - O(1) Lookup โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ–ผ โ–ผ
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•— โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ๐Ÿ“ WAL Engine โ•‘ โ•‘ ๐Ÿ” OCC Locking โ•‘
โ•‘ Append-Only Log โ•‘ โ•‘ Version Control โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โ”‚
โ–ผ
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ๐Ÿ’ฟ JSON Storage โ•‘
โ•‘ Periodic Snapshot โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
```

### ๐ŸŽฏ **Write Path**

1. Validate request
2. Append to WAL
3. Update memory
4. Return success

~2ms latency

### ๐Ÿ“– **Read Path**

1. Hash lookup
2. Return from RAM
3. Done!

<1ms latency

### ๐Ÿ”„ **Crash Recovery**

1. Load snapshot
2. Replay WAL
3. Rebuild index
4. Ready!

Automatic on startup

### ๐Ÿ’พ **Checkpoints**

1. Serialize state
2. Write snapshot
3. Truncate WAL
4. Continue

Background process


---

## ๐ŸŽฏ Perfect For

๐Ÿ› ๏ธ

### Prototyping

Spin up a database in seconds. No complex setup, no configuration files.

โšก

### Real-Time Apps

WebSockets, live dashboards, gaming leaderboards - anywhere speed matters.

๐Ÿ“ฆ

### Microservices

Lightweight data layer for containerized architectures.

๐Ÿงช

### Testing

Fast, ephemeral test databases. Create, test, destroy.

๐ŸŒ

### Edge Computing

Low footprint, works anywhere Docker runs.


---

## ๐Ÿ“š Learn More

### ๐Ÿ“– [Complete Documentation](https://github.com/illusiOxd/yaradb/wiki)

Full guides, tutorials, and best practices

### ๐Ÿ”Œ [API Reference](https://github.com/illusiOxd/yaradb/wiki/API-Reference)

REST endpoints, schemas, and examples

### ๐Ÿ—๏ธ [Architecture Deep Dive](https://github.com/illusiOxd/yaradb/wiki/Architecture)

WAL internals, OCC, and design decisions

### ๐ŸŒŸ Alternative Resources

[![Notion Docs](https://img.shields.io/badge/Notion-Docs-000000?style=for-the-badge&logo=notion&logoColor=white)](https://www.notion.so/YaraDB-Complete-Documentation-29ed5746db8c80fca39defa67e9d8ef4)
[![Python Client Repo](https://img.shields.io/badge/GitHub-Python_Client-181717?style=for-the-badge&logo=github)](https://github.com/illusiOxd/yaradb-client-py)
[![Discussions](https://img.shields.io/badge/GitHub-Discussions-181717?style=for-the-badge&logo=github)](https://github.com/illusiOxd/yaradb/discussions)


---

## ๐Ÿค Contributing

**We โค๏ธ contributions from the community!**

Whether you're fixing bugs, adding features, improving docs, or sharing ideas โ€” you're welcome here.

### ๐Ÿ› Report Bugs

Found an issue?
[Open an Issue โ†’](https://github.com/illusiOxd/yaradb/issues/new?template=bug_report.md)

### ๐Ÿ’ก Request Features

Have an idea?
[Share It โ†’](https://github.com/illusiOxd/yaradb/issues/new?template=feature_request.md)

### ๐Ÿ“ Improve Docs

Make it clearer
[Edit on GitHub โ†’](https://github.com/illusiOxd/yaradb/wiki)

### ๐Ÿ”ง Submit Code

Fork โ€ข Code โ€ข PR
[Guidelines โ†’](.github/CONTRIBUTING.md)

**Read our** [Code of Conduct](.github/CODE_OF_CONDUCT.md) โ€ข [Contributing Guide](.github/CONTRIBUTING.md)


---

## ๐Ÿ“œ License & Legal

**Server Side Public License (SSPL)**
ยฉ 2025 Tymofii Shchur Viktorovych

[Read Full License โ†’](LICENSE)

Free for development and internal use โ€ข Contact for commercial SaaS deployment

---

## ๐Ÿ”— Connect With Us


GitHub


Docker Hub


PyPI


Discussions



โค๏ธ **Built with passion by** [**illusiOxd**](https://github.com/illusiOxd)


โญ **Star us on GitHub if YaraDB powers your project!** โญ



โœจ
โœจ
โœจ