create-airjam 0.1.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/index.js +12 -4
  2. package/package.json +10 -8
  3. package/templates/pong/.env.example +7 -0
  4. package/templates/pong/{AI_INSTRUCTIONS.md → AGENTS.md} +9 -2
  5. package/templates/pong/README.md +38 -3
  6. package/templates/pong/airjam-docs/for-agents/page.md +27 -0
  7. package/templates/pong/airjam-docs/getting-started/architecture/page.md +4 -1
  8. package/templates/pong/airjam-docs/getting-started/introduction/page.md +56 -38
  9. package/templates/pong/airjam-docs/getting-started/quick-start/page.md +108 -0
  10. package/templates/pong/airjam-docs/how-it-works/architecture/page.md +168 -0
  11. package/templates/pong/airjam-docs/how-it-works/host-system/page.md +20 -10
  12. package/templates/pong/airjam-docs/sdk/hooks/page.md +13 -11
  13. package/templates/pong/airjam-docs/sdk/networked-state/page.md +1 -1
  14. package/templates/pong/package.json +6 -3
  15. package/templates/pong/scripts/dev-secure.mjs +177 -0
  16. package/templates/pong/scripts/secure-init.mjs +134 -0
  17. package/templates/pong/src/App.tsx +2 -0
  18. package/templates/pong/src/controller-view.tsx +78 -99
  19. package/templates/pong/src/host-view.tsx +3 -18
  20. package/templates/pong/src/vite-env.d.ts +1 -0
  21. package/templates/pong/vite.config.ts +9 -0
  22. package/templates/pong/dist/assets/index-BwJ4uU20.js +0 -269
  23. package/templates/pong/dist/assets/index-D42jDbB5.css +0 -1
  24. package/templates/pong/dist/index.html +0 -19
  25. package/templates/pong/node_modules/.bin/air-jam-server +0 -17
  26. package/templates/pong/node_modules/.bin/eslint +0 -17
  27. package/templates/pong/node_modules/.bin/eslint-config-prettier +0 -17
  28. package/templates/pong/node_modules/.bin/tsc +0 -17
  29. package/templates/pong/node_modules/.bin/tsserver +0 -17
  30. package/templates/pong/node_modules/.bin/vite +0 -17
  31. package/templates/pong/node_modules/.vite/deps/@radix-ui_react-dialog.js +0 -1680
  32. package/templates/pong/node_modules/.vite/deps/@radix-ui_react-dialog.js.map +0 -7
  33. package/templates/pong/node_modules/.vite/deps/@radix-ui_react-slider.js +0 -638
  34. package/templates/pong/node_modules/.vite/deps/@radix-ui_react-slider.js.map +0 -7
  35. package/templates/pong/node_modules/.vite/deps/@radix-ui_react-slot.js +0 -129
  36. package/templates/pong/node_modules/.vite/deps/@radix-ui_react-slot.js.map +0 -7
  37. package/templates/pong/node_modules/.vite/deps/@radix-ui_react-tabs.js +0 -434
  38. package/templates/pong/node_modules/.vite/deps/@radix-ui_react-tabs.js.map +0 -7
  39. package/templates/pong/node_modules/.vite/deps/_metadata.json +0 -163
  40. package/templates/pong/node_modules/.vite/deps/chunk-6G72RLJL.js +0 -1004
  41. package/templates/pong/node_modules/.vite/deps/chunk-6G72RLJL.js.map +0 -7
  42. package/templates/pong/node_modules/.vite/deps/chunk-BHOBIW4J.js +0 -99
  43. package/templates/pong/node_modules/.vite/deps/chunk-BHOBIW4J.js.map +0 -7
  44. package/templates/pong/node_modules/.vite/deps/chunk-E44IQKDY.js +0 -49
  45. package/templates/pong/node_modules/.vite/deps/chunk-E44IQKDY.js.map +0 -7
  46. package/templates/pong/node_modules/.vite/deps/chunk-E5X4SHYG.js +0 -21
  47. package/templates/pong/node_modules/.vite/deps/chunk-E5X4SHYG.js.map +0 -7
  48. package/templates/pong/node_modules/.vite/deps/chunk-G3PMV62Z.js +0 -35
  49. package/templates/pong/node_modules/.vite/deps/chunk-G3PMV62Z.js.map +0 -7
  50. package/templates/pong/node_modules/.vite/deps/chunk-LI6KBZ3D.js +0 -292
  51. package/templates/pong/node_modules/.vite/deps/chunk-LI6KBZ3D.js.map +0 -7
  52. package/templates/pong/node_modules/.vite/deps/chunk-MDNXVKSA.js +0 -337
  53. package/templates/pong/node_modules/.vite/deps/chunk-MDNXVKSA.js.map +0 -7
  54. package/templates/pong/node_modules/.vite/deps/chunk-METQ356G.js +0 -280
  55. package/templates/pong/node_modules/.vite/deps/chunk-METQ356G.js.map +0 -7
  56. package/templates/pong/node_modules/.vite/deps/chunk-NPTAWNEA.js +0 -171
  57. package/templates/pong/node_modules/.vite/deps/chunk-NPTAWNEA.js.map +0 -7
  58. package/templates/pong/node_modules/.vite/deps/class-variance-authority.js +0 -51
  59. package/templates/pong/node_modules/.vite/deps/class-variance-authority.js.map +0 -7
  60. package/templates/pong/node_modules/.vite/deps/clsx.js +0 -9
  61. package/templates/pong/node_modules/.vite/deps/clsx.js.map +0 -7
  62. package/templates/pong/node_modules/.vite/deps/howler.js +0 -2241
  63. package/templates/pong/node_modules/.vite/deps/howler.js.map +0 -7
  64. package/templates/pong/node_modules/.vite/deps/html5-qrcode.js +0 -29350
  65. package/templates/pong/node_modules/.vite/deps/html5-qrcode.js.map +0 -7
  66. package/templates/pong/node_modules/.vite/deps/lucide-react.js +0 -28662
  67. package/templates/pong/node_modules/.vite/deps/lucide-react.js.map +0 -7
  68. package/templates/pong/node_modules/.vite/deps/package.json +0 -3
  69. package/templates/pong/node_modules/.vite/deps/qrcode.js +0 -2083
  70. package/templates/pong/node_modules/.vite/deps/qrcode.js.map +0 -7
  71. package/templates/pong/node_modules/.vite/deps/react-dom.js +0 -6
  72. package/templates/pong/node_modules/.vite/deps/react-dom.js.map +0 -7
  73. package/templates/pong/node_modules/.vite/deps/react-dom_client.js +0 -20217
  74. package/templates/pong/node_modules/.vite/deps/react-dom_client.js.map +0 -7
  75. package/templates/pong/node_modules/.vite/deps/react-router-dom.js +0 -13900
  76. package/templates/pong/node_modules/.vite/deps/react-router-dom.js.map +0 -7
  77. package/templates/pong/node_modules/.vite/deps/react.js +0 -5
  78. package/templates/pong/node_modules/.vite/deps/react.js.map +0 -7
  79. package/templates/pong/node_modules/.vite/deps/react_jsx-dev-runtime.js +0 -278
  80. package/templates/pong/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +0 -7
  81. package/templates/pong/node_modules/.vite/deps/react_jsx-runtime.js +0 -6
  82. package/templates/pong/node_modules/.vite/deps/react_jsx-runtime.js.map +0 -7
  83. package/templates/pong/node_modules/.vite/deps/socket__io-client.js +0 -3422
  84. package/templates/pong/node_modules/.vite/deps/socket__io-client.js.map +0 -7
  85. package/templates/pong/node_modules/.vite/deps/tailwind-merge.js +0 -2534
  86. package/templates/pong/node_modules/.vite/deps/tailwind-merge.js.map +0 -7
  87. package/templates/pong/node_modules/.vite/deps/zod.js +0 -13810
  88. package/templates/pong/node_modules/.vite/deps/zod.js.map +0 -7
  89. package/templates/pong/node_modules/.vite/deps/zustand.js +0 -56
  90. package/templates/pong/node_modules/.vite/deps/zustand.js.map +0 -7
  91. package/templates/pong/node_modules/.vite/deps/zustand_react_shallow.js +0 -77
  92. package/templates/pong/node_modules/.vite/deps/zustand_react_shallow.js.map +0 -7
