Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 7 minutes ago History
README.md · 16.2 KB · 311 lines

DBBASIC Object Server

DBBASIC Object Server is business software for small businesses, run on one small VM. It ships a working suite of 58 apps -- books, invoices, payments, bank reconciliation, a shop with stock and pickup slots, expenses, fixed assets, projects, notes, a forum and a shell you can talk to -- each one a package of a schema, permission rules and, at most, one page object. Changes to objects, schemas and permissions are live on the next request; there is no build or deploy step.

It is for two kinds of reader: the owner or operator of a small business who wants their records in files they can read and back up, and the people (and AIs) building apps on top of it. Business rules are written as declarations (see DRON below) that one engine enforces for every writer: web form, API, import, MCP agent, AI chat or the daemon's own clock.

It is stdlib-only Python (plus uvicorn to serve), data in human-readable TSV files you can grep, one permission engine across every surface, and MIT licensed. A $5-$7 VM is plenty.

Get it running: docs/quickstart.md takes a fresh VM to a running server, a login, an HTTPS domain and a first app in about thirty minutes with scripts/install.sh. New to the idea? Start with why it is different.

It runs its own homepage: dbbasic.com is served by this server -- one host on a multi-domain instance, its pages stored as records and rendered by a pair of page objects. Editing the site is a data change, not a deploy.

Working on this repo with an AI agent? Start at AGENTS.md: the doctrine, the traps that fail silently and the conventions that are expensive to infer from the source. CLAUDE.md points at it. Then read docs/architecture.md, which maps the whole system; the grouped index of every doc is docs/README.md.

The Core Idea

A DBBASIC object is one small Python file that can do useful application work: an API endpoint, page, report, worker, webhook, admin action, scheduled job or business record handler. It keeps its source, state, logs, files, versions and runtime errors close together, which gives a short loop:

flowchart TD
    A["Edit one object"] --> B["Run it"]
    B --> C["See output, logs, state, and errors"]
    C --> D["Fix source"]
    D --> E["Keep version trail"]
    E --> A

The loop happens inside the running server, not through CI, build and deployment, so small changes can be tested and repaired fast -- by a person or an AI. DBBASIC is not trying to copy Rails or Django: the old CGI idea (a request maps directly to code) kept, with ASGI so the server stays running and source, state, logs, versions and rollback all live beside the object. The shell (docs/shell-and-ai.md) lets you operate the server by talking to it.

Declarations: DRON

Most of what a business means by "the rules" is a fact about data: an amount must be positive, an approved entry changes only its status and notes, a payment cannot exceed its invoice, only the owner moves a draft to submitted. DBBASIC writes those down as DRON, Data Rules Object Notation: a handful of JSON files per app (a collection schema, a package manifest, permission rules) with no loops, functions or expressions, so a person or a small model can read them and a second engine could re-implement them.

The engine makes them true for every writer, inside the write lock. The declarations include permissions (who may do what to which rows and fields), unique, locked_when (what freezes a record and which fields may still change), locked_checks (a read-only function deciding from other collections, atomically with the write), validation (bounds, enums, required- when), relation requires (a pointer may only target a record its writer may act on) and attention (the queues that need a human, counted per viewer).

A real fragment, from the fixed-asset app's asset_disposals collection:

"unique": [{"fields": ["asset_id"],
            "message": "This asset already has a disposal. An asset leaves the books once."}],
"locked_when": [{"when": {"status": ["posted"]}, "except": ["notes"],
                 "message": "This disposal is on the books. Correct it with a reversing journal, not an edit."}]

Two sentences of JSON replace a hook, a test of the hook and the bug where one writer forgot to call it. JSON Schema files for DRON 0.2 live in dron/, held to the loaders by a test. Full definition and the row- filter language: docs/dron.md. Where each kind of rule goes when it cannot be declared: docs/business-logic-patterns.md.

The App Suite

