Show HN: Bebox – back end in a box, inside a single process

Hacker News by 4 min read 28x views
Show HN: Bebox – back end in a box, inside a single process

Share Post

bebox ("Backend-in-a-Box") collapses your border TLS, API gateway, auth, charge limits, HTTP cache, embedded databases, backdrop queues, and polyglot handlers into one zero-glue executable configured by a sole bebox.toml.

curl -fsSL https://bebox.run/install.sh | sh

Serving This Page bebox

Uncached Native + DB Read 395k req/s · 8.8 µs

ReadSetCache Hit 539k req/s · 6.2 µs

Live Hot-Swap 154 ms

Architecture

Replace 8 networked services alongside zero-IPC execution

Traditional backends divided gateway, cache, queues, search, and databases throughout network hops. bebox unbundles the OS procedure into composable tiers inner one binary.

  • API Gateway / Ingress — TLS/Certbot, redirects, fixed SPA, JWT/JWKS, schema validation, CORS
  • Redis — reply cache (TTL guessing), charge limits, BullMQ
  • PostgreSQL — relational data & association pooler
  • Elasticsearch / Pinecone — BM25 keyword & vector search
  • Temporal / Cron — durable workflows & scheduled jobs
  • Kafka / Pusher — live alter feeds & SSE fan-out
  • Node / Go / Python pods — distinct deploys & glue SDKs
  • Litestream / Backup cron — sidecar WAL shipping

Ingress, TLS & Policy (unsworn)

Native ACME TLS 1.3 HTTP/3 QUIC 308 Redirect Auth / JWKS Rate Limits 64-Shard ReadSetCache Static SPA

Polyglot Execution Tiers (Zero IPC · Unified BoxHost)

Tier 0 Fused TOML Tier 1A Wasmtime Tier 1B QuickJS-NG + oxc Tier 2 Native Rust + PKU Tier 3 Workers

Embedded Storage & Durability (Single-Cluster Raft)

[state] dimedb Ledger [sql] rodedb SQL + BM25 + Vector [[stream]] SSE [[job]] / [[cron]] / [[workflow]] [backup] S3/R2 PITR

What Developers Can Build

Everything contemporary backends need, built in

Use fair one part or merge all of them inner the identical bebox.toml—verified statically by bebox inspect and bebox scheme before traffic always arrives.

unsworn

Config-First Security & Routing

Declare API keys, Clerk/Auth0/Supabase JWKS JWT auth, indicator bounds, JSON schemas, CORS, IP rules, and durable charge limits in TOML. Invalid requests neglect before handler code runs.

dimedb + rodedb

Dual Embedded Databases

Pair microsecond in-memory transactional [state] (dimedb) alongside disk-paged [sql] (rodedb) featuring SSI transactions, BM25 full-text, Int8 vector indexes, [[sql.mirror]], and atomic ctx.multiCommit.

Zero Stale Reads

Exact Read-Set Cache & Live SSE

Every cached GET records the exact keys and SQL ranges it read. The instant a matching row commits, ReadSetCache evicts lone affected responses during [[stream]] pushes live SSE deltas.

SystemDb

Queues, Crons & Durable Workflows

Stage jobs atomically inner SQL transactions alongside tx.enqueue, run leader-guarded UTC [[cron]] schedules, and compose replay-safe [[workflow]]s alongside ctx.journal, sleep, and waitEvent.

bebox sim

Deterministic Whole-Backend Testing

Run your complete app—routing, auth, the two databases, torn-write collision recovery, crons, workflows, and mocked outbound HTTP—under one u64 kernel and virtual clock for bit-for-bit reproducible tests.

Production Ready

Encrypted Raft, ACME HTTPS & PITR

Scale to 3–5 HA nodes alongside automatic X25519 + ChaCha20-Poly1305 encryption, deploy live .cartridge bundles in 154 ms, allow native Let's Encrypt HTTPS + HTTP/3, and stream encrypted WAL backups to S3/R2.

Polyglot Execution Tiers

Write endpoints in the languages you already use

Mix TypeScript, Rust, Go, Python, C, and Zig openly inner one project. Every handler shares the exact identical BoxHost capability ABI alongside zero external glue.

Dogfooded Live on This Server

Try bebox live correct now

Every clasp below sends genuine HTTP & SSE requests to the bebox binary currently serving bebox.run—backed by live dimedb, rodedb, ReadSetCache, and [[stream]].

Try this: Click GET twice in a row—notice the second read returns the exact identical execution_token direct from ReadSetCache (handler skipped!). Then click Deposit +$25 and observe the live SSE nourish blaze AND the next GET immediately come back fresh data alongside a new token—despite the 60s TTL.

Click "GET /api/demo/accounts/{id}" to start…

Waiting for live dimedb commits…

Durable Per-IP Rate Limiter (5 requests / 15s)

Configured in one row of bebox.toml: rate_limit = { requests = 5, per = "15s" }. Backed by embedded SystemDb—zero Redis needed. Click quickly to trigger a real 429 Too Many Requests!

Click "Send GET /api/demo/limited" 6 times inside 15 seconds…

Reproducible Benchmarks

Sub-millisecond reads, linearizable Raft writes

Measured on 4 vCPUs (AMD EPYC 9354P, Linux x86_64, hardware PKU enabled) via cargo run --release -p bebox-bench.

Throughput (req/s) & p50 latency

154 ms

Live Cartridge v1 → v2 hot-swap without restarting databases

WRPKRU

Hardware Intel/AMD PKU locks outbound credentials during Tier 2 Rust execution

6.5×

Group-commit fsync WAL scaling under concurrency (2.1k → 13.8k durable writes/s)

Ship Anywhere

From single-host ACME HTTPS to encrypted Raft clusters

Run immediately on a Linux VPS alongside automatic Let's Encrypt HTTPS & HTTP/3, build a sole stripped executable alongside boxc, or deploy a generated receptacle image to Fly.io, Railway, or Render.

Documentation & Reference

Explore the complete bebox platform

Click a category below to browse topics served live from this server's embedded rodedb database, copy any snippet directly, or jump into the repository docs.

Other Article Hacker News
↑
Close Right Ads
Close Left Ads