package/dist/index.js CHANGED
@@ -106,14 +106,22 @@ Creating project in ${targetDir}...
106
106
  }
107
107
  console.log("Next steps:\n");
108
108
  console.log(kleur.cyan(` cd ${projectName}`));
109
- console.log(kleur.cyan(" cp .env.example .env"));
109
+ console.log(kleur.cyan(" cp .env.example .env.local"));
110
+ console.log(kleur.cyan(" pnpm run dev:server # Terminal 1 - Start server"));
111
+ console.log(kleur.cyan(" pnpm run dev # Terminal 2 - Start game"));
110
112
  console.log(
111
113
  kleur.cyan(
112
- " # Edit .env and set AIR_JAM_MASTER_KEY (optional for local dev)"
114
+ " # Optional HTTPS mode (needed for gyro/camera testing on phones)"
113
115
  )
114
116
  );
115
- console.log(kleur.cyan(" pnpm run dev:server # Terminal 1 - Start server"));
116
- console.log(kleur.cyan(" pnpm run dev # Terminal 2 - Start game"));
117
+ console.log(
118
+ kleur.cyan(
119
+ " pnpm run secure:init -- --hostname my-game-dev.example.com --tunnel my-game-dev"
120
+ )
121
+ );
122
+ console.log(
123
+ kleur.cyan(" pnpm run dev:secure # Optional HTTPS mode for sensors")
124
+ );
117
125
  console.log("");
