From e68d5d11221d6d6dbb7c87584a951ef99b753bf5 Mon Sep 17 00:00:00 2001 From: RobbyAJM Date: Sat, 5 Dec 2026 21:50:55 +0700 Subject: [PATCH 1/4] docs: position API Lab as a fast, lightweight Rust-native API client Rewrite the README around measured installer sizes, native Rust networking and a dated comparison with Postman, Insomnia, Bruno and Hoppscotch. Drop the unverifiable "5-7 MB RAM" and "100% offline" claims in favour of reproducible measurements and an accurate self-hosted description. Add llms.txt, per-competitor comparison pages, gRPC, FIX, Postman-migration, performance and self-hosting guides, a Postgres docker-compose.yml that applies the schema on first start, and CONTRIBUTING and SECURITY policies. Sync desktop version to 0.1.209. Co-Authored-By: Claude Opus 5.5 --- CONTRIBUTING.md | 54 ++++++ README.md | 190 ++++++++++++++++----- SECURITY.md | 20 +++ apps/desktop/src-tauri/tauri.conf.json | 2 +- docker-compose.yml | 34 ++++ docs/README.md | 25 +++ docs/comparisons/bruno-alternative.md | 45 +++++ docs/comparisons/hoppscotch-alternative.md | 40 +++++ docs/comparisons/insomnia-alternative.md | 46 +++++ docs/comparisons/postman-alternative.md | 54 ++++++ docs/fix-protocol-client.md | 41 +++++ docs/grpc-client.md | 32 ++++ docs/migrating-from-postman.md | 87 ++++++++++ docs/performance.md | 57 +++++++ docs/self-hosting.md | 96 +++++++++++ llms.txt | 39 +++++ 16 files changed, 815 insertions(+), 47 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 SECURITY.md create mode 100644 docker-compose.yml create mode 100644 docs/README.md create mode 100644 docs/comparisons/bruno-alternative.md create mode 100644 docs/comparisons/hoppscotch-alternative.md create mode 100644 docs/comparisons/insomnia-alternative.md create mode 100644 docs/comparisons/postman-alternative.md create mode 100644 docs/fix-protocol-client.md create mode 100644 docs/grpc-client.md create mode 100644 docs/migrating-from-postman.md create mode 100644 docs/performance.md create mode 100644 docs/self-hosting.md create mode 100644 llms.txt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a6e4600 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,54 @@ +# Contributing to API Lab + +Thanks for helping make API Lab a fast, lightweight, Rust-native API client. Bug reports, feature requests, docs fixes and pull requests are all welcome. + +## Reporting issues + +- **Bugs:** include your OS, the API Lab version (Settings → Updates), steps to reproduce, and what you expected. Settings → Diagnostics shows where the log files are and can produce a diagnostics report. Check either one for secrets before attaching it. +- **Feature requests:** describe the workflow you're trying to do, not only the UI you have in mind. +- **Security issues:** don't open a public issue. Follow [SECURITY.md](SECURITY.md). + +## Development setup + +Follow [Build from source](README.md#build-from-source) in the README. In short: `docker compose up -d`, `pnpm install`, `cargo run -p api-lab-server`, then `pnpm --filter @api-lab/desktop tauri dev`. + +Repository layout: + +| Path | What lives there | +|---|---| +| `apps/desktop` | React 18 + TypeScript UI (Vite, Tailwind CSS, Zustand, TanStack Query) | +| `apps/desktop/src-tauri` | Tauri v2 Rust runner: HTTP, gRPC and FIX execution | +| `apps/server` | Axum + SQLx sync server | +| `packages/rust-core` | Shared Rust models, crypto and variable engine | +| `packages/grpc-client` | Tonic reflection gRPC client | +| `packages/fix-client` | FIX framing, session state, stunnel config | +| `packages/api-types` | Shared TypeScript types | +| `migrations` | PostgreSQL schema. New migrations must be safe to re-run (`IF NOT EXISTS`, etc.) | + +## Before you open a pull request + +```bash +pnpm run test:ts # frontend unit tests +cargo test --workspace # Rust tests (needs the database from docker compose) +pnpm run lint:design # design-quality rules for the UI +pnpm run version:sync # keep the desktop version in step with the latest release tag +``` + +- Keep logic in small, standalone functions with unit tests, so behaviour can be tested without launching the app. +- Rust: no `.unwrap()` in production paths, `thiserror` in packages and `anyhow` in apps, and never hold a lock across `.await`. +- UI: follow [DESIGN.md](DESIGN.md) and [PRODUCT.md](PRODUCT.md). The UI is dense and keyboard-first, with 1px hairlines, no nested cards, no decorative gradients and no thick side borders. +- Use [Conventional Commits](https://www.conventionalcommits.org/) style for commit and pull request titles, e.g. `feat(grpc): …`, `fix(fix): …`, `docs: …`. Release notes are generated from pull request titles. + +## Keeping the docs honest + +When you add or change a user-visible feature, also update: + +- the feature list and the comparison table in [README.md](README.md) +- [llms.txt](llms.txt), the summary AI assistants read +- any affected guide in [docs/](docs/README.md), including the "Not yet supported" notes + +Numbers such as installer sizes and memory use must come from a real measurement. Update [docs/performance.md](docs/performance.md) with the method if you change them. + +## License + +By contributing you agree that your contributions are dual-licensed under [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), the same as the project. diff --git a/README.md b/README.md index 987ddd3..276340c 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,169 @@

- API Lab Logo + API Lab logo

API Lab

- High-density, keyboard-driven API, gRPC & FIX workbench for desktop.
- Native Rust direct sockets, dynamic reflection gRPC, live FIX sessions, and encrypted workspace sync. + A fast, lightweight, Rust-native API client for HTTP/REST, gRPC and FIX.
+ Open-source, self-hosted alternative to Postman, Insomnia, Bruno and Hoppscotch, with a 7.9 MB Windows installer.

+ Latest release License MIT or Apache 2.0 + Built with Rust Tauri v2 - Rust - React 18 Platforms

- API Lab Screenshot + Download · + Compare · + Performance · + Self-host · + Docs

-## Why API Lab? +

+ API Lab desktop API client: collection sidebar, HTTP request editor with headers and JSON body, and response viewer in a dark high-density layout +

