Inspiration
The primary catalyst for building SynapseDB came from real-world frustrations working with MySQL in production. Every time an incoming data model shifted, we were blocked by strict column-based DDL constraints. Modifying tables required running migrations, altering schemas, and maintaining complex ETL pipelines just to accommodate routine field changes. It lacked runtime flexibility and slowed down iteration.
While document databases like MongoDB offer schema-free JSON storage, they fall short for analytical workloads: row-oriented document models are inefficient when executing aggregations like SUM, AVG, or COUNT across millions of records. Our workload strictly required a columnar engine for fast analytical performance, not a document store.
Furthermore, existing vector databases and cloud LLM integrations presented major drawbacks for structured analytical questions. Asking an external LLM to perform calculations across records leads to hallucinations, missed rows, high API costs, network latency, and data privacy risks. SynapseDB was conceived to bridge this exact divide: a database that accepts dynamically evolving data without DDL, persists it durably, executes vectorized columnar analytics, and translates natural-language queries entirely in-process using an embedded Small Language Model (SLM) without sending data to third-party cloud APIs.
What it does
SynapseDB is an AI-native, zero-DDL columnar database engine engineered in Rust that unifies schema-less ingestion, ACID durability, vectorized analytics, and local natural-language querying.
- Sub-Millisecond Durable Writes: Ingests and durably commits writes in under 1 ms. Every incoming record is appended to a binary Write-Ahead Log (WAL) backed by frame headers, CRC32 checksum verification, and fsync persistence before returning an acknowledgment.
- Zero-DDL Dynamic Schema Evolution: Ingests raw JSON, key-value maps, and semi-structured logs without upfront CREATE TABLE definitions. The engine infers physical types (Int64, Float64, Utf8, Bool) at runtime, dynamically adds columns, and automatically performs type widening without migration scripts.
- Embedded Local SLM (Natural-Language-to-AST): Runs a quantized Small Language Model locally in-process via C/Rust FFI. Rather than generating unconstrained SQL, the SLM uses GBNF (GGML BNF) grammar-constrained decoding to compile English queries (e.g., "Show me the total revenue for orders above 5000") directly into a typed Abstract Syntax Tree (AST) validated against the database catalog before execution.
- Columnar Storage & Vectorized Analytics: Data is stored in contiguous, typed columnar chunks optimized for vectorized aggregations (SUM, AVG, COUNT, MIN, MAX). Chunks maintain Min/Max zone maps to prune unneeded chunks during scan operations (e.g., skipping a chunk if temperature > 80 falls outside its bounds).
- Multi-Interface Access: Provides a custom line-delimited TCP wire protocol on port 8765, standard SQL support, natural language queries, an Electron + Vite desktop studio, and a Next.js web playground.
How we built it
SynapseDB is built from scratch as a modular Rust Cargo workspace designed for zero-garbage-collection performance, predictable latency, and native hardware optimization (such as ARM NEON SIMD on AWS Graviton).
The architecture is divided into dedicated crates:
- synapse-wal: Append-only binary persistence layer featuring custom frame headers, CRC32 data integrity validation, crash recovery mechanics, and WAL replay routines.
- synapse-catalog: Manages runtime dynamic metadata, type inference, schema evolution, type widening, and semantic synonym resolution for query parsing.
- synapse-columnar: High-performance analytical storage organizing typed vectors into contiguous memory chunks, tracking Min/Max zone maps, and maintaining Apache Arrow-compatible representations.
- synapse-slm: The local intelligence layer executing CPU-quantized inference via C/Rust FFI, applying GBNF grammar constraints to enforce valid AST generation.
- synapse-engine: Analytical execution engine running vectorized scan, filter, and aggregation kernels with SIMD-ready execution paths.
- synapse-server: Async network runtime built on Tokio handling the line-delimited TCP wire protocol over port 8765.
- Ecosystem (desktop/ & web/): A graphical desktop manager (SynapseDB Studio) built with Electron and Vite, accompanied by an interactive Next.js/TypeScript web playground and Docker deployment configurations.
Challenges we ran into
Embedding a local Small Language Model directly into a high-throughput database engine was our most demanding technical challenge:
- Decoupling SLM Inference from the Write Path: Even a compact 0.5B quantized model requires 15–40 ms for CPU inference. Waiting for SLM validation on incoming records would degrade write throughput. To preserve sub-millisecond durability, we split the architecture: the critical write path executes deterministically (Client -> Record -> WAL -> fsync -> Ack), while schema and semantic enrichment are routed through a lock-free ring buffer to an asynchronous background SLM worker pool.
- Eliminating LLM Hallucinations via Grammar-Constrained ASTs: Standard generative models frequently produce invalid SQL dialects, hallucinate column names, or fail on edge-case syntax. We solved this by enforcing GBNF grammars at the decoding layer. The model is constrained to output only our internal AST schema, which is subsequently validated against the live catalog before passing to the query planner.
- Verifying Crash Durability: Ensuring high write throughput while guaranteeing zero data loss required designing rigorous crash-recovery tests. We implemented automated test harnesses that terminate the database process abruptly under heavy load and verify that the WAL rebuilder accurately restores all committed records without bit rot or index desynchronization.
Accomplishments that we're proud of
- Engineered a Database Engine from Scratch: Developed a working columnar storage engine and binary WAL in pure Rust without relying on off-the-shelf database engines.
- True Sub-Millisecond Durability: Achieved sustained sub-millisecond write acknowledgments backed by hardware fsync and CRC32 verification, rather than merely caching data in volatile RAM.
- Zero-DDL Analytical Performance: Merged the ingestion flexibility of a NoSQL document database with the analytical speed and compression benefits of a columnar engine.
- Deterministic, Privacy-Preserving Natural Language Querying: Successfully integrated an in-process local SLM that translates plain English into validated analytical queries with zero external API calls, zero token costs, and total data isolation.
- Full-Stack Tooling: Delivered an end-to-end developer experience, including the low-level wire protocol, CLI, Electron desktop client, and cloud-hosted Next.js playground.
What we learned
- Durability Trumps Raw Benchmark Numbers: In database engineering, sub-microsecond in-memory benchmarks mean nothing if data cannot survive a power outage or unexpected crash. Engineering the WAL, checksum verification, and crash replay paths demonstrated the discipline required to build reliable storage engines.
- Constrained SLMs Outperform General Cloud LLMs for Systems Tasks: A 0.5B local model strictly bound by formal grammar decoding functions as a deterministic semantic compiler. It avoids network hops, eliminates recurring cloud API fees, guarantees privacy, and executes with reproducible precision.
- Rust's Suitability for Systems Engineering: Rust’s zero-cost abstractions, fearless concurrency, and explicit memory layouts proved invaluable for implementing contiguous columnar blocks, FFI model bindings, and lock-free thread coordination.
What's next for SynapseDB
Our goal is to evolve SynapseDB into a production-grade, next-generation database for modern AI and analytical workloads. With securing funding or grants, the immediate priority is to recruit and scale a core engineering team to accelerate the system roadmap:
- Hardware-Accelerated Kernels: Implement hand-tuned AVX-512 and ARM NEON SIMD kernels to accelerate aggregations and filtering on AWS Graviton and modern x86 servers.
- Tiered Cloud Storage Architecture: Build an automated compaction pipeline that translates warm in-memory columnar chunks into Parquet and Arrow IPC segments for long-term archival in Amazon S3 cold storage.
- Expanded SQL & Relational Engine: Introduce multi-table hash joins, distributed query planning, and full GROUP BY / ORDER BY operations.
- Developer SDKs: Release official client libraries for Python, Go, and TypeScript to enable direct integration into diverse application ecosystems.