118
126
  console.log(
119
127
  kleur.dim(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-airjam",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
4
4
  "description": "CLI to scaffold Air Jam game projects",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -10,6 +10,9 @@
10
10
  "directory": "packages/create-airjam"
11
11
  },
12
12
  "homepage": "https://github.com/vucinatim/air-jam#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/vucinatim/air-jam/issues"
15
+ },
13
16
  "keywords": [
14
17
  "air-jam",
15
18
  "cli",
@@ -28,12 +31,6 @@
28
31
  "dist",
29
32
  "templates"
30
33
  ],
31
- "scripts": {
32
- "extract-docs": "tsx scripts/extract-docs.ts",
33
- "build": "pnpm extract-docs && tsup",
34
- "dev": "tsup --watch",
35
- "prepublishOnly": "node scripts/prepublish.js && pnpm build"
36
- },
37
34
  "dependencies": {
38
35
  "commander": "^14.0.0",
39
36
  "fs-extra": "^11.3.0",
@@ -46,5 +43,10 @@
46
43
  "tsup": "^8.5.1",
47
44
  "tsx": "^4.19.2",
48
45
  "typescript": "~5.9.3"
46
+ },
47
+ "scripts": {
48
+ "extract-docs": "tsx scripts/extract-docs.ts",
49
+ "build": "pnpm extract-docs && tsup",
50
+ "dev": "tsup --watch"
49
51
  }
50
- }
52
+ }
@@ -9,3 +9,10 @@ VITE_AIR_JAM_SERVER_URL=http://localhost:4000
9
9
  # Required for production - get from Air Jam platform
10
10
  VITE_AIR_JAM_API_KEY=
11
11
 