+ +**API Lab** is a free, open-source desktop API client and API testing workbench written in Rust with Tauri v2. It sends HTTP/REST, gRPC and FIX 4.2/4.4 traffic from native Rust networking code rather than from a bundled browser engine. gRPC covers server reflection and all four streaming modes. You can write Postman-style `pm.*` test scripts, chain requests across protocols in a visual workflow builder, and sync workspaces in real time through a server you host yourself. It runs on Windows, macOS and Linux. + +## Why API Lab: fast, lightweight, Rust-native + +### Small download, no bundled browser + +API Lab uses the operating system's built-in WebView (WebView2 on Windows, WebKit on macOS and Linux) instead of shipping Chromium and Node.js like Electron apps do. The whole app downloads in seconds: + +| API client (latest release) | Built with | Windows installer | macOS installer | Linux `.deb` | +|---|---|---|---|---| +| **API Lab 0.1.209** | **Rust + Tauri v2** | **7.9 MB** (`.exe`) · 10.3 MB (`.msi`) | **23.0 MB** (universal `.dmg`) | **12.1 MB** | +| Hoppscotch Desktop 26.11.1 | Tauri | 45.4 MB (`.msi`) | 46.7 MB (Apple silicon `.dmg`) | 47.4 MB | +| Bruno 4.4.0 | Electron | 143.0 MB (`.exe`) · 150.5 MB (`.msi`) | 174.8 MB (Apple silicon `.dmg`) | 134.1 MB | +| Insomnia 13.5.0 | Electron | 548.8 MB (NSIS `.exe`) | 386.9 MB (`.dmg`) | 463.6 MB | + +Sizes as shown on each project's GitHub Releases page, December 2026. Postman does not publish installers on GitHub. Method and memory measurements: [docs/performance.md](docs/performance.md). + +### Rust from the socket to the server + +- **Requests run in Rust, not in the UI.** HTTP uses `reqwest` with `rustls`, gRPC uses `tonic` with `prost-reflect`, and FIX uses a dedicated Rust session engine (`packages/fix-client`), all on the `tokio` async runtime. No JavaScript sits in the request path, and no browser CORS rules, proxy or browser extension apply. +- **Small native core.** The Rust host process uses about 13 MB of private memory on Windows 11. The UI renders in a separate system WebView; see [performance](docs/performance.md) for full numbers. +- **The server is Rust too.** Workspace sync is one Axum + SQLx binary in front of PostgreSQL. It needs no Node.js, Java or container orchestration. +- **Keyboard-first.** `Ctrl+Enter` sends, `Ctrl+S` saves, `Ctrl+K` searches endpoints, `Ctrl+P` opens the command palette, `Ctrl+E` switches environments and `Ctrl+B` toggles the sidebar. The flat, high-density layout keeps payloads on screen instead of padding. + +### Things other API clients don't do + +- **FIX protocol sessions** (FIX 4.2/4.4) next to HTTP and gRPC, with stunnel TLS transport. None of Postman, Insomnia, Bruno or Hoppscotch speaks FIX. +- **Reflection and OpenAPI folders that stay in sync.** A gRPC reflection folder or a Swagger/OpenAPI folder mirrors the service's schema, shows a diff of changed endpoints and payloads, and reconciles them on demand. +- **One workflow, three protocols.** A single visual workflow can log on to a FIX session, call a gRPC stream and assert on an HTTP response. + +## Features + +### HTTP / REST client +GET, POST, PUT, PATCH, DELETE, HEAD and OPTIONS. Path variables (`:id`), a query editor that stays in sync with the URL, and JSON, text, form-urlencoded, multipart and binary bodies. Auth can be Bearer, Basic, a custom header (API key), or inherited from the folder or collection. Paste a cURL command to create a request. + +### gRPC client with server reflection +Discovers services through gRPC Server Reflection (`grpc.reflection.v1alpha`), with no `.proto` files to manage. Supports unary, server-streaming, client-streaming and bidirectional calls, dynamic Protobuf ↔ JSON transcoding, metadata, deadlines and TLS detection. Sample payloads understand well-known types and enums. More: [docs/grpc-client.md](docs/grpc-client.md). + +### FIX protocol client (FIX 4.2 / 4.4) +Runs an initiator session with Logon, Heartbeat, Test Request, Logout and sequence validation. A dictionary-backed message builder and raw editor sit alongside a grouped transcript with clickable tag and enum references. Connects over direct TCP or through a managed or external stunnel. More: [docs/fix-protocol-client.md](docs/fix-protocol-client.md). + +### OpenAPI / Swagger sync +Point a folder at an OpenAPI 3.x or Swagger 2.0 JSON spec to generate endpoints with sample payloads. Re-sync to see a diff of changes. Field and enum autofill comes from the spec while you type JSON or multipart bodies. + +### Visual API workflows +A canvas for chaining requests across protocols. Nodes include HTTP request, gRPC unary, gRPC stream, FIX session, FIX send, evaluate (script), condition, transform, assert, loop, file and display. Runs are recorded with a step-by-step console, and teammates can edit the same canvas live. -| | | -|---|---| -| 🪶 **Ultra-lightweight footprint** | Client idles at **5–7 MB RAM** (vs 300 MB+ in Electron-based tools). Minimal installer size with zero bundled Chromium or Node.js bloat. | -| ⚡ **Built for fast-paced work** | Zero delayed transition animations, instant tab and collection switches, and rapid response parsing. Never waits on UI sluggishness. | -| 🦀 **Direct native sockets** | HTTP, gRPC, and FIX execute over native Rust sockets (`reqwest`, `tonic`, and a dedicated FIX engine). No browser sandbox constraints, no CORS limits, and minimal overhead. | -| 📡 **Dynamic gRPC reflection** | Auto-discovers services via `grpc.reflection.v1alpha`. Protobuf transcoding happens on the wire with zero manual `.proto` files needed. | -| 📑 **Swagger & OpenAPI sync folders** | Dedicated sync folders mirror OpenAPI 3.x and Swagger schemas like gRPC reflection. Auto-generates sample payloads and reconciles endpoint changes on demand. | -| 🔒 **Encrypted & local-first** | Multi-tier environment variables encrypted at rest with AES-256-GCM. 100% functional offline with optional self-hosted realtime sync. | -| ⌨️ **High-density workbench** | 1px hairline mineral dark layout, flush command bar, tab dirty-state tracking, and keyboard navigation (`Ctrl+K`, `Ctrl+E`, `Ctrl+Enter`). | +### Postman-style scripting and tests +Pre-request and post-response JavaScript with the familiar `pm.test`, `pm.expect`, `pm.environment`, `pm.variables`, `pm.request` and `pm.response` API, for both HTTP and gRPC. Supported calls are listed in [docs/migrating-from-postman.md](docs/migrating-from-postman.md). -## Protocol Support +### Environments and secrets +Workspace environments with Shared values plus per-user Local values. Sensitive values are masked, and environment variables are encrypted at rest on the server with AES-256-GCM. Variables are highlighted and resolved inline, including in gRPC addresses and spec base URLs. -| Protocol | Capabilities | -|---|---| -| **HTTP / REST** | GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS · Path vars (`:id`) · Query editor · Bearer/Basic/Inherited auth · Multipart/Form/JSON payloads · Script hooks | -| **gRPC** | Server Reflection v1alpha · Unary · Server/Client/Bidirectional streaming · Protobuf dynamic transcoding · Deadlines · Metadata · TLS detection | -| **FIX** | FIX 4.2/4.4 initiator · Logon/heartbeat/Test Request/Logout · Dictionary-backed grouped transcript with clickable tag/enum reference · Sequence validation · Direct TCP · Managed/external stunnel | +### Real-time team collaboration, self-hosted +Shared workspaces with invitation codes and live presence: you can see who is online and jump to the tab a teammate has open. Save conflicts are detected and resolved with a diff, and notifications are pushed over WebSocket. Everything is stored on a server you run. There is no API Lab cloud and no vendor account. -Managed stunnel mode requires a `stunnel` executable on `PATH`, or an explicit executable path in the FIX transport settings. External stunnel mode connects to a local listener that you configure and run separately. +### Workbench +Tabs that persist across restarts, unsaved-change tracking, light and dark themes, UI zoom, and signed automatic updates from GitHub Releases. -## Quick Start +## API Lab vs Postman, Insomnia, Bruno and Hoppscotch -1. **Configure environment:** - ```bash - cp .env.example .env - ``` +| | **API Lab** | Postman | Insomnia | Bruno | Hoppscotch | +|---|---|---|---|---|---| +| License | **MIT / Apache-2.0** | Proprietary | Apache-2.0 | MIT | MIT | +| Desktop runtime | **Rust + Tauri v2** | Electron | Electron | Electron | Tauri | +| Windows installer | **7.9 MB** | n/a | 548.8 MB | 143.0 MB | 45.4 MB | +| HTTP / REST | ✅ | ✅ | ✅ | ✅ | ✅ | +| gRPC (incl. streaming) | ✅ | ✅ | ✅ | ✅ | ❌ | +| gRPC server reflection | ✅ | ✅ | ✅ | ✅ | ❌ | +| FIX protocol (4.2/4.4) | ✅ | ❌ | ❌ | ❌ | ❌ | +| Visual workflow builder | ✅ (HTTP + gRPC + FIX) | ✅ (Flows) | ❌ | ❌ | ❌ | +| GraphQL | ❌ | ✅ | ✅ | ✅ | ✅ | +| WebSocket requests | ❌ | ✅ | ✅ | ✅ | ✅ | +| Where your data lives | Your own server | Postman cloud (local only when signed out) | Local vault, Git or Kong cloud | Files in your Git repo | Browser or self-hosted instance | +| Team sync without a vendor cloud | ✅ Self-hosted server | ❌ | Git-based | Git-based | ✅ Self-hosted instance | -2. **Prepare PostgreSQL 14+** (`DATABASE_URL` in `.env`). The sync server applies migrations automatically on startup. +Competitor capabilities are taken from each vendor's documentation and GitHub releases as of December 2026. Spotted something outdated? Please [open an issue](https://github.com/RobbyAJM/api-lab/issues). -3. **Install dependencies:** - ```bash - pnpm install - ``` +Detailed comparisons: [Postman](docs/comparisons/postman-alternative.md) · [Insomnia](docs/comparisons/insomnia-alternative.md) · [Bruno](docs/comparisons/bruno-alternative.md) · [Hoppscotch](docs/comparisons/hoppscotch-alternative.md) -4. **Start backend sync server:** - ```bash - cargo run -p api-lab-server - ``` +## Install -5. **Launch desktop app:** - ```bash - pnpm --filter @api-lab/desktop tauri dev - ``` +1. **Download the desktop app** from [GitHub Releases](https://github.com/RobbyAJM/api-lab/releases/latest): + - **Windows:** `x64-setup.exe` or `.msi` + - **macOS:** universal `.dmg` (Apple silicon and Intel) + - **Linux:** `.deb`, `.rpm` or `.AppImage` -## Repository Structure + After that, the app updates itself. +2. **Run the sync server** where you keep your data: a laptop, a VM or a team server. See [docs/self-hosting.md](docs/self-hosting.md). +3. **Sign in.** On the sign-in screen, set the server address (for example `http://localhost:8080`) and create an account on your server. + +## FAQ + +### Is API Lab a free alternative to Postman? +Yes. API Lab is free and open source under MIT or Apache-2.0. It covers the core Postman workflow of collections, environments, scripted tests, gRPC and request chaining. It adds FIX protocol support and stores your data on your own server instead of a vendor cloud. + +### Why is API Lab so much smaller than Postman, Insomnia or Bruno? +Those apps are built on Electron, which bundles a full copy of Chromium and Node.js into every install. API Lab is built on Tauri with a Rust core. It uses the WebView already on your OS, and all networking is compiled Rust. + +### Is API Lab faster? +Requests are sent by compiled Rust code on the `tokio` async runtime, not by JavaScript inside a browser engine, and nothing passes through a proxy or browser extension. The UI has no artificial loading screens, and every core action has a keyboard shortcut. + +### Can I reuse my Postman test scripts? +Mostly. The common `pm.*` calls (`pm.test`, `pm.expect`, `pm.environment`, `pm.variables`, `pm.request`, `pm.response`) work in HTTP and gRPC scripts. See [what is supported](docs/migrating-from-postman.md). + +### Can I import a Postman, Insomnia or Bruno collection? +Not yet. You can paste cURL commands, which Postman and browser DevTools can both export. You can also generate a whole collection from an OpenAPI/Swagger spec or a gRPC reflection endpoint. + +### Does API Lab work offline? +Your requests go straight from your machine to your APIs. Collections and environments are stored on the sync server, so the app needs that server to be reachable. It can run on `localhost` on the same machine. + +### Does API Lab support gRPC server reflection and streaming? +Yes. It uses `grpc.reflection.v1alpha` to discover services and supports unary, server-streaming, client-streaming and bidirectional streaming calls. + +### Can I test FIX sessions over TLS? +Yes. FIX sessions connect over direct TCP, through an stunnel process API Lab manages, or through an external stunnel listener you already run. + +### Does it support GraphQL or WebSocket requests? +Not yet. API Lab focuses on HTTP/REST, gRPC and FIX. + +## Build from source + +Requires Rust (stable), Node.js with pnpm, and Docker (or PostgreSQL 14+). + +```bash +cp .env.example .env # then set your own ENV_ENCRYPTION_KEY +docker compose up -d # PostgreSQL with the schema applied +pnpm install +cargo run -p api-lab-server # sync server on :8080 +pnpm --filter @api-lab/desktop tauri dev +``` + +The server's SQL queries are checked at compile time, so the database must be running before `cargo` builds the server. See [docs/self-hosting.md](docs/self-hosting.md) for production setup and upgrades. + +## Repository structure ```text api-lab/ @@ -80,13 +176,16 @@ api-lab/ │ ├── grpc-client/ # Tonic reflection gRPC caller │ ├── fix-client/ # FIX framing, initiator session state, stunnel config │ └── api-types/ # Generated TypeScript definitions -└── docs/ # Static docs & assets +├── migrations/ # PostgreSQL schema (applied automatically on server start) +└── docs/ # Guides, comparisons and assets ``` -## Contributors +## Contributing + +Issues and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md). Report security issues privately as described in [SECURITY.md](SECURITY.md). - API Lab Contributors + API Lab contributors ## Third-party notices @@ -96,4 +195,3 @@ Bundled FIX 4.2 and FIX 4.4 dictionary data includes QuickFIX/FIX Repository str ## License Dual-licensed under [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE) at your option. - diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..044a443 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,20 @@ +# Security policy + +## Supported versions + +Security fixes go into the latest release. The desktop app updates itself from [GitHub Releases](https://github.com/RobbyAJM/api-lab/releases). Self-hosted servers should be upgraded by following [docs/self-hosting.md](docs/self-hosting.md#upgrading). + +## Reporting a vulnerability + +Please report vulnerabilities privately. Don't open a public issue. + +1. Go to the repository's **Security** tab and choose **Report a vulnerability**. This opens a private advisory that only the maintainers can see. +2. If that option isn't available, open an issue that says only that you have a security report and need a private contact. Don't include any details. + +Please include the affected component (desktop app, sync server or a package), the version, reproduction steps, and the impact you see. We aim to acknowledge reports within a few days and will credit you in the advisory unless you prefer otherwise. + +## Scope notes for self-hosters + +- **`ENV_ENCRYPTION_KEY`** encrypts environment variables at rest with AES-256-GCM. Generate your own key: the value in `.env.example` is public, and the server uses it when the variable is unset. +- The sync server speaks plain HTTP. Put it behind a TLS-terminating reverse proxy before exposing it beyond `localhost`. +- Keep PostgreSQL off the public network. The bundled `docker-compose.yml` binds it to `127.0.0.1`. diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index 225eb57..cd835af 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "API Lab", - "version": "0.1.206", + "version": "0.1.209", "identifier": "com.apilab.desktop", "build": { "beforeDevCommand": "pnpm dev", diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e02ece9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +# PostgreSQL for the API Lab sync server. +# +# docker compose up -d +# +# On first start the schema in ./migrations is applied, so the server's +# compile-time-checked SQL queries build on a fresh machine. The server applies +# the same migrations again on startup; they are written to be safe to re-run. +# +# The defaults match .env.example. If you change the credentials or the host +# port, update DATABASE_URL in .env to match. See docs/self-hosting.md. +name: api-lab + +services: + db: + image: postgres:16 + restart: unless-stopped + environment: + POSTGRES_USER: ${POSTGRES_USER:-root} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-root} + POSTGRES_DB: ${POSTGRES_DB:-api_lab} + ports: + # Bound to localhost only; the sync server is the only client. + - "127.0.0.1:${POSTGRES_PORT:-5432}:5432" + volumes: + - api-lab-db:/var/lib/postgresql/data + - ./migrations:/docker-entrypoint-initdb.d:ro + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] + interval: 2s + timeout: 5s + retries: 15 + +volumes: + api-lab-db: diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..e9b65da --- /dev/null +++ b/docs/README.md @@ -0,0 +1,25 @@ +# API Lab documentation + +API Lab is a fast, lightweight, Rust-native desktop API client for HTTP/REST, gRPC and FIX. These guides cover what it does, how it compares, and how to run it. + +## Guides + +- [Performance](performance.md): installer sizes against other API clients, memory measurements, and how to reproduce them +- [gRPC client](grpc-client.md): server reflection, streaming, reflection folders that stay in sync +- [FIX protocol client](fix-protocol-client.md): FIX 4.2/4.4 sessions, stunnel TLS, message builder and transcript +- [Migrating from Postman](migrating-from-postman.md): the supported `pm.*` scripting API and how to bring requests over +- [Self-hosting](self-hosting.md): running the sync server with PostgreSQL, upgrades and team setup + +## Comparisons + +- [API Lab vs Postman](comparisons/postman-alternative.md) +- [API Lab vs Insomnia](comparisons/insomnia-alternative.md) +- [API Lab vs Bruno](comparisons/bruno-alternative.md) +- [API Lab vs Hoppscotch](comparisons/hoppscotch-alternative.md) + +## Project + +- [README](../README.md): overview, feature list, FAQ +- [Contributing](../CONTRIBUTING.md) +- [Security policy](../SECURITY.md) +- [Releases and downloads](https://github.com/RobbyAJM/api-lab/releases) diff --git a/docs/comparisons/bruno-alternative.md b/docs/comparisons/bruno-alternative.md new file mode 100644 index 0000000..96b4760 --- /dev/null +++ b/docs/comparisons/bruno-alternative.md @@ -0,0 +1,45 @@ +# API Lab vs Bruno: a Rust-native alternative to Bruno + +**In short:** Bruno and API Lab are both open-source, privacy-minded API clients. Bruno is an Electron app that stores collections as plain files in your Git repository. API Lab is a Rust + Tauri app, about 18× smaller to download (7.9 MB vs 143.0 MB on Windows), that syncs workspaces in real time through a server you host. API Lab adds FIX protocol sessions and a visual multi-protocol workflow builder. Bruno adds GraphQL, WebSocket, a CLI and Git-native files. + +## When API Lab is the better fit + +- **You want the lightest client.** Bruno 4.4.0 installers are 107–181 MB because Electron bundles Chromium and Node.js. API Lab's `.exe`, `.msi`, `.dmg`, `.deb` and `.rpm` installers are 7.9–23.0 MB. See [performance](../performance.md). +- **Your team wants live collaboration rather than Git merges.** API Lab shows who is online, lets you jump to a teammate's tab, edits workflows together in real time and resolves save conflicts with a diff. +- **You test FIX alongside HTTP and gRPC.** Bruno has no FIX support. +- **You chain requests visually.** API Lab's workflow canvas links HTTP, gRPC and FIX steps with loops, conditions, assertions and recorded runs. +- **You keep gRPC and OpenAPI collections in sync with live services.** Reflection and Swagger folders show diffs and reconcile changes. +- **Your scripts are written in Postman style.** API Lab runs `pm.test`, `pm.expect`, `pm.environment` and related calls directly. + +## When to stay with Bruno + +- You want collections as files in Git, reviewed in pull requests, with no server to run. +- You need GraphQL or WebSocket requests. +- You run collections in CI with the Bruno CLI. API Lab has no CLI runner yet. +- You want to work fully offline with no server process at all. + +## Feature comparison + +| | API Lab | Bruno | +|---|---|---| +| License | MIT / Apache-2.0 | MIT | +| Desktop runtime | Rust + Tauri v2 | Electron | +| Windows installer | 7.9 MB | 143.0 MB (4.4.0) | +| HTTP / REST | ✅ | ✅ | +| gRPC with server reflection | ✅ | ✅ | +| gRPC streaming | ✅ All four modes | ✅ All four modes | +| FIX protocol 4.2 / 4.4 | ✅ | ❌ | +| GraphQL / WebSocket | ❌ | ✅ | +| Storage | Self-hosted sync server (PostgreSQL) | Plain files in your filesystem or Git | +| Real-time collaboration | ✅ | Through Git | +| Visual workflow builder | ✅ | ❌ | +| Script API | Postman-style `pm.*` | Bruno scripting API | +| CLI runner | ❌ | ✅ | + +Bruno details from Bruno's documentation and the Bruno 4.4.0 GitHub release, December 2026. + +## FAQ + +**Bruno is already open source and offline. Why switch?** Switch if download size, a native Rust core, live team collaboration, FIX support or a visual workflow builder matter more to you than Git-stored files. + +**Does API Lab store collections in Git?** No. Collections are stored on your own API Lab sync server and pushed to teammates in real time. diff --git a/docs/comparisons/hoppscotch-alternative.md b/docs/comparisons/hoppscotch-alternative.md new file mode 100644 index 0000000..55a66c7 --- /dev/null +++ b/docs/comparisons/hoppscotch-alternative.md @@ -0,0 +1,40 @@ +# API Lab vs Hoppscotch: a gRPC- and FIX-capable alternative + +**In short:** Hoppscotch and API Lab are both open-source, both offer self-hosting, and both have Tauri desktop apps. API Lab's desktop installer is about a sixth the size (7.9 MB vs 45.4 MB on Windows). API Lab adds gRPC with server reflection and streaming, FIX protocol sessions, a visual multi-protocol workflow builder, and native Rust networking for every request. Hoppscotch adds a browser-based client, GraphQL and real-time protocols such as WebSocket, SSE, Socket.IO and MQTT. + +## When API Lab is the better fit + +- **You need gRPC.** API Lab discovers services through server reflection, runs unary and all streaming modes, and keeps reflection folders in sync with diffs. Hoppscotch's documentation lists no gRPC support. +- **You need FIX.** API Lab runs FIX 4.2/4.4 initiator sessions over TCP or stunnel. +- **You want the smallest desktop download and Rust networking.** HTTP, gRPC and FIX are sent by API Lab's Rust core, with no browser `fetch`, CORS proxy or browser extension. See [performance](../performance.md). +- **You chain requests across protocols.** API Lab's workflow canvas links HTTP, gRPC and FIX steps with loops, conditions and assertions. + +## When to stay with Hoppscotch + +- You want an API client in the browser with nothing to install. +- You need GraphQL, WebSocket, SSE, Socket.IO or MQTT. +- You want a self-hosted deployment with ready-made Docker images. + +## Feature comparison + +| | API Lab | Hoppscotch | +|---|---|---| +| License | MIT / Apache-2.0 | MIT | +| Clients | Desktop (Windows, macOS, Linux) | Web, desktop, CLI | +| Desktop runtime | Rust + Tauri v2 | Tauri | +| Windows installer | 7.9 MB | 45.4 MB (26.11.1) | +| HTTP / REST | ✅ | ✅ | +| gRPC with server reflection | ✅ | ❌ | +| FIX protocol 4.2 / 4.4 | ✅ | ❌ | +| GraphQL / real-time protocols | ❌ | ✅ | +| Visual workflow builder | ✅ | ❌ | +| Self-hosted sync | ✅ Rust server + PostgreSQL | ✅ Community Edition | +| Script API | Postman-style `pm.*` | Hoppscotch scripting API | + +Hoppscotch details from Hoppscotch's documentation and GitHub releases, December 2026. + +## FAQ + +**Both use Tauri, so why is API Lab smaller?** Both use the system WebView. Hoppscotch's desktop app is built on top of its full web client. API Lab ships one purpose-built desktop UI and keeps request execution in its Rust core (`reqwest`, `tonic` and a FIX engine). + +**Can I self-host API Lab like Hoppscotch?** Yes. The sync server is a single Rust binary backed by PostgreSQL. See [self-hosting](../self-hosting.md). diff --git a/docs/comparisons/insomnia-alternative.md b/docs/comparisons/insomnia-alternative.md new file mode 100644 index 0000000..d4cfd3c --- /dev/null +++ b/docs/comparisons/insomnia-alternative.md @@ -0,0 +1,46 @@ +# API Lab vs Insomnia: a lightweight, open-source Insomnia alternative + +**In short:** Both are open-source desktop API clients with gRPC support. API Lab is written in Rust with Tauri and ships a 7.9 MB Windows installer, against Insomnia's 548.8 MB Electron installer. It adds FIX protocol sessions, OpenAPI and gRPC folders that stay in sync, a visual multi-protocol workflow builder, and real-time collaboration on a server you host. Insomnia supports more request types (GraphQL, WebSocket, SSE) and has the `inso` CLI. + +## When API Lab is the better fit + +- **You want a small, fast native app.** API Lab uses the system WebView and a Rust core. Insomnia is Electron-based; its 13.5.0 installers are 387–646 MB. See [performance](../performance.md). +- **You want live team collaboration without a vendor cloud.** API Lab syncs workspaces in real time through your own server, with presence, invitation codes and save-conflict diffs. +- **You chain requests visually.** API Lab's workflow canvas links HTTP, gRPC and FIX steps with loops, conditions, assertions and run history. +- **Your gRPC schemas change often.** Reflection folders show a diff of changed services and payloads and reconcile them on demand. +- **You need FIX.** Insomnia has no FIX protocol support. + +## When to stay with Insomnia + +- You need GraphQL, WebSocket or Server-Sent Events requests. +- You want collections stored as files in Git (Insomnia Git Sync) rather than on a sync server. +- You run tests in CI with `inso`. API Lab has no CLI runner yet. +- You use Insomnia's design-first OpenAPI editor or its Kong integrations. + +## Feature comparison + +| | API Lab | Insomnia | +|---|---|---| +| License | MIT / Apache-2.0 | Apache-2.0 | +| Desktop runtime | Rust + Tauri v2 | Electron | +| Windows installer | 7.9 MB | 548.8 MB (13.5.0, NSIS) | +| HTTP / REST | ✅ | ✅ | +| gRPC with server reflection | ✅ | ✅ | +| gRPC streaming | ✅ All four modes | ✅ | +| FIX protocol 4.2 / 4.4 | ✅ | ❌ | +| GraphQL / WebSocket / SSE | ❌ | ✅ | +| Test scripts | Postman-style `pm.*` | Insomnia scripting API | +| Visual workflow builder | ✅ | ❌ | +| Storage | Your self-hosted server | Local vault, Git Sync or Kong cloud | +| Real-time collaboration | ✅ Self-hosted | Through Git or Kong cloud | +| CLI runner | ❌ | ✅ `inso` | + +Insomnia details from Kong's documentation and the Insomnia 13.5.0 GitHub release, December 2026. + +## FAQ + +**Is API Lab open source like Insomnia?** Yes, under MIT or Apache-2.0 at your option. + +**Why is API Lab's installer so much smaller?** Insomnia bundles Electron (Chromium and Node.js). API Lab uses the WebView already installed with your operating system and compiles its networking to native Rust. + +**Can I bring my Insomnia requests over?** Export them as cURL and paste them into API Lab, or regenerate them from an OpenAPI spec or gRPC reflection. Importing Insomnia collections directly isn't supported yet. diff --git a/docs/comparisons/postman-alternative.md b/docs/comparisons/postman-alternative.md new file mode 100644 index 0000000..b1fd664 --- /dev/null +++ b/docs/comparisons/postman-alternative.md @@ -0,0 +1,54 @@ +# API Lab vs Postman: a lightweight, open-source Postman alternative + +**In short:** API Lab is a free, open-source desktop API client written in Rust. It covers the core Postman workflow of collections, environments, `pm.*` test scripts, gRPC and chained requests, in a 7.9 MB installer. Your data stays on a server you host. It also speaks the FIX protocol, which Postman does not. Postman remains the broader platform, with GraphQL, WebSocket, mock servers, monitors and a large public API network. + +## When API Lab is the better fit + +- **You want a fast, small native app.** API Lab is built with Rust and Tauri and uses the OS WebView. Postman is an Electron app that bundles Chromium and Node.js. See [performance](../performance.md) for installer sizes and memory numbers. +- **Your data has to stay on your infrastructure.** API Lab workspaces live on a sync server you run (one Rust binary plus PostgreSQL). Postman's collaboration features run in Postman's cloud. +- **You work with gRPC every day.** API Lab discovers services through server reflection, supports all four streaming modes, and keeps a reflection folder in sync with the server, showing a diff whenever services change. +- **You test trading or financial systems.** API Lab runs FIX 4.2/4.4 initiator sessions next to your HTTP and gRPC requests, and can chain all three in one workflow. +- **You want open source.** API Lab is MIT / Apache-2.0. Postman is proprietary. + +## When to stay with Postman + +- You need GraphQL, WebSocket, SSE or MQTT requests. API Lab doesn't support them yet. +- You rely on mock servers, monitors, API documentation publishing or the public API network. +- You run collections in CI with Newman or the Postman CLI. API Lab has no CLI runner yet. +- You need to import existing Postman collections in one step. API Lab can't import them yet (see [migrating](../migrating-from-postman.md)). + +## Feature comparison + +| | API Lab | Postman | +|---|---|---| +| License | MIT / Apache-2.0 | Proprietary | +| Desktop runtime | Rust + Tauri v2 (system WebView) | Electron (bundled Chromium + Node.js) | +| Windows installer | 7.9 MB | Not published on GitHub | +| HTTP / REST | ✅ | ✅ | +| gRPC with server reflection | ✅ | ✅ | +| gRPC streaming (server, client, bidi) | ✅ | ✅ | +| FIX protocol 4.2 / 4.4 | ✅ | ❌ | +| GraphQL / WebSocket | ❌ | ✅ | +| Test scripts | `pm.*` subset | Full `pm.*` sandbox | +| Visual workflows | ✅ Across HTTP, gRPC and FIX | ✅ Postman Flows | +| OpenAPI / Swagger | Sync folders with diffs and autofill | Import and spec editing | +| Where data is stored | Your self-hosted server | Postman cloud (local only in the signed-out lightweight client) | +| Real-time collaboration | ✅ On your server | ✅ In Postman cloud | +| CLI runner for CI | ❌ | ✅ Newman / Postman CLI | + +Postman details from Postman's documentation, December 2026. + +## Moving from Postman + +1. Copy each request as cURL from Postman's code snippet panel and paste it into a new API Lab tab. +2. For APIs with an OpenAPI or Swagger spec, create a Swagger sync folder to generate every endpoint at once. +3. For gRPC services, create a reflection folder from the server address. +4. Copy your scripts over. `pm.test`, `pm.expect`, `pm.environment`, `pm.variables`, `pm.request` and `pm.response` work as you'd expect. Check the [supported API](../migrating-from-postman.md) for gaps. + +## FAQ + +**Is API Lab free?** Yes. It is open source under MIT or Apache-2.0, with no paid tier and no seat limits. + +**Does API Lab need a Postman-style account?** You create an account on your own API Lab server, not with a vendor. + +**Is API Lab faster than Postman?** API Lab's requests are sent by compiled Rust code (`reqwest`, `tonic`) rather than from inside an Electron app, and the app downloads at about 8 MB. We publish measured sizes and memory use in [performance](../performance.md), and you can reproduce them. diff --git a/docs/fix-protocol-client.md b/docs/fix-protocol-client.md new file mode 100644 index 0000000..0158076 --- /dev/null +++ b/docs/fix-protocol-client.md @@ -0,0 +1,41 @@ +# FIX protocol client (FIX 4.2 / 4.4) + +API Lab is one of the few general-purpose API clients that speaks the **FIX protocol** (Financial Information eXchange). You can open a FIX initiator session, build and send messages, and read a decoded transcript in the same desktop app you use for HTTP and gRPC. The FIX engine is written in Rust (`packages/fix-client`) and runs natively, with no Java or QuickFIX installation required. + +Postman, Insomnia, Bruno and Hoppscotch have no FIX support. + +## Sessions + +- **Versions:** FIX 4.2 and FIX 4.4 (`BeginString` `FIX.4.2` / `FIX.4.4`). +- **Role:** initiator. API Lab connects to your acceptor, such as an exchange simulator, broker UAT or in-house gateway. +- **Session settings:** `SenderCompID`, `TargetCompID`, heartbeat interval, `Username` / `Password` on Logon, and an option to reset sequence numbers on Logon. +- **Administrative flow:** Logon, Heartbeat, Test Request and Logout are handled for you, with sequence-number validation. +- **Secrets:** passwords and other sensitive values are masked in the UI until you reveal them. + +## Transport + +| Mode | Use it when | +|---|---| +| **Direct TCP** | The acceptor accepts plain TCP, for example a local simulator or a private network. | +| **Managed stunnel** | The acceptor needs TLS. API Lab starts and stops `stunnel` for you, with CA file, client certificate and key (mutual TLS), and peer verification. Requires `stunnel` on `PATH` or an explicit executable path. | +| **External stunnel** | You already run your own `stunnel` (or another TLS tunnel). API Lab connects to its local listener. | + +## Building messages + +- **Dictionary-backed message builder.** Choose a message type and fill fields by name, with enum values offered from the bundled FIX 4.2/4.4 dictionaries. +- **Raw editor.** Write tag=value messages directly, with syntax highlighting, hover tooltips for tags and enums, and a multiline view. +- **Variables.** Use `{{VARIABLES}}` from the active environment, for example for account IDs or credentials. + +## Reading the transcript + +Every inbound and outbound message is shown in a grouped inspector that decodes tags to field names and enum values to their meanings. You can click any tag or enum for its dictionary reference, and switch between newest-first and oldest-first order. + +## FIX in workflows + +The workflow builder has **FIX session** and **FIX send** nodes, so you can script an end-to-end scenario. For example: fetch a token over HTTP, look up an instrument over gRPC, then open a FIX session and send a `NewOrderSingle` built from those values. Inbound replies appear in the session transcript. + +## Who uses this + +Teams who build or test trading systems, broker connectivity, order management systems and exchange gateways. It also suits anyone who needs a quick, visual FIX test session without writing a QuickFIX application. + +Bundled dictionary data includes QuickFIX/FIX Repository structure and Apache-2.0 FIX Orchestra descriptions; see [THIRD_PARTY_NOTICES.md](../THIRD_PARTY_NOTICES.md). diff --git a/docs/grpc-client.md b/docs/grpc-client.md new file mode 100644 index 0000000..7e474fc --- /dev/null +++ b/docs/grpc-client.md @@ -0,0 +1,32 @@ +# gRPC client with server reflection + +API Lab is a desktop gRPC client (a GUI alternative to `grpcurl`, grpcui, BloomRPC and Kreya) built on Rust's `tonic` and `prost-reflect`. It discovers services through gRPC Server Reflection, so there are no `.proto` files to import or keep up to date. It sits in the same app as your HTTP and FIX requests. + +## What you get + +- **Server reflection discovery.** API Lab uses `grpc.reflection.v1alpha` to list services, methods and message schemas from a running server. +- **All four call types.** Unary, server streaming, client streaming and bidirectional streaming. Streamed messages appear as they arrive. +- **Dynamic Protobuf ↔ JSON.** You write the request as JSON and API Lab encodes it to Protobuf on the wire with `prost-reflect`. Responses are decoded back to JSON. +- **Sample payloads.** Request bodies are generated from the schema, including well-known types (`Timestamp`, `Duration`, wrappers) and enum values. While you type, enum values are offered as autofill. +- **Specification tab.** Browse each method's request and response message fields and types. +- **Metadata, auth and deadlines.** Send custom metadata, use Bearer or custom-header auth (or inherit it from the folder), and set a deadline after which the call is cancelled. +- **TLS.** TLS is chosen from the address (`https://`, `grpcs://` or port 443), or you can set it explicitly. +- **Variables.** Server addresses and payloads accept `{{VARIABLES}}` from the active environment, highlighted and resolved inline. +- **Scripts.** Pre-request and post-response scripts can read and change `pm.request.metadata` and `pm.request.payload`, and test `pm.response`. See [migrating from Postman](migrating-from-postman.md). + +## Reflection folders that stay in sync + +Create a **reflection folder** from a server address. API Lab creates one endpoint per method, nested by service name. When the server's services change, re-sync the folder: API Lab shows a diff of added, removed and changed methods and payloads, and lets you apply them in one step. Every endpoint inherits the folder's server address, so you change it once to move between local, staging and production. + +## gRPC in workflows + +The visual workflow builder has **gRPC unary** and **gRPC stream** nodes. You can feed a gRPC response into an HTTP call or a FIX message, loop over results, and assert on fields. Runs are recorded with a step-by-step console. + +## Why a native Rust gRPC client + +gRPC calls are made by `tonic` running on `tokio` in the app's Rust core, not by a browser runtime, so there is no gRPC-Web proxy and no Node.js process. The whole app installs in 7.9 MB on Windows (see [performance](performance.md)). + +## Requirements and limits + +- The server must have [gRPC Server Reflection](https://grpc.io/docs/guides/reflection/) enabled. Importing `.proto` files isn't supported yet. +- gRPC-Web endpoints are not supported. API Lab speaks native gRPC over HTTP/2. diff --git a/docs/migrating-from-postman.md b/docs/migrating-from-postman.md new file mode 100644 index 0000000..2cbc315 --- /dev/null +++ b/docs/migrating-from-postman.md @@ -0,0 +1,87 @@ +# Migrating from Postman to API Lab + +API Lab runs Postman-style `pm.*` scripts, so most pre-request and test scripts work after copy-paste. This page lists exactly what is supported and how to bring your requests over. + +## Bring your requests over + +Importing Postman collection files isn't supported yet. These are the quickest routes today: + +| You have | Do this in API Lab | +|---|---| +| Individual requests | Copy the request as cURL from Postman's code snippet panel and paste it into a new tab. Method, URL, headers, body and auth are filled in. | +| An OpenAPI 3.x or Swagger 2.0 spec | Create a **Swagger sync folder** from the spec URL. Every endpoint is generated with sample payloads, and later spec changes appear as a diff. | +| A gRPC service with reflection | Create a **reflection folder** from the server address. Every method is generated. | +| Environments | Create an environment and use **bulk edit** to paste `KEY=value` lines. | + +## Scripts: what's supported + +Scripts are JavaScript and can use `async`/`await`. They run before the request (pre-request) and after the response (post-response) for both HTTP and gRPC. + +### `pm.environment` and `pm.variables` + +| Call | Supported | +|---|---| +| `get(key)`, `set(key, value)`, `has(key)`, `toObject()` | ✅ | +| `unset(key)`, `clear()`, `replaceIn(text)` | ❌ | + +Values set by a script are saved to **your Local value** in the active environment, never to the Shared value. A login script can't overwrite a token your teammates rely on. + +`pm.globals` and `pm.collectionVariables` are not available. Use environment variables instead. + +### `pm.request` + +| HTTP | gRPC | +|---|---| +| `url`, `method`, `body`, `body_type`, `query_params` | `server_address`, `service`, `method`, `payload` | +| `headers` as an object, or `headers.get(name)`, `headers.set(name, value)`, `headers.add(name, value)` | `metadata` as an object, or `metadata.get(name)`, `metadata.set(name, value)` | + +Header lookups with `get()` ignore case. + +### `pm.response` + +| Property | Supported | +|---|---| +| `code`, `status`, `responseTime`, `headers` (plain object; gRPC metadata for gRPC) | ✅ | +| `json()`, `text()` | ✅ | +| `pm.response.to.have.status(...)`, `pm.response.to.be.ok` | ❌ Use `pm.expect(pm.response.code).to.equal(200)` | + +### `pm.test` and `pm.expect` + +`pm.test(name, fn)` works with synchronous and `async` functions. A test that makes no assertions is reported as a warning rather than a pass. + +| Assertion | Supported | +|---|---| +| `.to.equal(x)`, `.to.be.equal(x)` (strict `===`) | ✅ | +| `.to.be.above(n)`, `.to.be.below(n)` | ✅ | +| `.to.be.a(type)`, `.to.be.an(type)` (`'array'` is recognised) | ✅ | +| `.to.include(x)` for strings and arrays | ✅ | +| `.to.be.true()`, `.to.be.false()` | ✅ Write them **with parentheses** | +| `.to.eql()` (deep equal), `.to.have.property()`, `.not`, `.to.be.oneOf()` | ❌ | + +Example: + +```js +const data = pm.response.json(); + +pm.test("Status code is 200", () => { + pm.expect(pm.response.code).to.equal(200); +}); + +pm.test("Returns a token", () => { + pm.expect(data.token).to.be.a("string"); +}); + +pm.environment.set("AUTH_TOKEN", data.token); +``` + +### Other APIs + +`console.log`, `console.warn` and `console.error` write to the script log. These are not available: `pm.sendRequest`, `pm.cookies`, `pm.iterationData`, `pm.info`, `pm.visualizer`, `postman.setNextRequest` and `require()`. Use the [workflow builder](../README.md#visual-api-workflows) to chain requests instead of `pm.sendRequest` / `setNextRequest`. + +## What you gain by switching + +- A 7.9 MB native Rust app instead of an Electron one ([performance](performance.md)). +- Your collections on your own server, with real-time collaboration and no vendor account ([self-hosting](self-hosting.md)). +- gRPC reflection folders that diff and sync, plus FIX 4.2/4.4 sessions ([gRPC](grpc-client.md), [FIX](fix-protocol-client.md)). + +Full comparison: [API Lab vs Postman](comparisons/postman-alternative.md). diff --git a/docs/performance.md b/docs/performance.md new file mode 100644 index 0000000..0448136 --- /dev/null +++ b/docs/performance.md @@ -0,0 +1,57 @@ +# API Lab performance: installer size and memory + +API Lab is a Rust + Tauri v2 desktop API client. It does not bundle Chromium or Node.js. The UI renders in the operating system's WebView (WebView2 on Windows, WebKit on macOS and Linux), and HTTP, gRPC and FIX traffic is handled by compiled Rust code. This page records how that shows up in numbers and how to reproduce them. + +## Installer size + +Sizes as shown on each project's GitHub Releases page (MB = 1,048,576 bytes), checked in December 2026. + +| API client | Version | Built with | Windows | macOS | Linux | +|---|---|---|---|---|---| +| **API Lab** | 0.1.209 | Rust + Tauri v2 | **7.9 MB** `.exe` · 10.3 MB `.msi` | **23.0 MB** universal `.dmg` | **12.1 MB** `.deb` · 12.1 MB `.rpm` · 86.2 MB `.AppImage` | +| Hoppscotch Desktop | 26.11.1 | Tauri | 45.4 MB `.msi` | 46.7 MB (arm64) · 47.4 MB (x64) `.dmg` | 47.4 MB `.deb` · 113.8 MB `.AppImage` | +| Bruno | 4.4.0 | Electron | 143.0 MB `.exe` · 150.5 MB `.msi` | 174.8 MB (arm64) · 180.5 MB (x64) `.dmg` | 134.1 MB `.deb` · 111.4 MB `.rpm` · 166.7 MB `.AppImage` | +| Insomnia | 13.5.0 | Electron | 548.8 MB NSIS `.exe` · 644.0 MB `.exe` | 386.9 MB `.dmg` | 463.6 MB `.deb` · 397.6 MB `.rpm` · 646.1 MB `.AppImage` | + +Postman does not publish its installers on GitHub, so it is not listed. + +The Windows installer for API Lab is about 18× smaller than Bruno's and about 69× smaller than Insomnia's. The Linux `.AppImage` is larger than the `.deb` because it bundles the WebKitGTK libraries that `.deb` and `.rpm` installs take from the system. + +## Memory use + +Measured on Windows 11 with the installed API Lab 0.1.209 release, after 24 minutes of normal use with a workspace open. + +| Process | Private memory | Working set | +|---|---|---| +| `api-lab-desktop.exe` (Rust core: networking, FIX engine, crypto) | 12.8 MB | 47.4 MB | +| `msedgewebview2.exe` × 6 (system WebView2 running the UI) | 254.6 MB | 501.6 MB | +| **Total** | **267.4 MB** | 549.0 MB | + +Private memory is the fairer total, because working set counts pages shared between WebView2 processes more than once. The Rust core itself is small. Most of the footprint is the system WebView rendering the UI, and Windows shares its runtime with other apps that use WebView2. + +### Reproduce it + +Run this in PowerShell while the app is open. Change `-Name` to measure another client the same way, for example `Postman`, `Insomnia` or `Bruno`. Electron apps start several child processes, and the script includes all of them. + +```powershell +function Measure-ProcessTreeMemory([string]$Name) { + $all = Get-CimInstance Win32_Process + function Get-Children($id) { foreach ($c in $all | Where-Object ParentProcessId -eq $id) { $c; Get-Children $c.ProcessId } } + $root = Get-Process -Name $Name | Select-Object -First 1 + $ids = @($root.Id) + @(Get-Children $root.Id | ForEach-Object ProcessId) + $rows = foreach ($id in $ids) { Get-Process -Id $id -ErrorAction SilentlyContinue } + $rows | Select-Object ProcessName, + @{ n = 'Private_MB'; e = { [math]::Round($_.PrivateMemorySize64 / 1MB, 1) } }, + @{ n = 'WorkingSet_MB'; e = { [math]::Round($_.WorkingSet64 / 1MB, 1) } } | Format-Table -AutoSize + 'Total private MB: {0:N1}' -f (($rows | Measure-Object PrivateMemorySize64 -Sum).Sum / 1MB) +} +Measure-ProcessTreeMemory -Name 'api-lab-desktop' +``` + +## Why requests are fast + +- **Native networking.** HTTP runs on `reqwest` with `rustls`, gRPC on `tonic` with `prost-reflect` for dynamic Protobuf, and FIX on API Lab's own Rust session engine. All of them run on the `tokio` async runtime. +- **Nothing in between.** Requests do not pass through a browser `fetch`, a CORS proxy, a browser extension or a Node.js process. The UI sends a command to the Rust core and gets the result back. +- **No Electron start-up cost.** No second browser engine or Node.js runtime has to load before the window appears. + +Have a measurement from another OS or another client? Open an issue or a pull request to add it here. diff --git a/docs/self-hosting.md b/docs/self-hosting.md new file mode 100644 index 0000000..f7aab1e --- /dev/null +++ b/docs/self-hosting.md @@ -0,0 +1,96 @@ +# Self-hosting the API Lab sync server + +API Lab has no vendor cloud. Workspaces, collections, environments and workflows are stored on a sync server that you run: a single Rust (Axum + SQLx) binary backed by PostgreSQL. Run it on your own machine for solo use, or on a VM or team server to collaborate in real time. + +```text +API Lab desktop ──HTTP + WebSocket──▶ api-lab-server (Rust) ──▶ PostgreSQL + │ + └──── your API requests (HTTP, gRPC, FIX) go directly from the desktop app to your services +``` + +The sync server never proxies your API traffic. It only stores and syncs workspace data. + +## Requirements + +- Rust (stable) to build the server +- PostgreSQL 14 or newer, or Docker to run the bundled `docker-compose.yml` + +## 1. Configure + +```bash +git clone https://github.com/RobbyAJM/api-lab.git +cd api-lab +cp .env.example .env +``` + +| Variable | Purpose | Default | +|---|---|---| +| `PORT` | HTTP and WebSocket port | `8080` | +| `DATABASE_URL` | PostgreSQL connection string | `postgres://root:root@localhost:5432/api_lab?sslmode=disable` | +| `ENV_ENCRYPTION_KEY` | 64 hex characters (32 bytes) used to encrypt environment variables at rest with AES-256-GCM | **Change it** | +| `RUST_LOG` | Log filter | `info,api_lab=debug` | + +> [!IMPORTANT] +> Generate your own `ENV_ENCRYPTION_KEY` before first use. The value in `.env.example` is public, and the server uses it when the variable is unset. Keep the key safe: if it is lost, encrypted environment values can't be read. + +Generate a key with either: + +```bash +openssl rand -hex 32 +``` + +```powershell +$b = New-Object byte[] 32; [Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($b); -join ($b | ForEach-Object { $_.ToString('x2') }) +``` + +## 2. Start PostgreSQL + +```bash +docker compose up -d +``` + +This starts PostgreSQL 16 on `127.0.0.1:5432` and applies the schema in `migrations/` when the database is first created. The schema has to exist before the server is compiled, because the server's SQL queries are checked against it at compile time. + +If port 5432 is taken, set `POSTGRES_PORT` (for example `POSTGRES_PORT=5433 docker compose up -d`) and change the port in `DATABASE_URL`. To change the credentials, set `POSTGRES_USER` / `POSTGRES_PASSWORD` / `POSTGRES_DB` before the first start, and match `DATABASE_URL`. + +**Using your own PostgreSQL instead:** create a database, then apply every file in `migrations/` in name order with `psql -v ON_ERROR_STOP=1 -f ` before building. + +## 3. Build and run the server + +```bash +cargo build --release -p api-lab-server +./target/release/api-lab-server # on Windows: .\target\release\api-lab-server.exe +``` + +Run it from the repository root so it picks up `.env`, or provide the variables through your process manager (systemd, a Windows service, etc.). The server listens on `0.0.0.0:$PORT` and applies any pending migrations on startup. + +## 4. Connect the desktop app + +1. Install API Lab from [GitHub Releases](https://github.com/RobbyAJM/api-lab/releases/latest). +2. On the sign-in screen, set the **server address**, for example `http://localhost:8080` or `https://api-lab.example.com`. +3. Create an account, then create a workspace and invite teammates with an invitation code. + +## Running it for a team + +- **Put TLS in front.** The server speaks plain HTTP. Use a reverse proxy that supports WebSockets. For example, with [Caddy](https://caddyserver.com/), which provisions HTTPS automatically: + + ```text + api-lab.example.com { + reverse_proxy 127.0.0.1:8080 + } + ``` + +- **Keep PostgreSQL private.** The bundled compose file binds it to `127.0.0.1` only. +- **Back up** the database with `pg_dump`, and store `ENV_ENCRYPTION_KEY` separately from the backups. + +## Upgrading + +```bash +git pull +# Apply new migrations first; the build checks queries against the schema +docker compose exec db sh -c 'for f in /docker-entrypoint-initdb.d/*.sql; do psql -v ON_ERROR_STOP=1 -q -U "$POSTGRES_USER" -d "$POSTGRES_DB" -f "$f"; done' +cargo build --release -p api-lab-server +# then restart api-lab-server +``` + +Re-applying migrations that already ran is safe. The command works the same in bash and PowerShell. Desktop apps update themselves from GitHub Releases. diff --git a/llms.txt b/llms.txt new file mode 100644 index 0000000..1f071b3 --- /dev/null +++ b/llms.txt @@ -0,0 +1,39 @@ +# API Lab + +> API Lab is a free, open-source (MIT / Apache-2.0) desktop API client for HTTP/REST, gRPC and FIX, written in Rust with Tauri v2. It is a fast, lightweight, self-hosted alternative to Postman, Insomnia, Bruno and Hoppscotch: the Windows installer is 7.9 MB, requests are sent by native Rust code, and workspaces sync through a server you run yourself. + +Key facts: + +- Platforms: Windows (x64 `.exe` / `.msi`), macOS (universal `.dmg`), Linux (`.deb`, `.rpm`, `.AppImage`). Signed automatic updates from GitHub Releases. +- Size: 7.9 MB Windows installer, 23.0 MB macOS universal `.dmg`, 12.1 MB Linux `.deb` (v0.1.209). It uses the OS WebView instead of bundling Chromium or Node.js like Electron-based clients. +- Rust-native networking: HTTP via `reqwest` + `rustls`, gRPC via `tonic` + `prost-reflect`, FIX via a dedicated Rust session engine, all on `tokio`. No CORS proxy or browser extension is needed. +- HTTP/REST: all common methods, path variables, query editor, JSON / text / form-urlencoded / multipart / binary bodies, Bearer / Basic / API-key header / inherited auth, cURL paste import. +- gRPC: server reflection (`grpc.reflection.v1alpha`) with no `.proto` files needed, unary plus server, client and bidirectional streaming, metadata, deadlines, TLS. +- FIX: FIX 4.2 and 4.4 initiator sessions (Logon, Heartbeat, Test Request, Logout, sequence validation), dictionary-backed message builder and transcript, direct TCP or stunnel TLS. Postman, Insomnia, Bruno and Hoppscotch have no FIX support. +- OpenAPI 3.x and Swagger 2.0 sync folders with change diffs, plus spec-aware field and enum autofill. +- Visual workflow builder that chains HTTP, gRPC and FIX steps with loops, conditions, transforms, scripts and assertions, and records run history. +- Postman-style scripting: `pm.test`, `pm.expect`, `pm.environment`, `pm.variables`, `pm.request`, `pm.response` in pre-request and post-response scripts for HTTP and gRPC. +- Team collaboration: shared workspaces, invitation codes, live presence, a collaborative workflow canvas and save-conflict diffs. Data lives on a self-hosted Rust (Axum + SQLx) server with PostgreSQL. Environment variables are encrypted at rest with AES-256-GCM. There is no vendor cloud or vendor account. +- Not supported yet: GraphQL, WebSocket/SSE requests, importing Postman/Insomnia/Bruno collections, a CLI test runner, and use without a sync server. + +## Docs + +- [README](https://github.com/RobbyAJM/api-lab/blob/main/README.md): overview, features, comparison table, FAQ +- [Performance](https://github.com/RobbyAJM/api-lab/blob/main/docs/performance.md): installer sizes against other clients, memory measurements, how to reproduce +- [gRPC client](https://github.com/RobbyAJM/api-lab/blob/main/docs/grpc-client.md): server reflection, streaming, reflection-synced folders +- [FIX protocol client](https://github.com/RobbyAJM/api-lab/blob/main/docs/fix-protocol-client.md): FIX 4.2/4.4 sessions, stunnel, message builder +- [Migrating from Postman](https://github.com/RobbyAJM/api-lab/blob/main/docs/migrating-from-postman.md): supported `pm.*` scripting API and how to bring requests over +- [Self-hosting](https://github.com/RobbyAJM/api-lab/blob/main/docs/self-hosting.md): running the sync server with PostgreSQL + +## Comparisons + +- [API Lab vs Postman](https://github.com/RobbyAJM/api-lab/blob/main/docs/comparisons/postman-alternative.md) +- [API Lab vs Insomnia](https://github.com/RobbyAJM/api-lab/blob/main/docs/comparisons/insomnia-alternative.md) +- [API Lab vs Bruno](https://github.com/RobbyAJM/api-lab/blob/main/docs/comparisons/bruno-alternative.md) +- [API Lab vs Hoppscotch](https://github.com/RobbyAJM/api-lab/blob/main/docs/comparisons/hoppscotch-alternative.md) + +## Optional + +- [Releases and downloads](https://github.com/RobbyAJM/api-lab/releases) +- [Source code](https://github.com/RobbyAJM/api-lab) +- [License](https://github.com/RobbyAJM/api-lab/blob/main/LICENSE) From f1209941545bb27c49e1877f8dfae1095f89ab00 Mon Sep 17 00:00:00 2001 From: RobbyAJM Date: Sat, 5 Dec 2026 21:54:58 +0700 Subject: [PATCH 2/4] fix(scripts): make pm.expect property assertions actually assert Postman/Chai scripts write `pm.expect(x).to.be.true;` as a property. Our sandbox exposed `true`/`false` as functions and counted the assertion as soon as pm.expect() was called, so the property form never evaluated and pm.test reported a pass (e.g. `pm.expect(false).to.be.true;` was green). - Extract `createExpectation()`: Chai-style chain where `.true`/`.false` are getters that assert on access and return a no-op, so `.true()` still works. - Count assertions when they are evaluated, not when pm.expect() is called; an unsupported assertion now yields a "zero assertions" warning instead of a silent pass. - Add `.not`, `.eql()` / `.deep.equal()`, `.have.property(name[, value])`, `.oneOf()`, object-subset `.include()`, and `pm.response.to.have.status()`. - Tests for property/call forms, negation, deep equality, property, status. Co-Authored-By: Claude Opus 5.5 --- apps/desktop/src/utils/hookRunner.test.ts | 140 +++++++++++ apps/desktop/src/utils/hookRunner.ts | 272 ++++++++++++++++++---- 2 files changed, 361 insertions(+), 51 deletions(-) diff --git a/apps/desktop/src/utils/hookRunner.test.ts b/apps/desktop/src/utils/hookRunner.test.ts index 9158e3c..487ed61 100644 --- a/apps/desktop/src/utils/hookRunner.test.ts +++ b/apps/desktop/src/utils/hookRunner.test.ts @@ -3,6 +3,8 @@ import assert from 'node:assert/strict'; import { runBeforeHook, runAfterHook, + createExpectation, + deepEqual, type HttpRequestContext, type HttpResponseContext, type GrpcRequestContext, @@ -307,3 +309,141 @@ test('Before & After Hooks separate pm.environment.set (environmentUpdates) from assert.deepEqual(postRes.environmentUpdates, { PERSIST_TOKEN: 'tok-env' }); assert.deepEqual(postRes.localUpdates, { TEMP_TOKEN: 'tok-local' }); }); + +// --------------------------------------------------------------------------- +// Chai-compatible pm.expect / pm.response.to assertions +// --------------------------------------------------------------------------- + +async function runTests(script: string, res?: Partial) { + const req: HttpRequestContext = { url: 'https://api.example.com/x', method: 'GET', headers: {} }; + const response: HttpResponseContext = { + status_code: 200, + status_text: 'OK', + headers: {}, + body: '{}', + ...res, + }; + const result = await runAfterHook(script, req, response, {}); + assert.equal(result.error, undefined); + return result.tests; +} + +test('pm.expect: property-form to.be.true fails on false (no silent pass)', async () => { + const tests = await runTests(`pm.test("t", () => { pm.expect(false).to.be.true; });`); + assert.equal(tests.length, 1); + assert.equal(tests[0].status, 'fail'); + assert.equal(tests[0].passed, false); + assert.match(tests[0].error ?? '', /to be true/); +}); + +test('pm.expect: property-form to.be.false fails on true', async () => { + const tests = await runTests(`pm.test("t", () => { pm.expect(true).to.be.false; });`); + assert.equal(tests[0].status, 'fail'); +}); + +test('pm.expect: property-form to.be.true / to.be.false pass on matching values', async () => { + const tests = await runTests(` + pm.test("true", () => { pm.expect(true).to.be.true; }); + pm.test("false", () => { pm.expect(false).to.be.false; }); + `); + assert.deepEqual(tests.map((t) => t.status), ['pass', 'pass']); +}); + +test('pm.expect: call-form to.be.true() / to.be.false() still works', async () => { + const tests = await runTests(` + pm.test("true ok", () => { pm.expect(true).to.be.true(); }); + pm.test("false ok", () => { pm.expect(false).to.be.false(); }); + pm.test("true bad", () => { pm.expect(1).to.be.true(); }); + pm.test("false bad", () => { pm.expect(0).to.be.false(); }); + `); + assert.deepEqual(tests.map((t) => t.status), ['pass', 'pass', 'fail', 'fail']); +}); + +test('pm.expect: unsupported assertion counts as zero assertions, not a pass', async () => { + const tests = await runTests(`pm.test("t", () => { pm.expect(false).to.be.somethingUnknown; });`); + assert.equal(tests[0].status, 'warn'); + assert.equal(tests[0].warning, 'zero assertions'); +}); + +test('pm.expect: .not negates assertions', async () => { + const tests = await runTests(` + pm.test("not equal ok", () => { pm.expect(1).to.not.equal(2); }); + pm.test("not equal bad", () => { pm.expect(1).to.not.equal(1); }); + pm.test("not true ok", () => { pm.expect(false).to.not.be.true; }); + pm.test("not true bad", () => { pm.expect(true).to.not.be.true; }); + pm.test("not include ok", () => { pm.expect("abc").to.not.include("z"); }); + pm.test("not property ok", () => { pm.expect({ a: 1 }).to.not.have.property("b"); }); + `); + assert.deepEqual(tests.map((t) => t.status), ['pass', 'fail', 'pass', 'fail', 'pass', 'pass']); +}); + +test('pm.expect: to.eql and to.deep.equal compare deeply', async () => { + const tests = await runTests(` + pm.test("eql ok", () => { pm.expect({ a: [1, { b: 2 }] }).to.eql({ a: [1, { b: 2 }] }); }); + pm.test("eql bad", () => { pm.expect({ a: [1, 2] }).to.eql({ a: [1, 3] }); }); + pm.test("eql extra key", () => { pm.expect({ a: 1, b: 2 }).to.eql({ a: 1 }); }); + pm.test("deep.equal ok", () => { pm.expect([1, 2]).to.deep.equal([1, 2]); }); + pm.test("strict equal on objects fails", () => { pm.expect([1, 2]).to.equal([1, 2]); }); + pm.test("not eql ok", () => { pm.expect({ a: 1 }).to.not.eql({ a: 2 }); }); + `); + assert.deepEqual(tests.map((t) => t.status), ['pass', 'fail', 'fail', 'pass', 'fail', 'pass']); +}); + +test('pm.expect: to.have.property with and without value', async () => { + const tests = await runTests(` + const body = { id: 7, user: { name: "ana" } }; + pm.test("has", () => { pm.expect(body).to.have.property("id"); }); + pm.test("missing", () => { pm.expect(body).to.have.property("nope"); }); + pm.test("value ok", () => { pm.expect(body).to.have.property("id", 7); }); + pm.test("value bad", () => { pm.expect(body).to.have.property("id", 8); }); + pm.test("deep value ok", () => { pm.expect(body).to.have.deep.property("user", { name: "ana" }); }); + pm.test("on null", () => { pm.expect(null).to.have.property("id"); }); + `); + assert.deepEqual(tests.map((t) => t.status), ['pass', 'fail', 'pass', 'fail', 'pass', 'fail']); +}); + +test('pm.expect: oneOf and object include', async () => { + const tests = await runTests(` + pm.test("oneOf ok", () => { pm.expect(201).to.be.oneOf([200, 201]); }); + pm.test("oneOf bad", () => { pm.expect(500).to.be.oneOf([200, 201]); }); + pm.test("include subset", () => { pm.expect({ a: 1, b: 2 }).to.include({ a: 1 }); }); + pm.test("include number fails", () => { pm.expect(5).to.include(5); }); + `); + assert.deepEqual(tests.map((t) => t.status), ['pass', 'fail', 'pass', 'fail']); +}); + +test('pm.response.to.have.status checks code and reason', async () => { + const tests = await runTests( + ` + pm.test("code ok", () => { pm.response.to.have.status(201); }); + pm.test("code bad", () => { pm.response.to.have.status(200); }); + pm.test("reason ok", () => { pm.response.to.have.status("Created"); }); + pm.test("not ok", () => { pm.response.to.not.have.status(404); }); + pm.test("not bad", () => { pm.response.to.not.have.status(201); }); + `, + { status_code: 201, status_text: 'Created' } + ); + assert.deepEqual(tests.map((t) => t.status), ['pass', 'fail', 'pass', 'pass', 'fail']); + assert.match(tests[1].error ?? '', /status 200 but got 201/); +}); + +test('deepEqual: handles primitives, NaN, arrays vs objects, and dates', () => { + assert.equal(deepEqual(NaN, NaN), true); + assert.equal(deepEqual(1, '1'), false); + assert.equal(deepEqual([], {}), false); + assert.equal(deepEqual(new Date(5), new Date(5)), true); + assert.equal(deepEqual({ a: undefined }, {}), false); + assert.equal(deepEqual({ a: [1, { b: null }] }, { a: [1, { b: null }] }), true); +}); + +test('createExpectation: counts only evaluated assertions', () => { + let count = 0; + const onAssert = () => { + count++; + }; + createExpectation(1, onAssert).to.equal(1); + createExpectation(true, onAssert).to.be.true; + void createExpectation(true, onAssert).to.be; + assert.equal(count, 2); + assert.throws(() => createExpectation(1, onAssert).to.not.equal(1), /not to equal 1/); +}); diff --git a/apps/desktop/src/utils/hookRunner.ts b/apps/desktop/src/utils/hookRunner.ts index e6ec904..a827e0c 100644 --- a/apps/desktop/src/utils/hookRunner.ts +++ b/apps/desktop/src/utils/hookRunner.ts @@ -257,6 +257,222 @@ function formatLogArg(arg: any): string { return String(arg); } +/** Deep equality in the spirit of Chai's `eql`: same type, same keys, recursively equal values. */ +export function deepEqual(a: unknown, b: unknown): boolean { + if (Object.is(a, b)) return true; + if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) { + return false; + } + if (Array.isArray(a) !== Array.isArray(b)) return false; + if (Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false; + if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime(); + const aKeys = Object.keys(a); + const bKeys = Object.keys(b); + if (aKeys.length !== bKeys.length) return false; + return aKeys.every( + (key) => + Object.prototype.hasOwnProperty.call(b, key) && + deepEqual((a as Record)[key], (b as Record)[key]) + ); +} + +function describeType(val: unknown): string { + if (val === null) return 'null'; + if (Array.isArray(val)) return 'array'; + return typeof val; +} + +/** Language chains that Chai treats as no-ops (`to`, `be`, `have`, ...). */ +const CHAI_LANGUAGE_CHAINS = [ + 'to', 'be', 'been', 'is', 'that', 'which', 'and', 'has', 'have', 'with', 'at', 'of', 'same', 'does', 'still', +]; + +/** + * Builds a Chai-compatible expectation for `pm.expect(val)`. + * + * `onAssert` is called once per evaluated assertion, so an expectation that is + * never evaluated (e.g. an unsupported property) does not count towards a test + * passing. Property-style assertions (`.to.be.true`) assert on access and return + * a no-op function so the call form (`.to.be.true()`) keeps working. + */ +export function createExpectation(val: unknown, onAssert: () => void = () => {}): any { + const flags = { negate: false, deep: false }; + const chain: any = {}; + + const check = (pass: boolean, message: string, negatedMessage: string) => { + onAssert(); + if (flags.negate ? pass : !pass) { + throw new Error(flags.negate ? negatedMessage : message); + } + }; + const show = (v: unknown) => formatLogArg(v); + const isEqual = (a: unknown, b: unknown) => (flags.deep ? deepEqual(a, b) : a === b); + const defineGetter = (name: string, get: () => unknown) => + Object.defineProperty(chain, name, { get, enumerable: false, configurable: true }); + const noop = () => {}; + + for (const word of CHAI_LANGUAGE_CHAINS) defineGetter(word, () => chain); + defineGetter('not', () => { + flags.negate = !flags.negate; + return chain; + }); + defineGetter('deep', () => { + flags.deep = true; + return chain; + }); + + defineGetter('true', () => { + check(val === true, `Expected ${show(val)} to be true`, `Expected ${show(val)} not to be true`); + return noop; + }); + defineGetter('false', () => { + check(val === false, `Expected ${show(val)} to be false`, `Expected ${show(val)} not to be false`); + return noop; + }); + + const equal = (expected: unknown) => { + check( + isEqual(val, expected), + `Expected ${show(val)} to ${flags.deep ? 'deeply ' : ''}equal ${show(expected)}`, + `Expected ${show(val)} not to ${flags.deep ? 'deeply ' : ''}equal ${show(expected)}` + ); + return chain; + }; + chain.equal = equal; + chain.equals = equal; + chain.eq = equal; + + const eql = (expected: unknown) => { + check( + deepEqual(val, expected), + `Expected ${show(val)} to deeply equal ${show(expected)}`, + `Expected ${show(val)} not to deeply equal ${show(expected)}` + ); + return chain; + }; + chain.eql = eql; + chain.eqls = eql; + + chain.above = (n: number) => { + check( + typeof val === 'number' && val > n, + `Expected ${show(val)} to be above ${n}`, + `Expected ${show(val)} not to be above ${n}` + ); + return chain; + }; + chain.below = (n: number) => { + check( + typeof val === 'number' && val < n, + `Expected ${show(val)} to be below ${n}`, + `Expected ${show(val)} not to be below ${n}` + ); + return chain; + }; + + const typeCheck = (expectedType: string) => { + const actualType = describeType(val); + const wanted = String(expectedType).toLowerCase(); + check( + actualType === wanted, + `Expected type ${wanted} but got ${actualType}`, + `Expected ${show(val)} not to be of type ${wanted}` + ); + return chain; + }; + chain.a = typeCheck; + chain.an = typeCheck; + + const include = (needle: unknown) => { + let pass: boolean; + if (typeof val === 'string') { + pass = val.includes(String(needle)); + } else if (Array.isArray(val)) { + pass = flags.deep ? val.some((item) => deepEqual(item, needle)) : val.includes(needle); + } else if (val !== null && typeof val === 'object' && needle !== null && typeof needle === 'object') { + const subset = needle as Record; + pass = Object.keys(subset).every( + (key) => key in (val as object) && isEqual((val as Record)[key], subset[key]) + ); + } else { + pass = false; + } + check( + pass, + `Expected ${show(val)} to include ${show(needle)}`, + `Expected ${show(val)} not to include ${show(needle)}` + ); + return chain; + }; + chain.include = include; + chain.includes = include; + chain.contain = include; + chain.contains = include; + + chain.property = function property(name: string, ...rest: unknown[]) { + const hasProp = val !== null && val !== undefined && name in Object(val); + if (rest.length === 0) { + check( + hasProp, + `Expected ${show(val)} to have property '${name}'`, + `Expected ${show(val)} not to have property '${name}'` + ); + } else { + const actual = hasProp ? (val as Record)[name] : undefined; + check( + hasProp && isEqual(actual, rest[0]), + `Expected ${show(val)} to have property '${name}' of ${show(rest[0])}, but got ${show(actual)}`, + `Expected ${show(val)} not to have property '${name}' of ${show(rest[0])}` + ); + } + return chain; + }; + + chain.oneOf = (list: unknown[]) => { + const items = Array.isArray(list) ? list : []; + check( + items.some((item) => isEqual(val, item)), + `Expected ${show(val)} to be one of ${show(items)}`, + `Expected ${show(val)} not to be one of ${show(items)}` + ); + return chain; + }; + + return chain; +} + +/** + * Builds `pm.response.to` with `have.status(code | reason)` and its `not` form. + */ +export function createResponseAssertions( + code: number, + statusText: string, + onAssert: () => void = () => {} +): any { + const build = (negate: boolean): any => { + const status = (expected: number | string) => { + onAssert(); + const pass = typeof expected === 'string' ? statusText === expected : code === expected; + if (negate ? pass : !pass) { + const actual = typeof expected === 'string' ? `'${statusText}'` : String(code); + const shown = typeof expected === 'string' ? `'${expected}'` : String(expected); + throw new Error( + negate + ? `Expected response not to have status ${shown}` + : `Expected response to have status ${shown} but got ${actual}` + ); + } + }; + const node: any = { status }; + for (const word of ['to', 'be', 'have', 'and']) { + Object.defineProperty(node, word, { get: () => node, enumerable: false }); + } + Object.defineProperty(node, 'not', { get: () => build(!negate), enumerable: false }); + return node; + }; + return build(false); +} + function buildPmContext( req: HookRequestContext, res: HookResponseContext | undefined, @@ -267,6 +483,9 @@ function buildPmContext( localUpdates?: Record ) { let currentAssertionCount = 0; + const countAssertion = () => { + currentAssertionCount++; + }; const pmVariables = { get: (key: string) => varMap[key], @@ -367,6 +586,7 @@ function buildPmContext( return res.body; }, }; + pmResponse.to = createResponseAssertions(pmResponse.code, pmResponse.status, countAssertion); } const pm = { @@ -424,57 +644,7 @@ function buildPmContext( }); } }, - expect: (val: any) => { - currentAssertionCount++; - return { - to: { - equal: (expected: any) => { - if (val !== expected) throw new Error(`Expected ${expected} but got ${val}`); - }, - be: { - equal: (expected: any) => { - if (val !== expected) throw new Error(`Expected ${expected} but got ${val}`); - }, - true: () => { - if (val !== true) throw new Error(`Expected true but got ${val}`); - }, - false: () => { - if (val !== false) throw new Error(`Expected false but got ${val}`); - }, - below: (expected: number) => { - if (typeof val !== 'number' || val >= expected) { - throw new Error(`Expected ${val} to be below ${expected}`); - } - }, - above: (expected: number) => { - if (typeof val !== 'number' || val <= expected) { - throw new Error(`Expected ${val} to be above ${expected}`); - } - }, - an: (expectedType: string) => { - const actualType = Array.isArray(val) ? 'array' : typeof val; - if (actualType !== expectedType) { - throw new Error(`Expected type ${expectedType} but got ${actualType}`); - } - }, - a: (expectedType: string) => { - const actualType = Array.isArray(val) ? 'array' : typeof val; - if (actualType !== expectedType) { - throw new Error(`Expected type ${expectedType} but got ${actualType}`); - } - }, - }, - include: (needle: any) => { - if (typeof val === 'string' && !val.includes(needle)) { - throw new Error(`Expected string to include ${needle}`); - } - if (Array.isArray(val) && !val.includes(needle)) { - throw new Error(`Expected array to include ${needle}`); - } - }, - }, - }; - }, + expect: (val: any) => createExpectation(val, countAssertion), }; return pm; From 236ae134f98e91396bceb59420768a4afb8f4598 Mon Sep 17 00:00:00 2001 From: RobbyAJM Date: Sat, 5 Dec 2026 21:59:26 +0700 Subject: [PATCH 3/4] fix(server): refuse to start with a missing or public encryption key; redact DB password in logs - ENV_ENCRYPTION_KEY is now required, must be 64 hex characters, and must not be the public example key. Errors explain `openssl rand -hex 32`. - API_LAB_ALLOW_INSECURE_DEV_KEY=1 opts into the example key for local development, with a loud startup warning. - The startup log shows only host, port and database of DATABASE_URL. - Checks live in apps/server/src/config.rs with unit tests. - .env.example no longer ships a key; .vscode/launch.json uses the dev opt-in; README documents key generation and the upgrade path. Co-Authored-By: Claude Opus 5.5 --- .env.example | 7 +- .vscode/launch.json | 2 +- README.md | 3 + apps/desktop/src-tauri/tauri.conf.json | 2 +- apps/server/src/config.rs | 276 +++++++++++++++++++++++++ apps/server/src/lib.rs | 1 + apps/server/src/main.rs | 33 ++- 7 files changed, 317 insertions(+), 7 deletions(-) create mode 100644 apps/server/src/config.rs diff --git a/.env.example b/.env.example index c05eec7..73450bf 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,9 @@ PORT=8080 DATABASE_URL=postgres://root:root@localhost:5432/api_lab?sslmode=disable -ENV_ENCRYPTION_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef +# Required. 64 hex characters (32 bytes) used to encrypt environment variables at rest. +# Generate one with: openssl rand -hex 32 +ENV_ENCRYPTION_KEY= +# Local development only: start with the public example key when ENV_ENCRYPTION_KEY is unset. +# Never enable this on a server that stores real data. +# API_LAB_ALLOW_INSECURE_DEV_KEY=1 RUST_LOG=info,api_lab=debug diff --git a/.vscode/launch.json b/.vscode/launch.json index 108ae64..0b2070e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -20,7 +20,7 @@ "cwd": "${workspaceFolder}", "env": { "PORT": "8080", - "ENV_ENCRYPTION_KEY": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", + "API_LAB_ALLOW_INSECURE_DEV_KEY": "1", "RUST_LOG": "info,api_lab_server=debug,tower_http=debug" } }, diff --git a/README.md b/README.md index 987ddd3..bb595ed 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,9 @@ Managed stunnel mode requires a `stunnel` executable on `PATH`, or an explicit e ```bash cp .env.example .env ``` + Set `ENV_ENCRYPTION_KEY` in `.env` to the output of `openssl rand -hex 32`. The server refuses to start without a key of its own. For a throwaway local setup you can instead set `API_LAB_ALLOW_INSECURE_DEV_KEY=1`, which uses a public example key and logs a warning. + + > **Upgrading from a build that defaulted to the example key:** the server now refuses to start when `ENV_ENCRYPTION_KEY` is unset or equal to the public example key. Data encrypted with the example key (sensitive environment variable values and invitation codes) can't be read under a new key. To switch, set a new key, then re-enter sensitive values and re-issue invitation codes. Until you do, `API_LAB_ALLOW_INSECURE_DEV_KEY=1` keeps the server starting with the old key. Only use it if the data isn't sensitive. 2. **Prepare PostgreSQL 14+** (`DATABASE_URL` in `.env`). The sync server applies migrations automatically on startup. diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index 225eb57..cd835af 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "API Lab", - "version": "0.1.206", + "version": "0.1.209", "identifier": "com.apilab.desktop", "build": { "beforeDevCommand": "pnpm dev", diff --git a/apps/server/src/config.rs b/apps/server/src/config.rs new file mode 100644 index 0000000..a1a22a3 --- /dev/null +++ b/apps/server/src/config.rs @@ -0,0 +1,276 @@ +//! Startup configuration checks for the sync server. +//! +//! Kept free of I/O so each check can be unit-tested without a database or +//! a running server. + +use std::str::FromStr; + +use sqlx::postgres::PgConnectOptions; +use thiserror::Error; + +/// Environment variable holding the AES-256-GCM key for data at rest. +pub const ENCRYPTION_KEY_VAR: &str = "ENV_ENCRYPTION_KEY"; + +/// Opt-in for local development: lets the server start with the public +/// example key. Never set this on a server that stores real data. +pub const ALLOW_INSECURE_DEV_KEY_VAR: &str = "API_LAB_ALLOW_INSECURE_DEV_KEY"; + +/// The example key that shipped in `.env.example` and older builds. It is +/// public, so anything encrypted with it is effectively plaintext. +pub const INSECURE_EXAMPLE_KEY: &str = + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"; + +const KEY_HELP: &str = + "Generate a key with `openssl rand -hex 32` and set it as ENV_ENCRYPTION_KEY. \ +For local development only, set API_LAB_ALLOW_INSECURE_DEV_KEY=1 to use the public example key."; + +#[derive(Debug, Error, PartialEq, Eq)] +pub enum EncryptionKeyError { + #[error("ENV_ENCRYPTION_KEY is not set. {KEY_HELP}")] + Missing, + + #[error("ENV_ENCRYPTION_KEY must be exactly 64 hex characters (32 bytes); got {len} characters{non_hex}. {KEY_HELP}", non_hex = if *.non_hex { " including non-hex characters" } else { "" })] + InvalidFormat { len: usize, non_hex: bool }, + + #[error("ENV_ENCRYPTION_KEY is the public example key from .env.example, so encrypted data would be readable by anyone. {KEY_HELP} \ +If this server already stores data encrypted with the example key, a new key cannot read it: sensitive variable values must be re-entered and invitation codes re-issued after switching. \ +Until then, API_LAB_ALLOW_INSECURE_DEV_KEY=1 keeps the old data readable.")] + InsecureExampleKey, +} + +/// A validated encryption key, plus whether it is the insecure dev key. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct EncryptionKey { + pub key_hex: String, + pub insecure_dev_key: bool, +} + +/// Validates the raw `ENV_ENCRYPTION_KEY` value. +/// +/// * A missing or blank value is rejected, unless `allow_insecure_dev_key` +/// is set, in which case the public example key is used. +/// * A value that is not 64 hex characters is always rejected. +/// * The public example key is rejected unless `allow_insecure_dev_key` is set. +pub fn resolve_encryption_key( + raw: Option<&str>, + allow_insecure_dev_key: bool, +) -> Result { + let trimmed = raw.map(str::trim).filter(|v| !v.is_empty()); + + let Some(value) = trimmed else { + return if allow_insecure_dev_key { + Ok(EncryptionKey { + key_hex: INSECURE_EXAMPLE_KEY.to_owned(), + insecure_dev_key: true, + }) + } else { + Err(EncryptionKeyError::Missing) + }; + }; + + let all_hex = value.chars().all(|c| c.is_ascii_hexdigit()); + if value.len() != 64 || !all_hex { + return Err(EncryptionKeyError::InvalidFormat { + len: value.chars().count(), + non_hex: !all_hex, + }); + } + + let normalized = value.to_ascii_lowercase(); + let insecure_dev_key = normalized == INSECURE_EXAMPLE_KEY; + if insecure_dev_key && !allow_insecure_dev_key { + return Err(EncryptionKeyError::InsecureExampleKey); + } + + Ok(EncryptionKey { + key_hex: normalized, + insecure_dev_key, + }) +} + +/// Interprets an on/off environment flag (`1`, `true`, `yes`, `on`). +#[must_use] +pub fn is_truthy_flag(raw: Option<&str>) -> bool { + raw.map(|v| v.trim().to_ascii_lowercase()) + .is_some_and(|v| matches!(v.as_str(), "1" | "true" | "yes" | "on")) +} + +/// Describes a PostgreSQL connection string for logs without credentials: +/// only host, port and database name are kept. +#[must_use] +/// +/// Anything that is not a `postgres://` or `postgresql://` URL is not echoed +/// at all: sqlx treats some malformed strings as a bare database name, which +/// could otherwise put a mistyped password into the log. +pub fn redact_database_url(url: &str) -> String { + const UNPARSEABLE: &str = ""; + let trimmed = url.trim(); + let has_pg_scheme = ["postgres://", "postgresql://"].iter().any(|scheme| { + trimmed + .get(..scheme.len()) + .is_some_and(|prefix| prefix.eq_ignore_ascii_case(scheme)) + }); + if !has_pg_scheme { + return UNPARSEABLE.to_owned(); + } + let Ok(opts) = PgConnectOptions::from_str(trimmed) else { + return UNPARSEABLE.to_owned(); + }; + let database = opts.get_database().unwrap_or(""); + format!( + "postgres://{}:{}/{}", + opts.get_host(), + opts.get_port(), + database + ) +} + +#[cfg(test)] +mod tests { + use super::*; + + const GOOD_KEY: &str = "9f2c4a1b7e8d6c5b4a39281706f5e4d3c2b1a0f9e8d7c6b5a4938271605f4e3d"; + + #[test] + fn missing_key_is_rejected() { + assert_eq!( + resolve_encryption_key(None, false), + Err(EncryptionKeyError::Missing) + ); + assert_eq!( + resolve_encryption_key(Some(" "), false), + Err(EncryptionKeyError::Missing) + ); + } + + #[test] + fn missing_key_with_dev_opt_in_uses_example_key() { + let key = resolve_encryption_key(None, true).expect("dev opt-in"); + assert_eq!(key.key_hex, INSECURE_EXAMPLE_KEY); + assert!(key.insecure_dev_key); + } + + #[test] + fn example_key_is_rejected_without_opt_in() { + assert_eq!( + resolve_encryption_key(Some(INSECURE_EXAMPLE_KEY), false), + Err(EncryptionKeyError::InsecureExampleKey) + ); + let upper = INSECURE_EXAMPLE_KEY.to_ascii_uppercase(); + assert_eq!( + resolve_encryption_key(Some(&upper), false), + Err(EncryptionKeyError::InsecureExampleKey) + ); + } + + #[test] + fn example_key_is_flagged_with_opt_in() { + let key = resolve_encryption_key(Some(INSECURE_EXAMPLE_KEY), true).expect("dev opt-in"); + assert!(key.insecure_dev_key); + } + + #[test] + fn wrong_length_is_rejected_even_with_opt_in() { + assert_eq!( + resolve_encryption_key(Some("abcd"), true), + Err(EncryptionKeyError::InvalidFormat { + len: 4, + non_hex: false + }) + ); + } + + #[test] + fn non_hex_is_rejected() { + let bad = "z".repeat(64); + assert_eq!( + resolve_encryption_key(Some(&bad), false), + Err(EncryptionKeyError::InvalidFormat { + len: 64, + non_hex: true + }) + ); + } + + #[test] + fn valid_key_is_trimmed_and_lowercased() { + let padded = format!(" {}\n", GOOD_KEY.to_ascii_uppercase()); + let key = resolve_encryption_key(Some(&padded), false).expect("valid key"); + assert_eq!(key.key_hex, GOOD_KEY); + assert!(!key.insecure_dev_key); + } + + #[test] + fn validated_key_works_with_aes_gcm() { + let key = resolve_encryption_key(Some(GOOD_KEY), false).expect("valid key"); + let ct = rust_core::crypto::encrypt_aes_gcm("secret", &key.key_hex).expect("encrypt"); + let pt = rust_core::crypto::decrypt_aes_gcm(&ct, &key.key_hex).expect("decrypt"); + assert_eq!(pt, "secret"); + } + + #[test] + fn error_messages_explain_how_to_generate_a_key() { + for err in [ + EncryptionKeyError::Missing, + EncryptionKeyError::InvalidFormat { + len: 3, + non_hex: true, + }, + EncryptionKeyError::InsecureExampleKey, + ] { + assert!(err.to_string().contains("openssl rand -hex 32"), "{err}"); + } + } + + #[test] + fn truthy_flags() { + for v in ["1", "true", "TRUE", " yes ", "on"] { + assert!(is_truthy_flag(Some(v)), "{v}"); + } + for v in ["", "0", "false", "no", "off", "2"] { + assert!(!is_truthy_flag(Some(v)), "{v}"); + } + assert!(!is_truthy_flag(None)); + } + + #[test] + fn database_url_password_is_redacted() { + let redacted = redact_database_url( + "postgres://admin:s3cr3t-P%40ss@db.internal:6543/api_lab?sslmode=require", + ); + assert_eq!(redacted, "postgres://db.internal:6543/api_lab"); + assert!(!redacted.contains("s3cr3t")); + assert!(!redacted.contains("admin")); + } + + #[test] + fn database_url_with_default_port() { + let redacted = redact_database_url("postgresql://root:root@localhost/api_lab"); + assert_eq!(redacted, "postgres://localhost:5432/api_lab"); + } + + #[test] + fn unparseable_database_url_reveals_nothing() { + let redacted = redact_database_url("user:hunter2 not a url"); + assert_eq!(redacted, ""); + } + + #[test] + fn non_postgres_or_scheme_less_urls_are_not_echoed() { + for url in ["mysql://user:hunter2@host/db", "user:hunter2@host/db", ""] { + assert_eq!( + redact_database_url(url), + "", + "{url}" + ); + } + } + + #[test] + fn database_url_without_credentials_or_db_name() { + assert_eq!( + redact_database_url("POSTGRES://db.example.com"), + "postgres://db.example.com:5432/" + ); + } +} diff --git a/apps/server/src/lib.rs b/apps/server/src/lib.rs index 27d2cbb..4321197 100644 --- a/apps/server/src/lib.rs +++ b/apps/server/src/lib.rs @@ -1,4 +1,5 @@ pub mod collab; +pub mod config; pub mod error; pub mod handlers; pub mod middleware; diff --git a/apps/server/src/main.rs b/apps/server/src/main.rs index e3d2516..fbd3ddf 100644 --- a/apps/server/src/main.rs +++ b/apps/server/src/main.rs @@ -1,5 +1,9 @@ use std::net::SocketAddr; use std::sync::Arc; +use api_lab_server::config::{ + is_truthy_flag, redact_database_url, resolve_encryption_key, ALLOW_INSECURE_DEV_KEY_VAR, + ENCRYPTION_KEY_VAR, +}; use api_lab_server::router::create_router; use api_lab_server::state::AppState; use sqlx::postgres::PgPoolOptions; @@ -21,15 +25,36 @@ async fn main() -> Result<(), Box> { let db_url = std::env::var("DATABASE_URL") .unwrap_or_else(|_| "postgres://root:root@localhost:5432/api_lab?sslmode=disable".into()); - let encryption_key = std::env::var("ENV_ENCRYPTION_KEY") - .unwrap_or_else(|_| "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef".into()); + let allow_insecure_dev_key = + is_truthy_flag(std::env::var(ALLOW_INSECURE_DEV_KEY_VAR).ok().as_deref()); + let encryption_key = match resolve_encryption_key( + std::env::var(ENCRYPTION_KEY_VAR).ok().as_deref(), + allow_insecure_dev_key, + ) { + Ok(key) => key, + Err(e) => { + // stderr rather than tracing, so RUST_LOG can't hide why the server exited. + eprintln!("Refusing to start: {e}"); + std::process::exit(1); + } + }; + if encryption_key.insecure_dev_key { + tracing::warn!( + "!!! INSECURE: using the PUBLIC example ENV_ENCRYPTION_KEY because {ALLOW_INSECURE_DEV_KEY_VAR} is set. \ + Environment variables stored by this server are readable by anyone. \ + Use this for local development only. !!!" + ); + } let port: u16 = std::env::var("PORT") .ok() .and_then(|p| p.parse().ok()) .unwrap_or(8080); - tracing::info!("Connecting to PostgreSQL at {db_url}..."); + tracing::info!( + "Connecting to PostgreSQL at {}...", + redact_database_url(&db_url) + ); let pool = PgPoolOptions::new() .max_connections(20) .connect(&db_url) @@ -44,7 +69,7 @@ async fn main() -> Result<(), Box> { let state = Arc::new(AppState { pool, - encryption_key, + encryption_key: encryption_key.key_hex, tx_ws, tx_presence, presence, From fb9a9f31f5f6f2a9f0c83f4ae29c1567a224d29f Mon Sep 17 00:00:00 2001 From: RobbyAJM Date: Sat, 5 Dec 2026 22:00:23 +0700 Subject: [PATCH 4/4] chore: drop version sync (handled in the combined PR) Co-Authored-By: Claude Opus 5.5 --- apps/desktop/src-tauri/tauri.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index cd835af..225eb57 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "API Lab", - "version": "0.1.209", + "version": "0.1.206", "identifier": "com.apilab.desktop", "build": { "beforeDevCommand": "pnpm dev",