1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00
aziascreations a6ade535d0 Stopped writing once SQLite rolled a batch back
- SQLite may roll a whole transaction back by itself (a full disk, an
  I/O error, out of memory). The writes after it then ran outside any
  transaction, each committed alone, while the batch failed and every
  write was answered ServerError: a retried push stored twice
- Every Batch operation after is refused now (Error::RolledBack,
  Batch::is_rolled_back), the batch fails, nothing in it stored; the
  server's writer stops running the group there
- batch.rs nothing_runs_once_sqlite_rolled_back (a ROLLBACK standing in
  for SQLite's); docs (storage.md) and revamp.md (step 18)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:41:04 +01:00

BakaShrot

A vibe-coded and opinionated message store built on SQLite, with replication between servers.

BakaShort allows applications and scripts to push/read data and files and let them replicate over an entire mesh regardless of whether the links are up or reliable.
It also allows to sleep easy knowing each client is strongly authenticated by using certificates over public networks.

Features

  • Cert-based authentication with TLS 1.3 connections
    • Easy tools provided to manage it and CRL-based revocations.
  • Role-based scoping of push and reads baked into certificates.
  • Directional replication between servers, either complete or by topic and node names.
  • File replication, one per message, up to 1 GiB by default with resumable replication.
  • Per-topic and per-server retention of messages and files.
    • Edge can be configured to minutes while internal can hold years independently.
  • Read-only SQL queries on stored JSON messages.
  • Every push flushed to disk before it's answered, or about twice the pushes with synchronous = "normal"
  • Supports Windows and Linux, both on x64 and ARM64.
  • Clients:
    • A C library (bakashrot.dll, libbakashrot.so), with a C header and PureBasic prototypes
    • A CLI tool to push, read, query and list
    • A Python module over the library, without dependencies, as a wheel with the library in it
    • A C# client over the library, one file without dependencies, for .NET Framework 2.0 and 3.x up to the latest .NET

Limitations

The main ones, all in docs/known-issues.md with what's left as it is and why:

  • No replication consensus. (See Why not something else)
  • Peers are trusted with what they replicate, and clients only scope restrictions based on their role.
  • Only 1,048,575 topic and node pairs can exist per database.
  • Clients poll for new messages themselves.

Quick Start

All instructions to setup a BakaShrot network can be found in guides/.

It should take you 5-10 minutes if you test without docker, and maybe 10-15 minutes if you use a dockerized server.

Why not something else

Replicated SQL/SQLite DB

Projects like rqlite and dqlite could have been perfect for what BakaShrot tries to accomplish.
They require a leader, a constant S2S connection, and do not support split networks by design.

In contrast, BakaShrot moves trust off the server mesh itself and assumes you properly set up each node with a unique name and cert to prevent conflicts.

This prevents you from properly load-balancing, letting untrusted users push messages, and whatnot.
But you gain the ability to host a message-server network over unreliable links without losing a single bit of data.

MQTT Brokers

Mosquitto and other MQTT brokers handle the topic-based messaging in a near-perfect way, but they only deliver messages to whoever is subscribed at that moment, and have limited archival options.
BakaShrot keeps every message, and allows you to re-read them days or years later.

Other message stores

Projects like Kafka, NATS JetStream are a good alternative to BakaShrot if you have the infrastructure and resources to host them.

However, I don't have heaps of RAM to piss away on running a JVM or other stuff.
And BakaShrot, while simpler in all other aspect, takes less than 50 MB to run and can share any 1-2$ VPS with other applications very easily.

Cloning

git clone https://github.com/aziascreations/BakaShrot.git

License

All the code in this repo is released in the Public Domain.

The releases include third-party crates under their own licenses, listed with their texts in THIRD-PARTY.txt.

S
Description
(W.I.P.) Vibe-coded message store with replication used for internal messaging between micro-services.
Readme CC0-1.0 2.9 MiB
Languages
Rust 76.4%
Python 9.3%
C# 6.8%
PureBasic 3.7%
C 2.4%
Other 1.4%