bowrain

module
v0.0.0-...-3df1cee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0

README

Bowrain

Web Landing Pages Deploy

Bowrain shares writing guidance, terms, approved wording and review decisions across projects. Its context graph connects content to the rules that apply to its audience, channel, language and other coordinates. Built on the neokapi framework, it provides a server, content connectors, web and desktop clients, and a CLI plugin for local projects and CI.

Install

brew install neokapi/tap/bowrain-cli      # CLI plugin (commands run as `kapi <cmd>`)
brew install --cask neokapi/tap/bowrain   # Desktop app (macOS)

Layout

bowrain/
├── core/            Shared platform types (auth, store, connector, project, event)
├── plugin/          Bowrain CLI plugin (`kapi-bowrain`) — commands run as `kapi init/push/pull/up/...`
├── auth/            OIDC + AuthStore + SQLite/PostgreSQL auth
├── server/          REST/gRPC server (Echo v5)
├── service/         Auth, project, connector, flow services
├── store/           Project + content storage (SQLite + PostgreSQL)
├── connector/       Connector implementations (file, git, ...)
├── billing/         Stripe + workspace credits
├── jobs/            Background worker queue
├── event/           Event bus + automation
├── voice/           Voice profile management
├── proto/           gRPC protobuf definitions
├── cmd/
│   ├── bowrain-server/   Echo REST API server entrypoint
│   └── bowrain-worker/   Background worker entrypoint
├── apps/
│   ├── bowrain/     Desktop app (Wails v3 + React/TS)
│   ├── web/         SaaS web UI
│   ├── ctrl/        Admin control panel
│   ├── pulse/       Real-time dashboard
│   └── keycloak-theme/   Custom Keycloak theme
├── packages/ui/     @neokapi/ui — bowrain-flavored shadcn primitives (AGPL)
├── storybook/       Bowrain Storybook (port 6006)
├── e2e/             End-to-end tests
├── emails/          Email templates
├── web/
│   ├── landing/     bowrain.cloud landing site (Vite + React)
│   └── docs/        Docusaurus docs site → bowrain.cloud/docs/
└── deploy/          Deployment configs

Go modules

Module Path Purpose
Bowrain Core core/ Shared types — used by both the plugin and the server
Bowrain Plugin plugin/ kapi-bowrain plugin binary — project sync companion
Bowrain . Server, worker, desktop app, REST/gRPC handlers

Coordinated via the root go.work.

Quick start

# Build everything
make -C .. build-all

# Or piecewise
cd .. && make build-bowrain-plugin   # bin/kapi-bowrain plugin
cd .. && make build-server           # bin/bowrain-server
cd apps/bowrain && wails3 build      # native desktop app
Running Bowrain locally

Bowrain expects Keycloak (OIDC), Mailpit (email), a PostgreSQL store, an SQS-compatible job queue (ElasticMQ locally), Redis (event bus), and an async worker. There are three ways to wire it up, depending on what you're working on:

Mode What runs where Entry point Command
A · Host + HMR deps + Traefik in Docker; server + web on host https://bowrain.mymac docker compose up -d --wait + make dev-server + make dev-web
B · Full Docker, shared server + worker + web in Docker, reusing A's deps + Traefik https://bowrain.mymac make stack-up-shared
B · Full Docker, standalone everything in Docker, plain HTTP, own project http://localhost:8080 make stack-up (stack-up-web for the SPA)

Modes A and the shared full-Docker mode are the same compose project and therefore share one Traefik — no :80/:443 clash. You flip between a host-run server (HMR) and a containerized one by adding/removing the app overlay; the container's router out-prioritizes the host file-routes while it's up, and the same Traefik falls back to the host server when it's gone. The standalone mode is a separate self-contained project (its own deps, no Traefik).

Modes that use *.bowrain.mymac need the one-time host setup (dnsmasq + mkcert; make -C bowrain certs writes the wildcard cert) — see the root README's Development Setup. The standalone mode needs no host setup at all.

Mode A — active server/frontend development. Backing services (and the shared Traefik) run in Docker; the server and Vite dev server run on the host with hot reload. Traefik routes bowrain.mymac → host :8080/:5173.

docker compose up -d --wait    # deps + Traefik (auto-loads compose.override.yaml)
make -C .. dev-server          # bowrain-server on host :8080
make -C .. dev-web             # Vite HMR for bowrain/apps/web on :5173
make -C .. dev-worker          # (optional) worker, for push→translate→pull

Mode B (shared) — full stack in Docker behind the same Traefik. Adds the server + worker + web containers to Mode A's deps + Traefik project (compose.app.yaml); reachable at the same https://bowrain.mymac. No second proxy.

