oysterun
v1.4.8
Published
Oysterun Host installer and local service
Downloads
4,252
Readme
Oysterun
Oysterun currently has three main runtime pieces:
backend/: the Cloud API written in FastAPIhost-service/: the Host daemon that runs on the Mac minidev/client/: the local web client served by the Host service at/app
The web client does not have its own frontend server right now. The Host service serves the built HTML file directly.
Architecture In One Minute
The current product/runtime shape is:
- start the Host service
- open the web client from the Host service
- optionally connect the Host to Oysterun Cloud later
For local repo development, you can still run backend + Host together when you need the Cloud side of the stack.
In code terms:
- the backend owns users, devices, agents, onboarding, Cloud auth, and device route/access-token APIs
- the Host service owns local sessions, provider adapters, transcript/upload storage, the web client, and Host-local config
- the web client is just a Host-served frontend for interacting with the Host service
Project Layout
Oysterun/
backend/ FastAPI Cloud backend
host-service/ Local Host daemon and provider runtime bridge
dev/client/ Host-served web client source
docs/ Product, design, auth, mock, and TODO docs
local notes Gitignored working notes, reports, and ad hoc verification files
temp/ Local export output from tool_scripts/export_key_files.sh
test-results/ Playwright output
tool_scripts/ One-off local utilities
investigation-repos/ Reference repos used for research onlyFolders you can usually ignore when reading product code:
- gitignored operational notes: plans, reports, and ad hoc verification files
temp/: export bundles created bytool_scripts/export_key_files.shtest-results/: Playwright run output such as.last-run.json, traces, screenshots, and other browser-test artifactsinvestigation-repos/: external reference code, not the Oysterun runtime itself
First-Time Setup
Backend
cd <repo-root>/backend
uv sync --extra devHost Service
cd <repo-root>/host-service
npm installOptional Root Packages
The root package.json is mainly for Playwright and repo-level utilities, not for the main app runtime.
cd <repo-root>
npm installHow To Start The Project
1. Optional: start the backend for repo development
cd <repo-root>/backend
uv run python -m uvicorn app.main:app --reloadDefault local URLs:
- API root:
http://localhost:8000/ - health:
http://localhost:8000/health - FastAPI docs:
http://localhost:8000/docs
Notes:
- backend config lives in
backend/app/config.py - default DB is SQLite via
sqlite+aiosqlite:///./oysterun.db - tables are auto-created on startup in dev by
backend/app/main.py - this backend is Oysterun Cloud infrastructure code, not part of the normal Host-only v1 startup path
2. Start the Host service
cd <repo-root>/host-service
npm run setup
npm startUseful commands:
npm run setup # first-run direct Host setup
npm run setup -- --enable-cloud # optional Cloud registration
npm start # plain start, no watch mode
npm run dev # watch mode for Host JS files
npm run cli # local CLI client
npm test # Host-side testsDefault local URLs when you run npm start or npm run dev directly with the canonical home config:
- health:
http://localhost:8802/health - web client:
http://localhost:8802/app
Port notes:
- production default is
8802in~/.oysterun/config.json - staging uses
9902 - disposable test slots use
3022,3302,4022, and4402 - phone app verification can use any running Host port; point the app at the actual user-approved port for that run
- backend URL default is
http://localhost:8000 - Host config is stored in
~/.oysterun/config.json - direct mode can also store an optional
public_base_urlthere for manual client connection - fresh Session Setup runtime defaults, including interface style plus Claude/Codex provider defaults, are stored there under
session_defaults - Host Preferences shows the active config path, so
OYSTERUN_CONFIG_DIRoverrides are visible in the UI - Host now defaults to direct Host mode unless Cloud registration is explicitly enabled
Optional: start backend + Host together for repo development
For local repo development, you can launch the backend and Host together with the stack-aware foreground runner:
cd <repo-root>
./tool_scripts/dev_up.sh
./tool_scripts/dev_up.sh --stack stagingWhat it does:
- rebuilds
dev/client/web/index.html - starts the selected development backend in reload mode
- starts the selected Host in watch mode
- uses
stagingby default - syncs the stack-owned Host port before start
- stops both when you press
Ctrl-C
This is a repo development helper, not the normal product startup path and not a replacement for a real system service such as launchd.
Optional: detached start/stop/restart scripts
If you want the Host to keep running after you close the current terminal, use the background service scripts instead of tmux:
cd <repo-root>
./tool_scripts/start_oysterun.sh
./tool_scripts/stop_oysterun.sh
./tool_scripts/restart_oysterun.shConvenience wrappers are also available at:
~/Projects/start_oysterun.sh
~/Projects/stop_oysterun.sh
~/Projects/restart_oysterun.shStack-specific usage:
~/Projects/start_oysterun.sh --stack staging
~/Projects/restart_oysterun.sh --stack staging
~/Projects/stop_oysterun.sh --stack stagingWhat they do:
- rebuild the web client before Host start
- submit launchd-managed background jobs for the Host
- start the selected stack Host only
- do not initialize backend runtime state
- use
productionby default - keep production Host config under
~/.oysterun/config.json - keep staging/test Host config under
~/.oysterun-stacks/<stack>/host/config.json - write PID files under
~/.oysterun/run/or~/.oysterun-stacks/<stack>/run/ - write logs under
~/.oysterun/logs/or~/.oysterun-stacks/<stack>/logs/
Important:
- this is more convenient than
tmuxfor manual start/stop/restart - these scripts use temporary
launchctl submitjobs unless you explicitly install the persistent LaunchAgents - for persistent login-time auto-start and crash auto-restart on
8802and9902, use./tool_scripts/install_oysterun_launch_agents.sh - these scripts use stable non-watch commands; use
./tool_scripts/dev_up.shwhen you want backend + Host live auto-reload during active repo development ./tool_scripts/dev_up.shis the only startup path that initializes backend runtime state- the supported preset stacks are
production,staging,test1,test2,test3, andtest4 productionuses Host8802staginguses Host9902test1..test4use Host3022,3302,4022, and4402./tool_scripts/dev_up.shis for staging-oriented repo development and uses backend9000- set
OYSTERUN_STAGING_LAN_HOST=<your_lan_ip>if the staging stack should advertise a different LAN IP than192.168.0.188
3. Use the web client
For the default production Host, open:
http://localhost:8802/appFor staging, open:
http://localhost:9902/appThe web client is served by the Host service. There is no separate frontend dev server to start.
How To Work On The Frontend
Frontend files live here:
dev/client/web/src/index.template.htmldev/client/web/src/styles.cssdev/client/web/build-index.mjsdev/client/web/index.html
How it works:
src/index.template.htmlis the main UI sourcesrc/styles.cssis injected into the templatebuild-index.mjsgeneratesdev/client/web/index.htmlhost-service/server.mjsreadsdev/client/web/index.htmland serves it at/app
After frontend edits:
cd <repo-root>
node dev/client/web/build-index.mjsThen restart the Host service.
Why restart is needed:
- the Host service reads
dev/client/web/index.htmlat startup and keeps it in memory - rebuilding the HTML alone does not refresh the running Host process
How To Restart Things
Backend restart
If you started it with:
uv run python -m uvicorn app.main:app --reloadthen Python code changes should auto-reload.
If you need a clean restart:
- stop the process with
Ctrl-C - run the same command again
Host service restart
If you started it with:
npm run devthen Host .mjs code changes should auto-restart the service.
You still need a manual restart when:
- you rebuilt
dev/client/web/index.html - you changed non-imported static files that the watch process does not track the way you expect
Manual restart:
- stop the Host process with
Ctrl-C - run
npm run devagain
Detached service restart
If you started the Host background scripts, restart with:
~/Projects/restart_oysterun.shor:
cd <repo-root>
./tool_scripts/restart_oysterun.shFor staging:
~/Projects/restart_oysterun.sh --stack stagingFrontend restart
There is no separate frontend process.
To refresh frontend changes:
- rebuild the web client HTML
- restart the Host service
Service Structure
Backend structure
Main entry:
backend/app/main.py
Core modules:
backend/app/config.py: environment-backed settingsbackend/app/database.py: SQLAlchemy async engine and session dependencybackend/app/models/: ORM modelsbackend/app/schemas/: request/response schemasbackend/app/services/: auth, crypto, email helpersbackend/app/routers/: FastAPI route modulesbackend/tests/: backend tests
Backend router responsibilities:
routers/devices.py: device register, heartbeat, route, Host access-tokenrouters/agents.py: agent CRUD, memberships, invitesrouters/auth.py: device-link and email login flowsrouters/onboarding.py: device onboarding pages and completionrouters/sessions.py: Cloud-side session state and deprecated compatibility stubsrouters/users.py: current user and quota APIsrouters/email.py: email send endpoint
Host service structure
Main entry:
host-service/server.mjs
Core modules:
host-service/session-manager.mjs: Host-owned session lifecyclehost-service/provider-registry.mjs: provider metadata and capabilitieshost-service/adapters/claude-code-adapter.mjs: Claude runtime bridgehost-service/adapters/codex-app-server-adapter.mjs: Codex runtime bridgehost-service/agent-config.mjs:.oysterunconfig layering and workspace policyhost-service/agent-registry.mjs: Host-local agent-folder mappinghost-service/session-history.mjs: recent session summarieshost-service/upload-manager.mjs: uploaded file persistencehost-service/session-assets.mjs:~/.oysterunasset pathshost-service/jwt-auth.mjs: JWT verificationhost-service/host-authz.mjs: per-agent capability checkshost-service/folder-browser.mjs: web client folder browsinghost-service/config.mjs: Host config in~/.oysterun/config.jsonhost-service/ngrok-agent.mjs: ngrok route reportinghost-service/setup.mjs: direct-mode Host setup and optional Cloud registrationhost-service/cli.mjs: local CLI client
Web Client structure
Main files:
dev/client/web/src/index.template.html: primary UI markup and client logicdev/client/web/src/styles.css: web client stylesdev/client/web/build-index.mjs: build step for the served HTMLdev/client/web/index.html: built file served by the Host
Recommended Code Reading Order
If you are new to the repo, read in this order:
docs/_SPIRIT.mddocs/_DESIGN.mdREADME.mdbackend/app/main.pyhost-service/server.mjsdev/client/README.md- the specific service modules for the feature you are touching
Within each service, use this order:
Backend
app/main.pyapp/config.pyapp/database.pyapp/models/app/services/app/routers/backend/tests/
Host service
server.mjssession-manager.mjsprovider-registry.mjsadapters/agent-config.mjs- transcript/upload/history modules
Web Client
dev/client/README.mddev/client/web/build-index.mjsdev/client/web/src/index.template.htmldev/client/web/src/styles.css
Useful Docs
docs/_SPIRIT.md: product intent and directiondocs/_DESIGN.md: confirmed architecture and auth flowdocs/_AUTH.md: auth detailsdocs/_MOCK.md: known mock/stub behaviordocs/_TODO.md: current implementation backlog
Tests
Backend:
cd <repo-root>/backend
uv run pytestHost service:
cd <repo-root>/host-service
npm testBrowser and ad hoc verification artifacts in this repo have usually been kept as gitignored operational notes, not as a permanent full test suite under tests/.
Local Artifact Folders
temp/
temp/ is mainly used by:
tool_scripts/export_key_files.sh
That script creates export folders and zip files like:
temp/key-file-export-<timestamp>/temp/key-file-export-<timestamp>.zip
These are manual local export artifacts, not app runtime files.
test-results/
test-results/ is Playwright output.
It is recreated by Playwright runs such as:
npx playwright testIt can contain files like:
.last-run.json- traces
- screenshots
- videos