12
+ # HTTPS host used only by `pnpm run dev:secure` (set by `pnpm run secure:init`)
13
+ # Example: https://my-game-dev.example.com
14
+ AIR_JAM_SECURE_PUBLIC_HOST=
15
+
16
+ # Named Cloudflare tunnel used by `pnpm run dev:secure`
17
+ # Example: my-airjam-dev
18
+ CLOUDFLARE_TUNNEL_NAME=
@@ -3,13 +3,16 @@ description: Universal project rules and tech stack standards
3
3
  globs: "**/*.ts, **/*.tsx, **/*.js, **/*.jsx, **/*.json"
4
4
  alwaysApply: true
5
5
  ---
6
+
6
7
  # Identity & Goals
8
+
7
9
  - You are a senior frontend architect and full-stack engineer.
8
10
  - Focus on modern, type-safe, and functional programming patterns.
9
11
  - Prioritize maintainability and strict type safety over brevity.
10
- - Use airjam-docs for documentation on the Air Jam SDK.
12
+ - Use ./airjam-docs for documentation on the Air Jam SDK.
11
13
 
12
14
  # Tech Stack (Strict)
15
+
13
16
  - **Manager**: pnpm (monorepo structure)
14
17
  - **Framework**: React (Frontend), Vite (Build)
15
18
  - **Language**: TypeScript (Strict mode)
@@ -17,6 +20,7 @@ alwaysApply: true
17
20
  - **State**: Zustand (Global)
18
21
 
19
22
  # Coding Conventions
23
+
20
24
  - **Naming**:
21
25
  - `camelCase` for variables and functions.
22
26
  - `PascalCase` for React components and Type definitions.
@@ -26,6 +30,7 @@ alwaysApply: true
26
30
  - **Direct Access**: Do NOT pass props (prop drilling) if data is available via Zustand store or React Context.
27
31
 
28
32
  # Type Safety & Linting & State Management
33
+
29
34
  - **Zod First**: Define schema validation with Zod before implementing logic.
30
35
  - **No Any**: `any` are strictly forbidden. Use generic types or specific interfaces.
31
36
  - **TSC**: Code must pass `tsc` check without errors.
@@ -33,12 +38,14 @@ alwaysApply: true
33
38
  - **Zustand**: Use atomic selectors when consuming state to prevent unnecessary re-renders.
34
39
 
35
40
  # File Structure & Refactoring
41
+
36
42
  - **Co-location**:
37
43
  - If a component is used only once, keep it in the same file as the parent.
38
44
  - If a component is used >1 time, extract to `components/` folder.
39
45
  - **Shared Code**: All shared schemas/types must reside in the `packages/shared` workspace.
40
46
 
41
47
  # Agent Behavior
48
+
42
49
  - **Dependencies**: Always use `pnpm add` to install new packages.
43
50
  - **Verification**: Verify file paths before creation. Ensure imports match the `kebab-case` filename convention.
44
- - **Cleanliness**: Remove unused imports and dead code immediately; do not comment them out.
51
+ - **Cleanliness**: Remove unused imports and dead code immediately; do not comment them out.
@@ -7,15 +7,17 @@ A starter template for building multiplayer games with Air Jam. This template in
7
7
  ### Installation
8
8
 
9
9
  1. Install dependencies:
10
+
10
11
  ```bash
11
12
  pnpm install
12
13
  ```
13
14
 
14
15
  2. Configure environment variables (optional - defaults work for local dev):
16
+
15
17
  ```bash
16
- mv .env.example .env.local
18
+ cp .env.example .env.local
17
19
  ```
18
-
20
+
19
21
  Then edit `.env.local` with your settings if needed.
20
22
 
21
23
  ## Local Development
@@ -23,6 +25,7 @@ A starter template for building multiplayer games with Air Jam. This template in
23
25
  ### Option 1: Run Server and Game Separately (Recommended)
24
26
 
25
27
  **Terminal 1 - Start the local server:**
28
+
26
29
  ```bash
27
30
  pnpm run dev:server
28
31
  ```
