How to build and deploy apps for Even Realities G2 Glasses using the Even Hub simulator
Install
npx skillscat add ineedsomesleep5/evenhubdemo Install via the SkillsCat registry.
This skill provides instructions for building, testing, and deploying applications for Even Realities G2 Glasses using the even-dev Hub simulator. It addresses the need for a structured development workflow within a monorepo setup, enabling developers to create new apps with defined metadata and logic files. Developers should use this guide when creating or contributing applications intended to run on the G2 Glasses platform through the Even Hub ecosystem.
Even Hub Development Guide
This guide explains how to build, test, and deploy applications for the Even Realities G2 Glasses using the even-dev Hub ecosystem.
Project Structure
The repository is organized as a monorepo where each app lives in its own folder under apps/.
/
├── apps/
│ ├── demo/ # Example app
│ ├── chess/ # Submodule app (requires specific build steps)
│ └── my-new-app/ # Your new app
├── src/
│ ├── Main.ts # Global app loader (routes based on ?app=name)
│ └── ...
└── vercel.json # Deployment configCreating a New App
Create Directory: Create a new folder in
apps/.mkdir apps/my-new-appMetadata File (
index.ts): Define your app's identity.
Createapps/my-new-app/index.ts:import type { AppModule } from '../_shared/app-types' import { createActions } from './main' export const app: AppModule = { id: 'my-new-app', name: 'My New App', pageTitle: 'My G2 App', connectLabel: 'Connect', actionLabel: 'Do Something', initialStatus: 'Ready', createActions: createActions, } export default appLogic File (
main.ts): Implement the behavior.
Createapps/my-new-app/main.ts:import type { AppActions, SetStatus } from '../_shared/app-types' export function createActions(setStatus: SetStatus): AppActions { return { async connect() { setStatus('Connecting to G2...') // Add initialization logic here setStatus('Connected!') }, async action() { setStatus('Action button clicked!') // Add your core feature logic here }, } }
Testing Locally
Start Dev Server:
npm run devOpen in Simulator:
Navigate tohttp://localhost:5173/?app=my-new-app- Note: The query parameter
?app=<folder-name>is crucial. If omitted, it defaults todemo.
- Note: The query parameter
Deployment (Vercel)
This project is configured for Vercel static deployment.
- Build:
npm run build - Deploy: Push to Vercel (ensure
vercel.jsonis present). - Access:
https://your-deployment.vercel.app/?app=my-new-app
Important: generic apps vs "smart" apps
- Static Apps: Most apps (Demo, Clock) run entirely in the browser.
- WASM Apps (Chess): Require
SharedArrayBuffersupport. The project includesvercel.jsonheaders (Cross-Origin-Opener-Policy: same-origin,Cross-Origin-Embedder-Policy: require-corp) to enable this. - Backend Apps: Apps requiring custom backend proxies (Reddit, REST API) may not work fully on static Vercel hosting.
Debugging
- Console Logs: Check the browser console. Messages tagged
[app-loader]or[ui]are from the framework. - Bridge Events: Even G2 interactions are simulated via the web UI buttons if no glasses are connected.