Glassbeetle
A NestJS backend, an Angular frontend, and a Tauri desktop shell in one npm
workspace — all three start with a single command.
New here? CONTRIBUTING.md is the short path from a
clone to a merged pull request, and there is
a backlog of self-contained issues
waiting for someone to pick them up.
npm install
npm run devnpm run dev boots the API, boots the Angular dev server, waits until both
answer, then opens the Tauri window. Closing the window shuts the other two
down.
Layout
glassbeetle/
├── apps/
│ ├── api/ NestJS 12 backend → http://localhost:3000/api/v1
│ ├── web/ Angular 21 frontend → http://localhost:4200
│ └── desktop/src-tauri/ Tauri 2 shell (Rust)
├── data/ The SQL schema, one file per table
├── docs/ Conventions and design records
├── scripts/ Repository tooling (npm run stop)
└── package.json npm workspaces + orchestration scripts
The API is the only process that opens the SQLite database — not the frontend,
not the Rust shell. data/ holds the schema as executable SQL, applied in the
order declared in
apps/api/src/database/schema-migrations.ts.
The documentation index points to the project's conventions,
design records, and proposals.
The three tiers talk to each other like this:
- The Tauri window loads
http://localhost:4200in development, and the
prebuilt Angular bundle (apps/web/dist/web/browser) in a packaged build. - Angular calls the API at
http://localhost:3000/api/v1, configured in
apps/web/src/environments/. The URL is absolute on purpose: a packaged
Tauri app is served fromtauri://localhost, so a relative/apiwould
resolve against the custom protocol instead of the NestJS server. - NestJS allows exactly three CORS origins — the dev server, the macOS/Linux
webview (tauri://localhost) and the Windows webview
(http://tauri.localhost). The API binds to127.0.0.1and has no
authentication, so the allowlist is what stops any website the user visits
from reading their data overlocalhost. Override it with
GLASSBEETLE_CORS_ORIGINSif you run the frontend on a different port. - Rust and Angular talk through events rather than through a command surface.
The native menu emitsglassbeetle://menuwith an action id, which the
Angular shell carries out; the shell emitsglassbeetle://readyonce it has
painted, which is what makes the window appear. See
apps/desktop/src-tauri/src/menu.rs.
Scripts
| Command | What it does |
|---|---|
npm run dev |
API + Angular + Tauri window (the one command) |
npm start |
Alias for npm run dev |
npm run dev:api |
Just the NestJS API, in watch mode |
npm run dev:web |
Just the Angular dev server |
npm run stop |
Stop the API, the dev server and the Tauri window |
npm run build |
Compile the API and build the Angular bundle |
npm run build:sidecar |
Compile the self-contained NestJS API sidecar binary |
npm run build:desktop |
Build the API, sidecar, and bundle the desktop app |
npm test |
Run the API and frontend unit tests |
npm run lint |
Lint workspaces that define a lint script (API today) |
npm run format |
Format API + web sources with Prettier |
npm run format:check |
Check formatting without writing |
npm run test:e2e -w @glassbeetle/api |
Run the API end-to-end tests |
npm run openapi:export -w @glassbeetle/api |
Write the OpenAPI spec to a file |
npm run clean |
Remove dist/ output and the Rust target/ directory |
npm run dev shuts all three tiers down when you close the Tauri window, but a
crashed terminal or a detached run can leave the API or the dev server holding
their port — and the next start then fails with EADDRINUSE. npm run stop
clears that: it finds whatever is listening on 3000 and 4200, stops the
watchers as well as the servers so nothing restarts itself, and leaves other
projects alone. It works on Windows, macOS and Linux, and is safe to run when
nothing is up.
npm run stop -- --dry-run # show what would be stopped, kill nothing
API_PORT=3001 npm run stop # non-default portsFrontend
The UI is an agent workspace built on Angular and Angular Material: a rail
carrying the live agent roster beside every screen, a ⌘K command palette over
agents, memory and prompts, and a workspace per agent showing the context it is
configured to draw on.
It covers the endpoints the API implements — the user's own profile, the
spending budget, agents (profile picture and private memories included),
teams and their rosters, chats, shared memory, system prompts and service
health. The modules that are still empty controllers have no screens.
Where the schema promises more than the API serves, the UI says so rather than
mocking it: agents show configuration readiness rather than an invented run
state, the feed is labelled as configuration history, the spending screen
states that nothing writes usage_events yet rather than presenting an
untouched budget as a measurement, a chat shows the turns the API serves but no
composer because nothing generates a reply yet, and model assignment is
disabled with its reason stated because agents.model_id references a models
table that has no endpoint to populate it.
Structure, conventions and the capability probe that drives that last point are
documented in apps/web/README.md. Read it before adding
a screen.
API
The API is served under /api/v1 and is documented with OpenAPI:
- interactive docs — http://localhost:3000/api/docs
- raw document — http://localhost:3000/api/docs-json, or
npm run openapi:export -w @glassbeetle/api
Conventions every endpoint follows — routing, resource representation,
validation, the error envelope, configuration and security boundaries — are
documented in docs/api-conventions.md. Read it
before adding an endpoint.
Configuration
Every setting is optional; the API starts with per-user defaults and does not
require a .env file. See apps/api/.env.example for
the full list.
Application data (the SQLite database, uploaded files, artifacts and backups)
lives outside the repository, in a per-user directory:
| Platform | Default data directory |
|---|---|
| macOS | ~/Library/Application Support/Glassbeetle |
| Windows | %APPDATA%\Glassbeetle |
| Linux | $XDG_DATA_HOME/glassbeetle, else ~/.local/share/glassbeetle |
Override it with GLASSBEETLE_DATA_DIR (absolute paths only).
Requirements
- Node.js 24, version 24.15.0 or newer within that major (
.nvmrcpins the CI version) - Rust toolchain (
rustup), plus the platform prerequisites for Tauri 2 —
Xcode Command Line Tools on macOS
Packaging and Sidecar Architecture
npm run build:desktop produces a fully self-contained, installable application that embeds the NestJS API server inside the app bundle as a Tauri sidecar. The packaged app runs out of the box on machines without Node.js installed.
How it works
-
Self-contained Sidecar Binary (
glassbeetle-api):- The
@glassbeetle/apiTypeScript source is compiled todist/. - Production runtime dependencies (including
better-sqlite3's native.nodeaddon) and the host Node.js runtime executable are packaged into a compressed payload archive (sidecar_payload.tar.gz). - A standalone Rust launcher (
apps/desktop/src-tauri/src/bin/sidecar.rs) embeds the payload archive and is compiled intoapps/desktop/src-tauri/binaries/glassbeetle-api-<target-triple>. - On first run, the sidecar unpacks its payload into a versioned cache directory (
~/Library/Caches/Glassbeetle/api-sidecar/<hash>/on macOS,%LOCALAPPDATA%\Glassbeetle\cache\api-sidecar\<hash>\on Windows,~/.cache/glassbeetle/api-sidecar/<hash>/on Linux). On subsequent runs, it executes immediately in ~160ms. - On Unix systems, the sidecar runner replaces itself with the Node process using
exec(), eliminating intermediate wrapper overhead.
- The
-
Process Lifecycle and Orphan Prevention:
- In packaged builds, the Tauri shell starts the sidecar on launch and polls
http://127.0.0.1:3000/api/v1/healthin the background. - The desktop window remains hidden until the API responds with
200 OK, matching theglassbeetle://readyevent sequencing. - Graceful Shutdown: When the user closes the window or quits (Cmd+Q), the shell sends
SIGTERMto the API process. NestJS shutdown hooks execute, releasing the SQLite handle and HTTP listener before exiting. - Ungraceful Termination / Crash Protection: The shell connects a standard input pipe to the sidecar. If the desktop app crashes or is killed ungracefully (
kill -9), the OS kernel closes the pipe. The API monitors stdin EOF and its parent PID, terminating immediately if orphaned. No background processes hold port 3000 afterwards. - Port Conflict Handling: If port 3000 is already in use by another service on launch, the shell detects the conflict, avoids spawning a colliding process, and presents a visible, styled in-window error card with instructions (
npm run stop).
- In packaged builds, the Tauri shell starts the sidecar on launch and polls
-
Shared User Data:
- Packaged builds and development builds use the exact same per-user data directory (
~/Library/Application Support/Glassbeetleon macOS). Data created in development is immediately accessible in the packaged app, and vice versa.
- Packaged builds and development builds use the exact same per-user data directory (
-
Process Tree:
glassbeetle.app/Contents/MacOS/glassbeetle-desktop └── node dist/main.js (exec'd from glassbeetle-api)
Building the Desktop Application
# Build the entire application (API, sidecar, Angular frontend, and Tauri bundle):
npm run build:desktop
# Or compile only the sidecar binary:
npm run build:sidecarDebugging the Sidecar
- Logs: Run the packaged executable directly from the terminal to see standard output and error streams:
./apps/desktop/src-tauri/target/release/bundle/macos/glassbeetle.app/Contents/MacOS/glassbeetle-desktop
- Force Sidecar in Dev: Test sidecar lifecycle behavior in debug builds by setting:
GLASSBEETLE_FORCE_SIDECAR=1 npm run tauri:dev -w @glassbeetle/desktop
- Check Port Listeners:
lsof -nP -iTCP:3000 -sTCP:LISTEN
Contributing
Glassbeetle is meant to be built by more than one person, and the backlog is
deliberately sliced so that you can finish a piece of it without reading the
whole codebase. Most open issues name a single endpoint or a single screen and
come with acceptance criteria already written.
- Contributing guide — setup, the fast dev loop without
Rust or Tauri, the conventions, and what makes a pull request easy to merge - Good first issues
— scoped for a first contribution - Contributors — everyone who has helped build this
- Code of Conduct · Security policy
Questions are welcome as issues, and an unfinished change is welcome as a draft
pull request. You do not need permission to start.
Conventions live next to the code they govern:
docs/api-conventions.md before adding an endpoint,
apps/web/README.md before adding a screen,
docs/testing.md before writing a test.
Toolchain notes
Node.js 24.15.0 is the minimum supported runtime. better-sqlite3 requires
Node 22 or newer, and the locked NestJS schematics and Angular devkit require
^22.22.3 || ^24.15.0 || >=26.0.0. Node 24 satisfies both without downgrading
the database driver. The supported range is ^24.15.0; other Node majors are
not part of the tested toolchain.
All four CI jobs read the same exact version from .nvmrc. If you
use nvm, run nvm install and nvm use from the repository root. Keep that
pin, package.json's engine range and the lockfile's root metadata in step
when changing the runtime. CI uses npm ci --engine-strict so incompatible
dependency engines fail at installation rather than becoming warnings.
After switching Node versions, run npm ci to reinstall native dependencies
for the new Node ABI. Use the committed lockfile for ordinary setup; if it
needs regenerating, use npx npm@latest install rather than the old npm
11.3.0 that failed on Vitest's peer graph.
Angular remains on 21. A major frontend upgrade is a separate migration;
Dependabot continues to ignore Angular majors.
Licence
MIT. Contributions are accepted under the same terms.