@@ -30,6 +33,7 @@ pnpm run dev:server
30
33
  The server will start on `http://localhost:4000` in development mode (no authentication required).
31
34
 
32
35
  **Terminal 2 - Start the game:**
36
+
33
37
  ```bash
34
38
  pnpm run dev
35
39
  ```
@@ -51,6 +55,36 @@ If you prefer to use the official Air Jam server instead of running locally:
51
55
  pnpm run dev
52
56
  ```
53
57
 
58
+ ### Option 3: Optional HTTPS for Device Sensors (Gyroscope/Camera)
59
+
60
+ Most local development works on plain HTTP. Use this only when you need secure browser APIs (gyroscope, motion sensors, some camera APIs).
61
+
62
+ One-time setup per project:
63
+
64
+ 1. Log in to Cloudflare Tunnel:
65
+ ```bash
66
+ cloudflared tunnel login
67
+ ```
68
+ 2. Initialize secure mode:
69
+ ```bash
70
+ pnpm run secure:init -- --hostname my-game-dev.example.com --tunnel my-game-dev
71
+ ```
72
+ This writes `.cloudflared/config.yml` and updates `.env.local`.
73
+
74
+ Daily secure dev:
75
+
76
+ ```bash
77
+ pnpm run dev:secure
78
+ ```
79
+
80
+ What `dev:secure` does:
81
+
82
+ - starts local Air Jam server on `http://localhost:4000`
83
+ - starts Vite on `http://localhost:5173`
84
+ - runs your named Cloudflare tunnel
85
+ - serves your host/controller over the configured HTTPS hostname
86
+ - injects `VITE_AIR_JAM_SERVER_URL` and `VITE_AIR_JAM_PUBLIC_HOST` at runtime from `AIR_JAM_SECURE_PUBLIC_HOST`
87
+
54
88
  ## Playing the Game
55
89
 
56
90
  1. Open the game URL in your browser (host view)
@@ -75,6 +109,8 @@ See `.env.example` for all available environment variables. Key variables:
75
109
 
76
110
  - `VITE_AIR_JAM_SERVER_URL` - Server URL (defaults to localhost:4000 for local dev)
77
111
  - `VITE_AIR_JAM_API_KEY` - API key (optional for local dev, required for production)
112
+ - `AIR_JAM_SECURE_PUBLIC_HOST` - HTTPS hostname used by `dev:secure` for host/controller URLs
113
+ - `CLOUDFLARE_TUNNEL_NAME` - Named Cloudflare tunnel used by `dev:secure`
78
114
 
79
115
  ## Production Deployment
80
116
 
@@ -108,4 +144,3 @@ The built files will be in the `dist/` directory.
108
144
  ## License
109
145
 
110
146
  MIT
111
-
@@ -0,0 +1,27 @@
1
+ # For Agents
2
+
3
+ This page is the fastest entrypoint for LLM agents and automation tools.
4
+
5
+ ## What Air Jam Is
6
+
7
+ Air Jam is a multiplayer game platform and SDK where players join sessions by scanning a QR code on their phone.
8
+ Hosts run in your game, inputs are routed through the Air Jam server, and your game consumes typed controller state via React hooks.
9
+
10
+ ## Read These First
11
+
12
+ 1. [Introduction](/docs/getting-started/introduction)
13
+ 2. [Quick Start](/docs/getting-started/quick-start)
14
+ 3. [Architecture](/docs/how-it-works/architecture)
15
+ 4. [Host System](/docs/how-it-works/host-system)
16
+ 5. [SDK Hooks](/docs/sdk/hooks)
17
+
18
+ ## SDK Focus Areas
19
+
20
+ - [Input System](/docs/sdk/input-system)
21
+ - [Networked State](/docs/sdk/networked-state)
22
+
23
+ ## Machine Discovery
24
+
25
+ - [LLMs Index](/llms.txt)
26
+ - [Sitemap](/sitemap.xml)
27
+ - [Robots](/robots.txt)
@@ -13,12 +13,14 @@ Air Jam consists of four main components in a monorepo structure. This page expl
13
13
  **Technology:** Next.js 15, TypeScript, tRPC, BetterAuth, PostgreSQL (Drizzle ORM)