cp .env.example .env     # optional: set GEMINI_API_KEY for real MT
make stack-up-shared     # = docker compose -f compose.yaml -f compose.override.yaml -f compose.app.yaml up

Mode B (standalone) — zero-setup self-contained stack. Everything (incl. its own deps) built from source on plain-HTTP localhost (compose.full.yaml) — no *.mymac/TLS host setup. Best for CI and quick starts.

make stack-up            # core stack on http://localhost:8080  (Keycloak :8180, Mailpit :8025)
make stack-up-web        # …also build + serve the SaaS web UI at http://localhost:8080/

The bowrain-worker runs the built-in auto-translate-on-push automation. Its upstream provider defaults to the offline demo provider (deterministic, no key) so the pipeline works out of the box; set BOWRAIN_PLATFORM_PROVIDER=gemini

  • GEMINI_API_KEY in .env for real translations (see .env.example). Other targets: make -C bowrain stack-ps, stack-logs, stack-down, stack-shared-down.

Driving any mode with the kapi plugin (install the kapi-bowrain plugin first). Point --server at whichever entry point your mode exposes:

mkdir myapp && cd myapp
kapi init --server http://localhost:8080 --anonymous --source-locale en --target-locale fr,de
echo '{"greeting":"Hello"}' > en.json
kapi add en.json
kapi sync --locale fr,de        # push → wait for translations → pull
cat fr.json de.json             # translated catalogs

kapi init scaffolds the project; when --server is given, the bowrain plugin contributes the server connection (writes the server: block + claim token). It is idempotent — running kapi init --server … inside an existing local kapi project connects it to bowrain, leaving an already-connected project untouched. (--anonymous skips sign-in; omit it to create the project under your account, or pass --project <id> to attach to an existing server project.)

Tests
make -C .. test-bowrain         # All bowrain Go tests
go test ./server/... -v         # Single package
cd apps/bowrain/frontend && vp test       # Frontend unit tests (vitest)
cd apps/bowrain/frontend && vp test:e2e   # End-to-end (Playwright)

Make targets (this subtree)

make -f bowrain/Makefile build-server   Build bowrain-server → bin/bowrain-server
make -f bowrain/Makefile build-worker   Build bowrain-worker → bin/bowrain-worker
make -f bowrain/Makefile build-bowrain  Build native desktop app
make -f bowrain/Makefile test           Run all bowrain Go tests
make -f bowrain/Makefile lint           golangci-lint

Most are also reachable from the repo root as make -C bowrain <target>.

Documentation

License

AGPL-3.0. See LICENSE (top of this subtree). The neokapi framework at the repository root is Apache-2.0; see ../LICENSE.

bowrain/plugin/ is the exception: Apache-2.0, declared by its own LICENSE. License here attaches by directory containment, so the nearest LICENSE above a file governs it. The kapi-bowrain binary is built from that subtree and links nothing else under bowrain/ — a client of this server rather than a part of it — which is what the plugin manifest, the plugin registry, and the Homebrew formula have always declared. make check-module-boundaries asserts the linkage, so the declaration cannot quietly stop being true.

Directories

