Bento Spaces documentation
Architecture
One host, no build step
source/Bento.Api/ ASP.NET Core .NET 10 minimal API
web/ HTML + CSS + ES modules, served as-is
published/ dotnet publish output = the IIS site
There is no bundler, no npm, no transpiler. source/Bento.Api/Bento.Api.csproj copies web/** into wwwroot/ before build and publish (SyncWebAssets), so editing a .js file and refreshing the browser is the whole dev loop.
app.UseDefaultFiles()+UseStaticFiles()/api/*404s stay 404; every other path falls back toindex.html- CSP, security headers and rate limits mirror the bottlereturnpoints.com host
Runtime layout
published/ the site (never contains App_Data)
App_Data/ content root, outside wwwroot
private/ accounts, sessions, share links, view sessions
data/ spaces, layouts, widget instances, installed widgets
App_Data is resolved from the content root (override with Storage:Root) and is never served, never published and never zipped into an archive. In production point Storage:Root outside published/, because a publish replaces that folder. See Storage.
Surfaces, one document
The shelf document never changes shape between surfaces; only the renderer does.
| Surface | Chrome | Shelf |
|---|---|---|
| Desktop | brand + space dock (top centre) + account dock (top right) + spaces dock (bottom centre); a vertical space uses left/right rails | horizontal, centered |
| Paired display (32:9) | left/right rails, no top bar, no cursor | horizontal, full height |
| Square (iPad) | brand + space/account docks, spaces dock | horizontal, 2 blocks visible |
| Phone | brand + space/account docks, spaces dock; expanded space dock is full width | blocks stacked vertically, view mode by default |
unit is derived from the viewport, not stored in the document: it takes the smaller of a density cap (clamp(80, width / 18, 160)) and the fill size ((h − 96 − 3·gap) / 4 horizontally, the same from width vertically), floored at 56. A 1440×900 laptop stays at 80 px; a 2560×720 panel reaches ~142 px. A narrow viewport stacks by default; an explicit per-device orientation wins.
Edit vs view
One toggle beside the account avatar. View shows widgets and empty space; edit adds outlines, badges, gap boxes, container pluses and handles. Remembered per device. Kiosk views have no edit mode at all. See UI.
Until widgets exist (P2) the app starts in edit, because otherwise a board is blank; the default flips to view when there is something to look at.
Anonymous first, account optional
- No account: spaces metadata in
localStorage, layouts in IndexedDB; a service worker - caches the shell, so the whole app opens with no network. See 15 — PWA and offline.
- Sign in: workspaces sync; first sign-in offers to import the local ones.
- Conflicts: per-space revisions (
If-Match), 409 returns the server copy, UI offers - keep mine / keep theirs / duplicate.
Repository layout
bento/
Bento.slnx
source/Bento.Api/ .NET host
web/ front end, top level
tests/ node --test, no dependencies
published/ release (gitignored)
archive/ zipped previous releases (gitignored)
docs/ these documents
scripts/ publish.sh, backup.sh
README.md
Commands
cd source/Bento.Api && dotnet run # http://localhost:5080
node --test tests/*.test.js # model tests
node scripts/api-smoke.mjs # API smoke test (server running)
# offline check on a dev machine (the worker is off on localhost by default):
# open http://localhost:5080/?sw=1 twice, then go offline and reload
node scripts/e2e/pwa.e2e.mjs # manifest, icons, offline boot
node scripts/make-icons.mjs # regenerate the install icons
./scripts/publish.sh # build → archive → published/
./scripts/backup.sh # zip published/ into archive/
What the host owns vs the client
| Concern | Owner |
|---|---|
| Geometry rules (snap, overlap, insert, gaps, square containment) | web/src/model/geometry.js — pure, tested; the server mirrors them |
| Rendering | web/src/features/* |
| Accounts, sessions | host (App_Data/private) |
| Space + widget persistence | host, JSON files |
| Widget data with secrets | host proxy |
| Widget execution | client; sandboxed iframe for untrusted code |
| Entitlements | host (never trusted from the client) |
Geometry is duplicated nowhere. When the server validates a layout in Phase 1, it ports the same rules from geometry.js and the tests in tests/ are the specification for both.