Before you start
You don’t need any special tooling. For the quick-start path, all you need is a text editor. For framework-based apps (React, Vue, Svelte, etc.) you’ll want Node.js installed and a bundler that can produce a single self-contained HTML file. Here’s a quick look at the two paths:| Path | Best for | Build step? |
|---|---|---|
| Vanilla HTML | Prototypes, simple tools, learning the platform | No |
| Framework (React / Vue / etc.) | Production apps, complex UIs, team projects | Yes — bundle to a single HTML file |
Step 1: Build your first app
A webAI app is just an HTML file that declares which platform facades it needs through a shell manifest, and then reads fromwindow.apogeeSDK to call them. Here’s a complete, working example that demonstrates AI inference, identity, and theme integration — all in a single file:
index.html and upload it to webAI — you’ll have a working AI chat app with theme support and a personalized greeting. The sections below break down each piece of the pattern.
Step 2: Understand the app model
Before adding more platform features, it helps to know how your app fits into webAI.How apps run
When you upload an app, the webAI shell:- Stores your HTML locally
- Registers it in the launcher alongside built-in apps
- When launched, loads it into a sandboxed iframe
- Reads your shell manifest and injects
window.apogeeSDKwith the facades you declared
Key constraints
| Constraint | What it means |
|---|---|
| Single file | All JS, CSS, and assets must be inlined into one HTML file |
| No external fetches | Don’t depend on CDN-hosted libraries at runtime |
| Iframe sandbox | Your app runs in an iframe — some browser APIs may be restricted |
| Manifest required | Declare every facade you need; only declared facades are injected |
| Graceful degradation | window.apogeeSDK is null outside webAI. Always guard before calling |
Deep dive: App architecture
Learn more about the single-file model, iframe sandbox, and recommended project structure.
Step 3: Connect to platform APIs
The webAI shell injects a single bridge object —window.apogeeSDK — into your app. It exposes platform capabilities as domain-specific facades (sdk.intelligence, sdk.identity, sdk.room, sdk.messaging, and so on).
The access pattern
npm run dev, or if you double-click the HTML file), sdk is null. Always guard before calling.
Declaring your requirements
Your app tells the shell which facades it needs via the manifest you saw in Step 1:requires.managers are injected. After loading, check sdk.supportedFacades to see what’s actually available — a facade may be omitted if the current shell doesn’t ship it (for example, a browser-only environment may expose fewer facades than the desktop app).
Available platform facades
| Domain | Facades | Reference |
|---|---|---|
| AI | intelligence | Intelligence → |
| Collaboration | room, messaging, canvas, files | Collaboration APIs → |
| Identity | identity, crypto | Identity & Encryption → |
| Shell | shell, theme, windows, settings | Navigation → |
Deep dive: Accessing shell APIs
See the full access pattern, manifest declaration, and facade domain reference.
Step 4: Add platform features
Now that you know how to access APIs, let’s put them to use. Each section below is independent — add only what your app needs, and declare the matching facade in your manifest.Add on-device AI
Theintelligence facade lets your app run AI inference directly on the user’s device (or route to a registered cloud backend). Use chatCompletion for a simple request/response pattern:
chatCompletionStream instead:
model: "auto"lets the runtime pick the best available backend for the device.chatCompletionreturns the full response after generation completes.chatCompletionStreamis an async iterator — each chunk carries adeltastring and an optionalfinish_reason.
Intelligence reference
Covers chat completions, streaming, backend selection, cloud keys, and runtime state.
Identify the user
Read the user’s display name and device identity (ODID) through theidentity facade:
Identity & Encryption reference
Covers ODID, display name updates, and end-to-end encryption via
sdk.crypto.Respond to theme changes
Thetheme facade exposes the user’s theme preference and lets your app react to changes:
Make it collaborative
Real-time collaboration is split across four facades —room hosts and joins spaces, messaging handles chat, canvas syncs shared app state, and files shares files inside a space.
- One user hosts a space with
sdk.room.host()— this returns a room code - Others join using that code with
sdk.room.join({ roomCode }) - Participants exchange state through the platform (chat via
messaging, shared app state viacanvas) - The platform broadcasts changes, persists state, and resolves conflicts via
Collaboration APIs reference
Covers hosting, joining, canvas state, messaging, file sharing, and best practices.
Step 5: Set up a framework project (optional)
For anything beyond a simple prototype, a framework with a bundler gives you a better development experience. The only hard requirement is that your build outputs a single self-contained HTML file. Vite withvite-plugin-singlefile is one common path; any bundler that can inline JS, CSS, and assets into one HTML file will work.
Scaffold the project
- React
- Vue
Configure the bundler
Updatevite.config.js to inline all assets into a single HTML file:
Include the shell manifest
Add the manifest toindex.html in the <head>:
Create the integration module
Rather than scatteringwindow.apogeeSDK || null throughout your codebase, create a src/webai.js (or .ts) file as your single integration layer:
Develop locally
window.apogeeSDK will be null — this is expected. Design your UI with graceful fallbacks so you can iterate without the full shell running.
Deep dive: App lifecycle
Covers the full development workflow, project structure, bundler config, and uploading.
Step 6: Upload your app
Apps are uploaded to the webAI shell as a single HTML file — whether you wrote that file by hand or produced it via a bundler.Vanilla HTML apps
Use the New App flow directly in the webAI launcher:- Open the launcher
- Click New App
- Select your
.htmlfile - Choose an icon and color
- Give it a name
Framework apps
Framework apps need a build step first. Then upload the single-file output the same way as a vanilla app:Build to a single file
dist/index.html — a single self-contained HTML file with all JS, CSS, and assets inlined.Deep dive: App lifecycle
Covers the full build and upload flow, including versioning.
Step 7: Share it
Once your app is uploaded, sharing is as simple as being in a space:- Open your app in a space
- Right-click it and choose Share App, or pin it for the group
- Other space members receive it automatically
Guide: Share apps
Learn all the ways to distribute apps — direct sharing, pinning, and responding to requests.
Putting it all together
Here’s a complete example of a framework-based app that uses AI, identity, and theme — the most common combination:- React
- Vue
Best practices
Always null-guard platform access
Always null-guard platform access
window.apogeeSDK is null outside of webAI. Wrap every access in a check so your app works during local development and doesn’t crash when a facade isn’t available. Optional chaining (sdk?.intelligence?.chatCompletion?.(...)) is a concise way to do this.Declare every facade you need in the manifest
Declare every facade you need in the manifest
Only facades listed under
requires.managers are injected. If sdk.room is missing at runtime, check your manifest first. Inspect sdk.supportedFacades to see what the shell actually provided.Keep your bundle small
Keep your bundle small
Apps under 1MB load quickly. If your build exceeds 5MB, consider optimizing images, removing unused dependencies, or lazy-loading heavy components.
Handle stream cancellation
Handle stream cancellation
When using
chatCompletionStream, let users cancel long generations. Break out of the for await loop as soon as the user asks to stop, and ignore any remaining chunks. This keeps the UI responsive and avoids wasted compute.Unsubscribe from facade subscribers
Unsubscribe from facade subscribers
Every facade with
subscribe(handler) returns an unsubscribe function. Call it on teardown (useEffect cleanup, onUnmounted, etc.) to avoid memory leaks.Handle disconnections in collaborative apps
Handle disconnections in collaborative apps
Peers can drop out at any time. Design your state model to handle partial participation. See the Collaboration APIs best practices.
Test outside the shell first
Test outside the shell first
Build your UI and core logic so it works in a normal browser tab. Add platform features on top with graceful fallbacks. This makes development much faster.
Quick reference
Everything you need in one place:| Topic | Guide | API reference |
|---|---|---|
| How apps are structured | This page | App architecture |
| Accessing platform APIs | This page | Accessing shell APIs |
| On-device AI | This page | Intelligence |
| User identity | This page | Identity & Encryption |
| Real-time collaboration | This page | Collaboration APIs |
| Navigation | — | Navigation |
| Build & deploy | This page | App lifecycle |
| Sharing | Share apps guide | — |
Next steps
Share apps
Distribute your apps to others through spaces — no app store needed.
API Reference
Explore the full API documentation for all platform capabilities.