14
14
 
15
15
  **Key Features:**
16
+
16
17
  - **Developer Portal** - Account management, API key generation, analytics
17
18
  - **Game Catalog** - Submit, manage, and discover Air Jam games
18
19
  - **Arcade Mode** - Browse and launch games from a unified interface
19
20
  - **Controller Shell** - Persistent mobile wrapper that loads game controllers
20
21
 
21
22
  **Arcade Mode Flow:**
23
+
22
24
  ```
23
25
  1. Player scans QR on arcade screen
24
26
  2. Platform loads controller shell on phone
@@ -59,6 +61,7 @@ Air Jam consists of four main components in a monorepo structure. This page expl
59
61
  **Technology:** React, Vite, React Three Fiber, Rapier Physics
60
62
 
61
63
  **Demonstrates:**
64
+
62
65
  - Host-side game logic with physics
63
66
  - Controller UI with joystick and buttons
64
67
  - Player spawning/despawning on join/leave
@@ -162,4 +165,4 @@ Controller runs inside platform's shell (iframe communication).
162
165
 
163
166
  - Zod schemas validate all incoming input
164
167
  - Invalid input is rejected with console warning
165
- - Protects game logic from malformed data
168
+ - Protects game logic from malformed data
@@ -27,12 +27,10 @@ pnpm add @air-jam/sdk
27
27
  import { AirJamProvider } from "@air-jam/sdk";
28
28
  import { z } from "zod";
29
29
 
30
- // Define your input schema
30
+ // Define your input schema (matches Pong template)
31
31
  const gameInputSchema = z.object({
32
- vector: z.object({ x: z.number(), y: z.number() }),
33
- action: z.boolean(),
34
- ability: z.boolean(),
35
- timestamp: z.number(),
32
+ direction: z.number().min(-1).max(1), // -1 (up), 0 (stop), 1 (down)
33
+ action: z.boolean(), // e.g. Start Game / Fire
36
34
  });
37
35
 
38
36
  export const App = () => (
@@ -40,8 +38,8 @@ export const App = () => (
40
38
  input={{
41
39
  schema: gameInputSchema,
42
40
  latch: {
43
- booleanFields: ["action", "ability"],
44
- vectorFields: ["vector"],
41
+ // Latch boolean inputs to ensure short taps are caught in the game loop
42
+ booleanFields: ["action"],
45
43
  },
46
44
  }}
47
45
  >
@@ -56,30 +54,39 @@ export const App = () => (
56
54
  ### 3. Create Your Host View
57
55
 
58
56
  ```tsx filename="src/components/HostView.tsx"
59
- import { useAirJamHost } from "@air-jam/sdk";
60
- import { QRCode } from "./QRCode";
57
+ import { HostShell, useAirJamHost } from "@air-jam/sdk";
61
58
 
62
59
  const HostView = () => {
63
60
  const host = useAirJamHost({
64
61
  onPlayerJoin: (player) => {
65
62
  console.log(`${player.label} joined!`);
66
- spawnPlayer(player.id, player.color);
63
+ // Spawn player logic...
67
64
  },
68
65
  onPlayerLeave: (id) => {
69
66
  console.log(`Player ${id} left`);
70
- removePlayer(id);
67
+ // Despawn player logic...
71
68
  },
72
69
  });
73
70
 
71
+ // In your game loop (e.g., useFrame or requestAnimationFrame):
72
+ // host.players.forEach(p => {
73
+ // const input = host.getInput(p.id);
74
+ // if (input) {
75
+ // player.y += input.direction * SPEED;
76
+ // if (input.action) fireLaser(p.id);
77
+ // }
78
+ // });
79
+
74
80
  return (
75
- <div>
76
- <h1>Room: {host.roomId}</h1>
77
- <QRCode value={host.joinUrl} />
78
- <p>Players: {host.players.length}</p>
79
-
80
- {/* Your game canvas */}
81
- <GameCanvas players={host.players} getInput={host.getInput} />
82
- </div>
81
+ <HostShell>
82
+ {/* HostShell automatically provides:
83
+ - Top navbar with room ID and player avatars
84
+ - QR code overlay when paused
85
+ - Play/pause controls
86
+ - Settings panel
87
+ */}
88
+ <GameCanvas />
89
+ </HostShell>
83
90
  );
84
91
  };