Path Synopsis
ai
bedrock
Package bedrock implements an aiprovider.LLMProvider backed by AWS Bedrock's Converse API.
Package bedrock implements an aiprovider.LLMProvider backed by AWS Bedrock's Converse API.
Package apierror is the single definition of the Bowrain API error envelope.
Package apierror is the single definition of the Bowrain API error envelope.
apps
bowrain command
bowrain/cmd/wbridge command
Command wbridge exposes the REAL Bowrain Desktop backend (backend.App) over HTTP so the genuine frontend can run in a browser for walkthrough recording.
Command wbridge exposes the REAL Bowrain Desktop backend (backend.App) over HTTP so the genuine frontend can run in a browser for walkthrough recording.
Package billing implements plan management, usage credits, Stripe integration, and feature gating for the Bowrain platform.
Package billing implements plan management, usage credits, Stripe integration, and feature gating for the Bowrain platform.
internal/genplans command
Command genplans writes the landing-page plan catalog (the Go-sourced plan FACTS) to a committed JSON file.
Command genplans writes the landing-page plan catalog (the Go-sourced plan FACTS) to a committed JSON file.
Package changes is the Bowrain server's side of the change contract (kapi.change/v1, core/change): the stream home, which keeps a stream's documents in rows, the operations a server job sends for the blocks a tool produced, and the recorder that announces an applied change set.
Package changes is the Bowrain server's side of the change contract (kapi.change/v1, core/change): the stream home, which keeps a stream's documents in rows, the operations a server job sends for the blocks a tool produced, and the recorder that announces an applied change set.
cmd
bowrain-server command
bowrain-worker command
internal/boot
Package boot validates critical process configuration before the bowrain binaries start serving.
Package boot validates critical process configuration before the bowrain binaries start serving.
stripe-provision command
Command stripe-provision creates (or confirms) the Stripe objects the Bowrain billing code expects: the Pro and Team subscription prices, the credit-pack price, the AI-token meter, and the webhook endpoint.
Command stripe-provision creates (or confirms) the Stripe objects the Bowrain billing code expects: the Pro and Team subscription prices, the credit-pack price, the AI-token meter, and the webhook endpoint.
Package contextscan ingests brand source material (pasted text, public web pages, uploaded files) into a single plain-text corpus for AI brand onboarding.
Package contextscan ingests brand source material (pasted text, public web pages, uploaded files) into a single plain-text corpus for AI brand onboarding.
core module
Package credentials manages AI provider configurations on disk and API keys in the OS keychain for the bowrain server, worker, and desktop app.
Package credentials manages AI provider configurations on disk and API keys in the OS keychain for the bowrain server, worker, and desktop app.
Package crypto provides authenticated encryption for secret values stored at rest (e.g.
Package crypto provides authenticated encryption for secret values stored at rest (e.g.
Package editorclient is the REST/SSE client for the Bowrain editor surface: workspace and project browsing, block editing and review, content memory, terminology, and AI-provider configuration.
Package editorclient is the REST/SSE client for the Bowrain editor surface: workspace and project browsing, block editing and review, content memory, terminology, and AI-provider configuration.
Package forge talks to git forges — GitHub and GitLab — for the delivery tier: verifying inbound push webhooks and keeping one open pull/merge request per project up to date with the produced translations.
Package forge talks to git forges — GitHub and GitLab — for the delivery tier: verifying inbound push webhooks and keeping one open pull/merge request per project up to date with the produced translations.
Package knowledge implements the governance and collaboration layer of the brand knowledge graph (AD-021): markets, observations, comments, concept revisions, change-sets with reviews and pilots, and the change-set state machine.
Package knowledge implements the governance and collaboration layer of the brand knowledge graph (AD-021): markets, observations, comments, concept revisions, change-sets with reviews and pilots, and the change-set state machine.
Package mailer renders email templates and dispatches transactional emails for Bowrain.
Package mailer renders email templates and dispatches transactional emails for Bowrain.
Package memory provides a PostgreSQL-backed implementation of neokapi's multilingual content memory.
Package memory provides a PostgreSQL-backed implementation of neokapi's multilingual content memory.
Package migrations enumerates every PostgreSQL schema a bowrain deployment owns, in the order a deployment applies them.
Package migrations enumerates every PostgreSQL schema a bowrain deployment owns, in the order a deployment applies them.
Package observe provides observability infrastructure for the Bowrain server: structured logging, Prometheus metrics, request correlation, and profiling.
Package observe provides observability infrastructure for the Bowrain server: structured logging, Prometheus metrics, request correlation, and profiling.
Package platformconfig is the instance-wide (singleton) settings store for the Bowrain platform: the admin-controlled configuration surfaced in the ctrl control plane and applied at runtime by the server and worker.
Package platformconfig is the instance-wide (singleton) settings store for the Bowrain platform: the admin-controlled configuration surfaced in the ctrl control plane and applied at runtime by the server and worker.
proto
v1
Package resilience provides circuit breakers for outbound dependencies used by the Bowrain server and worker, including AI providers, connectors, storage, mail, identity and billing services.
Package resilience provides circuit breakers for outbound dependencies used by the Bowrain server and worker, including AI providers, connectors, storage, mail, identity and billing services.
aiguard
Package aiguard puts every LLM call behind a per-provider circuit breaker.
Package aiguard puts every LLM call behind a per-provider circuit breaker.
Package review holds the platform's answer to one question: may this user decide this unit, at this rung, in this project and this language?
Package review holds the platform's answer to one question: may this user decide this unit, at this rung, in this project and this language?
Package runtimedirs checks, at start-up, that the directories the server and the worker write at run time are writable.
Package runtimedirs checks, at start-up, that the directories the server and the worker write at run time are writable.
Package safehttp builds HTTP clients that will not reach private address space.
Package safehttp builds HTTP clients that will not reach private address space.
safehttptest
Package safehttptest lets a test reach a local fixture server through the SSRF policy in bowrain/safehttp, without relaxing any of its checks.
Package safehttptest lets a test reach a local fixture server through the SSRF policy in bowrain/safehttp, without relaxing any of its checks.
Package sandbox provides an isolated code execution environment backed by Docker containers.
Package sandbox provides an isolated code execution environment backed by Docker containers.
scripts
Package server provides the REST and gRPC API server for Bowrain.
Package server provides the REST and gRPC API server for Bowrain.
mcp
Package mcp provides a cloud MCP (Model Context Protocol) server that exposes voice resources, tools, and prompts via Streamable HTTP.
Package mcp provides a cloud MCP (Model Context Protocol) server that exposes voice resources, tools, and prompts via Streamable HTTP.
Package service provides the shared business logic layer used by both the REST/gRPC server and the CLI.
Package service provides the shared business logic layer used by both the REST/gRPC server and the CLI.
Package storage provides shared SQLite infrastructure for Memory (content memory) and Terminology.
Package storage provides shared SQLite infrastructure for Memory (content memory) and Terminology.
blobcfg
Package blobcfg centralizes how the server and worker resolve their blob backend from the environment, so the two can never drift (the historical LOCAL_BLOB_DIR vs BLOB_STORAGE_LOCAL_DIR split is exactly the kind of bug this prevents).
Package blobcfg centralizes how the server and worker resolve their blob backend from the environment, so the two can never drift (the historical LOCAL_BLOB_DIR vs BLOB_STORAGE_LOCAL_DIR split is exactly the kind of bug this prevents).
localblob
Package localblob provides a local filesystem implementation of BlobStore.
Package localblob provides a local filesystem implementation of BlobStore.
s3blob
Package s3blob provides an Amazon S3 (and S3-compatible: MinIO, LocalStack) implementation of storage.BlobStore.
Package s3blob provides an Amazon S3 (and S3-compatible: MinIO, LocalStack) implementation of storage.BlobStore.
blockstore
Package blockstore adapts Bowrain's ContentStore to core/blockstore.Store for flows, automation and server handlers.
Package blockstore adapts Bowrain's ContentStore to core/blockstore.Store for flows, automation and server handlers.
internal/storeutil
Package storeutil holds helpers shared by the PostgreSQL ContentStore (package store) and the SQLite ContentStore (package sqlitestore), so the two backends cannot drift on stream defaulting, locale serialization, block-ID generation, or which rows a deletion reaches.
Package storeutil holds helpers shared by the PostgreSQL ContentStore (package store) and the SQLite ContentStore (package sqlitestore), so the two backends cannot drift on stream defaulting, locale serialization, block-ID generation, or which rows a deletion reaches.
Package sync hosts the server-side sync engine: the Merkle-tree diff engine (diff.go) and the Redis-backed hash cache (cache_redis.go), which depend on bowrain/core/store and redis and therefore belong in the platform module.
Package sync hosts the server-side sync engine: the Merkle-tree diff engine (diff.go) and the Redis-backed hash cache (cache_redis.go), which depend on bowrain/core/store and redis and therefore belong in the platform module.
Package termcandidate finds a project's key terms and files them for review: candidate terms drawn from a sample of every collection, counted over the whole project, and stored as proposed concepts in the workspace terms store.
Package termcandidate finds a project's key terms and files them for review: candidate terms drawn from a sample of every collection, counted over the whole project, and stored as proposed concepts in the workspace terms store.
termstest
Package termstest helps tests put a concept writer in the race it must win or lose correctly.
Package termstest helps tests put a concept writer in the race it must win or lose correctly.
Package termscope limits the concepts of a workspace's terms store to the projects they apply in.
Package termscope limits the concepts of a workspace's terms store to the projects they apply in.
Package termspush applies the terminology part of a push.
Package termspush applies the terminology part of a push.
testutil
pgtest
Package pgtest provides PostgreSQL test infrastructure using testcontainers-go.
Package pgtest provides PostgreSQL test infrastructure using testcontainers-go.
testimage
Package testimage names every container image the bowrain suites start, so the tests and the CI step that fetches them ahead of the run read the same list.
Package testimage names every container image the bowrain suites start, so the tests and the CI step that fetches them ahead of the run read the same list.
testimage/list command
Command list prints the container images the bowrain suites start, one per line, for the CI step that fetches them before the tests run.
Command list prints the container images the bowrain suites start, one per line, for the CI step that fetches them before the tests run.
Package voicewrite writes a workspace voice profile and records the write on the context ledger, as one change.
Package voicewrite writes a workspace voice profile and records the write on the context ledger, as one change.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL