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.
- Host: GitHub
- URL: https://github.com/ashfromsky/yaradb
- Owner: ashfromsky
- License: other
- Created: 2025-10-29T12:27:19.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-11-28T10:35:06.000Z (7 months ago)
- Last Synced: 2026-03-12T07:34:25.446Z (3 months ago)
- Topics: database, db, json, nosql, nosql-database, python
- Language: Python
- Homepage:
- Size: 159 KB
- Stars: 33
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README

YaraDB
๐ Lightning-fast โข ๐ก๏ธ Crash-safe โข ๐ฏ Developer-friendly
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
[](https://www.notion.so/YaraDB-Complete-Documentation-29ed5746db8c80fca39defa67e9d8ef4)
[](https://github.com/illusiOxd/yaradb-client-py)
[](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
---