58 app-* packages (plus three small example/probe packages and system-triggers; 120 collections in all), grouped by what they are for. The money apps share one ledger and one composer, the commerce apps one catalogue and one stock log. The per-package table is docs/app-packages.md.

  • Money and books -- app-finance (double-entry journals, trial balance,

closed periods, recurring entries, expenses with categories that decide what an expense needs before approval and how much is deductible, a mileage log, a fringe-benefit register), app-invoices, app-payments, app-bills (what suppliers bill us), app-banking (statement import and reconciliation), app-billing (prepaid wallets, plans, usage), app-assets (fixed-asset register, monthly depreciation, disposals, loss events), app-entities, app-promotions, app-disputes, app-integrity, app-notary.

  • Shop, orders and stock -- app-catalog (products, locations, derived

stock, shrinkage and evaporation, counts that flag an above-normal shortage, reorder suggestions, an in-store-only flag), app-orders, app-shop (storefront and checkout; an online order holds its goods from checkout, and the page says only N left or sold out), app-shipping, app-receiving, app-returns, app-kitchen, app-exchange.

  • Booking and pickup -- app-pickup (collection windows generated ahead;

an unpaid checkout stops holding its slot when its hold lapses) and app-events (calendar).

  • People and privacy -- app-contacts, app-worker (profiles),

app-privacy, and the subject export that finds every field a package declares as personal data.

  • Collaboration -- app-projects, app-tasks, app-notes,

app-articles, app-links, app-files, app-forum, app-messaging, app-collab, app-thread, app-share, app-timers, app-templates.

  • Platform -- app-nav (home page and every app's "needs a human"

count), app-views (pages as records, /flow), app-theme, app-settings, app-notify, app-rollup, app-materialize, app-email, app-analytics, app-dashboard, app-feed, app-activity, app-agents, app-runner (metered jobs against a wallet), app-shell, app-intake (a photographed receipt becomes a suggestion, never a posting), app-documents, app-sites, app-docs, app-mail-sync.

Measured in code. Everyone writes a notes app as the demo. Here the measure is registered objects (real Python files) per app: notes, tasks, contacts, projects, articles, links, templates and entities need none -- a schema, permission rules and seeded view records. The rest add code only where docs/zero-to-code.md says it enters: gates on the write path, composers reacting to money movement, verbs, scheduled runners and a few bespoke report pages (a trial balance is a fold, not a form). Every app, coded or not, gets the same list/board/form/detail surfaces, JSON API, MCP tools, realtime push and search, because those read the schema, not the app.

Box-to-Box Exchange

Companies' own boxes trade signed business documents directly, with no platform in the middle: purchase orders, order confirmations, invoices, credit notes, remittances and goods receipts, signed with Ed25519 keys each box publishes at /.well-known/dbbasic and pins for every trading partner. Each received document is verified, stored verbatim as evidence, answered with a signed receipt and turned into the right local record -- and nothing that moves money happens by itself: an invoice becomes a supplier bill waiting for approval, never paid automatically, and a remittance is a claim until a person confirms it against the bank.

Phase 0 is built (app-exchange, app-bills) and proven in a two-company simulation: BeanCo Roasters and Brewly, each a real box with its own data directory and users. A purchase order becomes a draft order; an amended confirmation is flagged, not applied; an invoice becomes a supplier bill; a remittance is confirmed against the bank; a credit note arrives. A delivery retries once, a duplicate or replay is stored once, a key rotation carries over, and a forged, unconnected, edited, replayed or disconnected sender is refused.

Honest limits. The simulation uses an in-process transport; it has not yet run over real HTTPS between machines. Next: partial payments, credit-note netting, units and line-level confirmation. Email fallback, the Peppol bridge, despatch advice and three-way match are not built. Needs the exchange extra. Details, the envelope and exactly what is signed: docs/box-to-box-exchange.md.

How It Gets Better

The platform is exercised by simulated businesses: AI agents playing owners, staff, customers and attackers, running a café, a clinic, a shop and others that buy, sell, book, ship and close their books on it. Alongside that sits research into what real businesses complain about in their software. Each finding becomes a bug report, each report a fix, and each fix lands with a test that fails without it.

The result is written down in plain language in CHANGELOG.md, grouped by the problem a business would recognise ("a customer could mark someone else's invoice paid", "a coupon could be used twice") rather than by code package; scripts/changelog_check.py keeps it complete.