85
92
  ```
@@ -87,36 +94,47 @@ const HostView = () => {
87
94
  ### 4. Create Your Controller View
88
95
 
89
96
  ```tsx filename="src/components/ControllerView.tsx"
90
- import { useAirJamController } from "@air-jam/sdk";
91
- import { Joystick, Button } from "./ui";
97
+ import { useAirJamController, ControllerShell } from "@air-jam/sdk";
92
98
 
93
99
  const ControllerView = () => {
94
100
  const controller = useAirJamController();
95
-
96
- const handleInput = (vector: { x: number; y: number }, action: boolean) => {
97
- controller.sendInput({
98
- vector,
99
- action,
100
- ability: false,
101
- timestamp: Date.now(),
102
- });
103
- };
104
101
 
105
- if (controller.connectionStatus !== "connected") {
106
- return <div>Connecting to room {controller.roomId}...</div>;
107
- }
102
+ const sendInput = (direction: number, action: boolean) => {
103
+ controller.sendInput({ direction, action });
104
+ };
108
105
 
109
106
  return (
110
- <div>
111
- <Joystick onMove={(x, y) => handleInput({ x, y }, false)} />
112
- <Button onPress={() => handleInput({ x: 0, y: 0 }, true)}>Fire</Button>
113
- </div>
107
+ // ControllerShell handles connection status, errors, and platform integration
108
+ <ControllerShell forceOrientation="portrait">
109
+ <div className="flex h-full flex-col gap-4 p-4">
110
+ <button
111
+ className="flex-1 rounded-xl bg-blue-500"
112
+ onTouchStart={() => sendInput(-1, false)}
113
+ onTouchEnd={() => sendInput(0, false)}
114
+ >
115
+ UP
116
+ </button>
117
+ <button
118
+ className="flex-1 rounded-xl bg-blue-500"
119
+ onTouchStart={() => sendInput(1, false)}
120
+ onTouchEnd={() => sendInput(0, false)}
121
+ >
122
+ DOWN
123
+ </button>
124
+ <button
125
+ className="h-24 rounded-xl bg-red-500"
126
+ onClick={() => sendInput(0, true)}
127
+ >
128
+ ACTION
129
+ </button>
130
+ </div>
131
+ </ControllerShell>
114
132
  );
115
133
  };
