Skip to content

ashfromsky/yaradb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

94 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
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

# 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

# Crash? No problem.
# WAL recovery restores everything

✨ Write-Ahead Logging (WAL)
✨ Automatic crash recovery
✨ SHA-256 integrity checks

🎯 Developer Experience

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

✨ RESTful API + OpenAPI docs
✨ Zero configuration
✨ Native Python client

πŸ”§ Smart Flexibility

# 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:

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

Windows (PowerShell):

docker pull ashfromsky/yaradb:latest
docker run -d `
  --name yaradb_server `
  -p 8000:8000 `
  -v ${PWD}/data:/data `
  ashfromsky/yaradb:latest

Windows (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

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

Easy β€’ One command deploy

🐍 From Source

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

Development β€’ Full control

Verify it's running:

curl http://localhost:8000/ping
# {"status":"alive"} βœ…

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



πŸ’» Usage Examples

🌐 REST API

# 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"
    }
  }'
# Get by ID
curl http://localhost:8000/document/get/{doc_id}
# Update with version control
curl -X PUT http://localhost:8000/document/update/{doc_id} \
  -d '{"version": 1, "body": {"name": "Alice Smith"}}'
# Soft delete
curl -X PUT http://localhost:8000/document/archive/{doc_id}

🐍 Python Client

Install:

pip install yaradb-client

Use:

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

Full guides, tutorials, and best practices

πŸ”Œ API Reference

REST endpoints, schemas, and examples

πŸ—οΈ Architecture Deep Dive

WAL internals, OCC, and design decisions

🌟 Alternative Resources

Notion Docs Python Client Repo 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 β†’

πŸ’‘ Request Features

Have an idea?
Share It β†’

πŸ“ Improve Docs

Make it clearer
Edit on GitHub β†’

πŸ”§ Submit Code

Fork β€’ Code β€’ PR
Guidelines β†’



πŸ“œ License & Legal

Server Side Public License (SSPL)
Β© 2025 Tymofii Shchur Viktorovych

Read Full 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


⭐ Star us on GitHub if YaraDB powers your project! ⭐



✨ ✨ ✨

About

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

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors