Tightrope is an Electron desktop application backed by a native C++ runtime that provides account operations, routing control, request logging, and OpenAI compatible proxy endpoints on a local HTTP server.
- Project Scope
- Architecture
- Repository Layout
- Build Toolchain and Dependencies
- Compile and Package by Environment
- Development and Test Workflows
- Runtime API Surface
- Configuration Model
- Database Model
- Build Artifacts
- Troubleshooting
The project is designed for operators managing multiple upstream accounts from one local control plane. It combines a native runtime that serves admin and proxy routes with a desktop UI that drives that runtime through IPC and local HTTP calls.
Core capabilities include account lifecycle operations, routing policy control, sticky session continuity, request and event log inspection, firewall and API key controls, OAuth flows, and cluster sync management.
Runtime flow:
React renderer -> Electron preload bridge -> Electron main process -> tightrope-core.node -> local runtime server -> SQLite and upstream provider APIs
Key runtime defaults:
- Runtime bind host:
127.0.0.1 - Runtime bind port:
2455 - OAuth callback listener:
localhost:1455 - Default SQLite path:
store.db
The native module is loaded from release or debug output roots depending on run mode. Release builds resolve from build. Electron debug mode resolves from build-electron-debug.
| Path | Responsibility |
|---|---|
app |
Electron main process, preload bridge, React renderer, packaging scripts, UI tests |
native |
C++ runtime, server routes, auth, proxy, sync, SQLite repositories, native tests |
triplets |
vcpkg triplet definitions for macOS and Linux static builds |
vendor/opendht |
Vendored OpenDHT dependency integrated into native build graph |
build.sh |
macOS and Linux setup, build, test, and bundle entrypoint |
build.bat |
Windows setup, build, dev run, test, and packaging entrypoint |
vcpkg.json |
Native dependency manifest and pinned baseline |
| Component | Requirement |
|---|---|
| Node.js and npm | Required for Electron, TypeScript, Vite, test tooling, and cmake js orchestration |
| CMake | Version 3.21 or newer |
| C++ compiler | C++20 capable toolchain |
| Git | Required for vcpkg bootstrap and repository workflows |
| Visual Studio on Windows | Desktop development with C++ workload |
electron, react, react-dom, typescript, vite, cmake-js, electron-builder, vitest, playwright.
Managed through vcpkg.json, including NuRaft, uWebSockets, MbedTLS, Boost modules, SQLite3 with JSON1 and FTS5, SQLiteCpp, libsodium, OpenSSL, curl, libuv, lz4, glaze, quill, tomlplusplus, and Catch2.
| Host OS | Entrypoint | Native output roots | Package output |
|---|---|---|---|
| macOS | ./build.sh |
build and build-debug |
app/release via bundle-mac |
| Linux | ./build.sh |
build and build-debug |
no Linux packaging script in root helper |
| Windows | build.bat |
built through app native build flow |
app/release via bundle |
./build.sh setup
./build.sh native
./build.sh appFor native debug and native tests:
./build.sh debug
./build.sh testFor desktop bundle:
./build.sh bundle-mac./build.sh setup
./build.sh native
./build.sh appFor native debug and native tests:
./build.sh debug
./build.sh testbuild.bat setup
build.bat native
build.bat appFor desktop bundle:
build.bat bundlecd app
npm run devThis runs TypeScript watch for Electron main, Vite for renderer, and Electron boot with debug native module checks.
cd app
npm testThis runs window shape checks, unit tests with Vitest, and UI tests with Playwright.
./build.sh testThis builds build-debug with BUILD_TESTING=ON and executes tightrope-tests.
| Route | Method | Purpose |
|---|---|---|
/health |
GET |
Runtime health and uptime |
/api/runtime/proxy |
GET |
Proxy enabled state |
/api/runtime/proxy/start |
POST |
Enable proxy routing |
/api/runtime/proxy/stop |
POST |
Disable proxy routing |
| Route family | Purpose |
|---|---|
/api/settings |
Dashboard and routing settings read and update |
/api/accounts |
Account list, traffic, import, pause, reactivate, pin, unpin, delete, usage refresh |
/api/accounts/import/sqlite/* |
SQLite preview and apply import flow |
/api/accounts/traffic/ws |
Realtime account traffic stream |
/api/logs |
Request and runtime log retrieval |
/api/sessions |
Sticky session inspection |
/api/firewall/ips |
Firewall allowlist CRUD |
/api/api-keys |
API key CRUD, regenerate, limit policy lifecycle |
/api/oauth/* and /auth/callback |
OAuth start, status, stop, restart, complete, manual callback |
| Route | Transport | Purpose |
|---|---|---|
/api/models, /v1/models, /backend-api/codex/models |
HTTP | Model listing |
/v1/responses, /backend-api/codex/responses |
HTTP, SSE, WebSocket | Responses API proxy |
/v1/responses/compact, /backend-api/codex/responses/compact |
HTTP | Compact response path |
/v1/chat/completions |
HTTP and SSE | Chat completions proxy |
/v1/audio/transcriptions, /backend-api/transcribe |
HTTP | Transcription proxy |
/v1/memories/trace_summarize, /backend-api/codex/memories/trace_summarize |
HTTP | Memory summarize pass-through |
/api/codex/usage |
HTTP | Codex usage endpoint |
Configuration is resolved in this order:
- Internal defaults in native config structures
- TOML file loaded from
TIGHTROPE_CONFIG_PATHor explicit bridge config path - Environment variables
- Bridge init overrides passed from Electron main process
Supported base config fields include host, port, db_path, config_path, log_level, sticky_ttl_ms, and sticky_cleanup_interval_ms, plus nested TOML sections for server, database, logging, and proxy values.
Example config.toml:
host = "127.0.0.1"
port = 2455
db_path = "store.db"
log_level = "info"
sticky_ttl_ms = 1800000
sticky_cleanup_interval_ms = 60000
[database]
path = "store.db"
[logging]
level = "info"
[proxy]
sticky_ttl_ms = 1800000
sticky_cleanup_interval_ms = 60000| Variable | Default | Effect |
|---|---|---|
TIGHTROPE_HOST |
127.0.0.1 |
Runtime host bind |
TIGHTROPE_PORT |
2455 |
Runtime port bind |
TIGHTROPE_DB_PATH |
store.db |
SQLite database path |
TIGHTROPE_CONFIG_PATH |
unset | TOML config location |
TIGHTROPE_LOG_LEVEL |
info |
Runtime logging level |
TIGHTROPE_STICKY_TTL_MS |
1800000 |
Sticky session ttl in ms |
TIGHTROPE_STICKY_CLEANUP_INTERVAL_MS |
60000 |
Sticky session cleanup cadence |
| Variable | Default | Effect |
|---|---|---|
TIGHTROPE_UPSTREAM_BASE_URL |
https://chatgpt.com/backend-api |
Upstream proxy base URL |
TIGHTROPE_UPSTREAM_CONNECT_TIMEOUT_MS |
10000 |
Upstream connect timeout |
TIGHTROPE_UPSTREAM_TIMEOUT_MS |
120000 |
Upstream request timeout |
TIGHTROPE_UPSTREAM_BRIDGE_POLL_TIMEOUT_MS |
1000 |
WebSocket bridge read poll timeout |
TIGHTROPE_UPSTREAM_ENABLE_REQUEST_COMPRESSION |
false |
Enables zstd request compression when available |
TIGHTROPE_CODEX_CLIENT_VERSION |
1.0.0 |
Version query for codex models endpoint |
TIGHTROPE_AUTH_BASE_URL |
https://auth.openai.com |
OAuth auth host |
TIGHTROPE_OAUTH_CLIENT_ID |
project default | OAuth client id |
TIGHTROPE_OAUTH_REDIRECT_URI |
http://localhost:1455/auth/callback |
OAuth callback URI |
TIGHTROPE_OAUTH_SCOPE |
openid profile email plus offline_access |
OAuth scope list |
TIGHTROPE_OAUTH_TIMEOUT_SECONDS |
30 |
OAuth request timeout |
| Variable | Effect |
|---|---|
TIGHTROPE_TOKEN_ENCRYPTION_KEY_HEX |
Direct encryption key material |
TIGHTROPE_TOKEN_ENCRYPTION_KEY_FILE |
Encrypted key file path |
TIGHTROPE_TOKEN_ENCRYPTION_KEY_FILE_PASSPHRASE |
Passphrase for key file decrypt |
TIGHTROPE_TOKEN_ENCRYPTION_REQUIRE_ENCRYPTED_AT_REST |
Disallow plaintext token storage |
TIGHTROPE_TOKEN_ENCRYPTION_MIGRATE_PLAINTEXT_ON_READ |
Re-encrypt plaintext token rows on read |
Sync and cluster tuning supports a large variable surface for probe cadence, lag alerting, wire budgets, dead peer policies, TLS material, and journal compaction. Start with settings endpoints and sync UI fields, then apply environment overrides only for host specific tuning.
SQLite is the primary store. The runtime opens the configured path in read write create mode with WAL enabled and a busy timeout. On first initialization, baseline schema creation is run from native/migrations/001_baseline.sql.
| Table | Purpose |
|---|---|
schema_version |
Migration version tracking |
accounts |
Account identities and token payload storage |
usage_history |
Token and cost usage snapshots |
additional_usage_history |
Additional quota keys and usage metrics |
request_logs |
Request level runtime log records |
sticky_sessions |
Session to account affinity for routing |
proxy_sticky_sessions |
Proxy continuity session mapping |
dashboard_settings |
Runtime and UI control state |
api_firewall_allowlist |
Firewall allowlist entries |
api_keys |
API key metadata and status |
api_key_limits |
Per key policy limits |
api_key_usage_reservations |
Reservation lifecycle for usage accounting |
api_key_usage_reservation_items |
Metric rows for reservations |
Sync metadata tables for replication journal and tombstones are also managed by sync schema logic.
The admin API exposes preview and apply routes for importing accounts from external SQLite sources. The flow is explicit and staged to avoid blind overwrite behavior.
| Path | Produced by | Notes |
|---|---|---|
build/tightrope-core.node |
build.sh native or release native build |
Release native module candidate |
build-debug/tightrope-tests |
build.sh debug with testing enabled |
Native test binary |
build-electron-debug |
npm run ensure:native:debug |
Debug native module path for Electron dev |
app/dist |
npm run build:main and npm run build:renderer |
Compiled Electron main and renderer output |
app/native/tightrope-core.node |
npm run stage:native |
Staged native module for packaging |
app/release |
npm run bundle:mac or npm run bundle:win |
Desktop package output |
Run ./build.sh native or cd app && npm run ensure:native:release and verify a tightrope-core.node exists in build or build-electron-debug depending on mode.
Check for port conflicts on 2455 and verify no stale process is already bound. Confirm config or environment does not set an invalid host or port.
Verify TIGHTROPE_DB_PATH points to a writable location and that the process has file permissions for database and WAL files.
Confirm callback host and port values align with configured redirect URI and that local firewall rules allow loopback callback traffic.