116
134
  ```
117
135
 
118
136
  ## Next Steps
119
137
 
120
- - [Architecture](/docs/getting-started/architecture) - Understand the system design
138
+ - [Architecture](/docs/how-it-works/architecture) - Understand the system design
121
139
  - [Hooks Reference](/docs/sdk/hooks) - Complete API documentation
122
140
  - [Input System](/docs/sdk/input-system) - Learn about latching and validation
@@ -0,0 +1,108 @@
1
+ # Quick Start
2
+
3
+ Get your first Air Jam game up and running in minutes using our project generator.
4
+
5
+ ## 1. Create a New Project
6
+
7
+ The fastest way to start is using our CLI tool. This creates a ready-to-use workspace with a working Pong game, local development server, and SDK configuration.
8
+
9
+ ```bash
10
+ npx create-airjam my-game
11
+ ```
12
+
13
+ After the project is created, navigate into the directory and open it in your editor:
14
+
15
+ ```bash
16
+ cd my-game
17
+ code . # or your preferred editor
18
+ ```
19
+
20
+ ## 2. Start Local Development
21
+
22
+ You'll need two terminal windows to run the local development environment: one for the backend server and one for the game client.
23
+
24
+ **Terminal 1: Start the Server**
25
+ This runs the local WebSocket server that handles game connections.
26
+
27
+ ```bash
28
+ pnpm run dev:server
29
+ ```
30
+
31
+ > **Note:** The local server runs on `http://localhost:4000`.
32
+
33
+ **Terminal 2: Start the Game**
34
+ This runs the game client (Vite).
35
+
36
+ ```bash
37
+ pnpm run dev
38
+ ```
39
+
40
+ ## 3. Play the Game
41
+
42
+ Open your browser and visit:
43
+
44
+ [http://localhost:5173](http://localhost:5173)
45
+
46
+ You should see the Pong template game. You can now:
47
+
48
+ 1. Open the game in your browser (Host view)
49
+ 2. Scan the QR code with your phone (Controller view)
50
+ 3. Play the game!
51
+
52
+ ## Optional: HTTPS for Motion Sensors
53
+
54
+ Most local Air Jam development works on HTTP. Enable HTTPS only when you need secure browser APIs such as gyroscope or motion sensors.
55
+
56
+ 1. One-time Cloudflare login:
57
+ ```bash
58
+ cloudflared tunnel login
59
+ ```
60
+ 2. One-time project secure setup:
61
+ ```bash
62
+ pnpm run secure:init -- --hostname my-game-dev.example.com --tunnel my-game-dev
63
+ ```
64
+ 3. Run secure dev:
65
+ ```bash
66
+ pnpm run dev:secure
67
+ ```
68
+
69
+ This keeps the local Air Jam server on `http://localhost:4000`, tunnels only the Vite host URL through HTTPS, and uses that secure host for controller QR URLs.
70
+ `dev:secure` injects secure `VITE_AIR_JAM_SERVER_URL` and `VITE_AIR_JAM_PUBLIC_HOST` at runtime from `AIR_JAM_SECURE_PUBLIC_HOST`.
71
+
72
+ ## 4. Customize & Build
73
+
74
+ This project is "vibecode friendly"—it includes documentation and AI instructions to help you build faster.
75
+
76
+ - **Check `AI_INSTRUCTIONS.md`**: Provides context for AI coding assistants.
77
+ - **Modify `src/host-view.tsx`**: Contains the main game logic and rendering.
78
+ - **Modify `src/controller-view.tsx`**: Defines the mobile controller interface.
79
+ - **Modify `src/store.ts`**: Manage shared networked state.
80
+ - **Modify `src/types.ts`**: Define your game input schema.
81
+
82
+ ## 5. Deploy Your Game
83
+
84
+ When you're ready to share your game, you'll need to deploy it and connect it to the official Air Jam cloud.
85
+
86
+ 1. **Create a Game Profile**:
87
+ - Go to the [Platform Dashboard](/dashboard)
88
+ - Create a profile and a new game
89
+ - Copy your **API Key**
90
+
91
+ 2. **Deploy the Client**:
92
+ - Deploy your game to a static hosting provider like Vercel, Netlify, or GitHub Pages.
93
+ - Set the following environment variables in your deployment settings:
94
+
95
+ ```bash
96
+ VITE_AIR_JAM_API_KEY=your_api_key_here
97
+ VITE_AIR_JAM_SERVER_URL=wss://api.air-jam.app
98
+ ```
99
+
100
+ ## 6. Publish to Arcade
101
+
102
+ To list your game in the official Air Jam Arcade:
103
+
104
+ 1. Go to your game's settings in the [Dashboard](/dashboard).
105
+ 2. Enter your **deployed game URL** (e.g., `https://my-game.vercel.app`).
106
+ 3. Toggle the **Publish** switch.
107
+
108
+ Your game is now live and playable by anyone in the Arcade!