A few findings are not fixed on purpose. Fifteen tests are strict xfail: they describe real gaps in tests/test_findings_handlers.py (tax and rounding restated by totals handlers, an invoice's status after a refund or a bounce) whose cure is a money decision that waits on the owner, not on the code. The suite stays green and the test flips loudly the day it is decided.

The Clock Is Part of the Framework

Rails and Django end at request/response; everything time-driven is exiled to cron or a queue whose state the application cannot query. Real systems mostly run on the clock -- billing cycles, invoice aging, dunning, reconciliation, recurring journals, retention -- so here the clock is inside the system:

  • time-driven state changes are daemon passes through the same transition

machinery as any other write (an invoice goes overdue by the rules a person would be held to)

  • scheduled tasks are data, cron or one-time, editable at runtime
  • every run's outcome is a record in scheduler_runs, under the same

permissions, audit and realtime push as every other collection

  • /scheduler is the operator board: next runs, last outcomes, history,

run-now/pause/resume; an AI operator can answer "did anything fail overnight?" by reading a collection

Records That Can Be Checked A Year Later

An audit log lives in the same database, under the same credentials, as the thing it audits. Two small apps close that.

app-notary -- lodge a digest, check it later. An append-only list of (digest, when) and nothing else; anybody can confirm later, with no account, that data already existed by then. /notary hashes a dropped file in your browser and uploads nothing. It never stores content, never amends or removes anything, and attests existence only -- not authorship, ownership or meaning.

app-integrity -- anchor the ledgers. A daily pass digests each money ledger and lodges the digest with whatever notaries are configured; /ledger-integrity recomputes and reports. For an append-only log a prefix digest is a chain head, so no per-row chain was needed. It hashes logical rows (never file bytes, because compaction rewrites logs) and stores the field list in the anchor (so a new column is not mistaken for an attack).

What this does not claim. An anchor stored beside the ledger is defeated by anyone who could have edited the ledger, so /ledger-integrity refuses to show a clean verdict for a digest nobody else holds: it says "anchored, but only here". On this repository's own server no independent notary is configured. Pointing notary.endpoints at somebody else's server is the whole difference between detectable by us and provable to you.

Requirements and Quick Start

  • Python 3.10 or newer. CI runs 3.10 through 3.14 and the free-threaded

3.14t build (more than 9,000 tests), plus a Docker Compose build-and-health-check, on every push.

  • The core has no dependencies. Optional extras (pyproject.toml):

server (uvicorn, websockets), scheduler (croniter, needed for any cron schedule to run), exchange (cryptography, for signing), test, dev.

python -m pip install -e '.[server,scheduler,test]'
export DBBASIC_ADMIN_TOKEN=replace-with-a-local-dev-token   # placeholder: make your own
uvicorn object_server:app --host 127.0.0.1 --port 8001
curl http://127.0.0.1:8001/health

Try a package as different users, with permission enforcement on, in a scratch directory (nothing else is written):

python scripts/try_package.py app-notes --user ann --user bob \
  --call 'ann POST /collections/notes/records {"title": "hi", "content": "hello", "owner_id": "ann"}' \
  --call 'bob GET /collections/notes/records' --brief
python scripts/new_package.py app-tickets     # scaffold a working package
python -m pytest -q                            # the suite

First admin user, login, reverse proxy and HTTPS: docs/quickstart.md. Writing a package: docs/package-authoring.md. Deploying: docs/single-vm-deployment.md or docs/docker-deployment.md. The HTTP surface: docs/http-api-contract.md. Permissions: docs/permissions-model.md. The companion app DBBASIC Scroll is optional; everything is usable through HTTP and the command line.

Status

Public staging runtime, version 0.0.1 (pre-alpha). It is suitable for local development, dogfooding, controlled staging and careful internal apps where the operator controls the code and users.

What it does not claim yet:

  • it is not safe as an open public runtime where strangers can sign up and

run arbitrary code: there are no CPU or memory quotas for untrusted object code (the worker pool gives process isolation and timeouts, not resource limits)

  • permission enforcement is not yet default-on for fresh installs
  • it is not a certified accounting, tax or payroll product; the finance docs

say what is left to the accountant

  • box-to-box exchange has not run over real HTTPS between machines
  • the only production deployment it points to is the project's own

dbbasic.com instance; there is no claim of a wider base of businesses running on it

Also open: warm-standby replication, per-tenant collection roots (docs/per-tenant-storage-direction.md) and compaction scheduling. Performance is measured, not asserted (indexed point reads at a million rows ~0.3 ms; details in docs/storage-modes.md). The readiness checklist is docs/status.md.

Public Repository Safety

This repository was assembled from a working private prototype in small, reviewed, tested slices, each checked for private deployment details. The rule continues: no secrets, real hostnames, real IPs or personal paths; samples use 127.0.0.1, documentation IP ranges and example.com. Read SECURITY.md and CONTRIBUTING.md before copying code or docs in.

License

MIT License. See LICENSE.