create-githat-app 0.1.1 → 0.5.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 (63) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +215 -160
  3. package/bin/index.js +2 -3
  4. package/dist/cli.js +1231 -0
  5. package/package.json +27 -7
  6. package/templates/base/.env.example.hbs +13 -0
  7. package/templates/base/.env.local.hbs +10 -0
  8. package/templates/base/.gitignore.hbs +11 -0
  9. package/templates/base/README.md.hbs +94 -0
  10. package/templates/base/githat/api/agents.ts.hbs +17 -0
  11. package/templates/base/githat/api/auth.ts.hbs +38 -0
  12. package/templates/base/githat/api/client.ts.hbs +92 -0
  13. package/templates/base/githat/api/mcp.ts.hbs +21 -0
  14. package/templates/base/githat/api/orgs.ts.hbs +34 -0
  15. package/templates/base/githat/api/types.ts.hbs +70 -0
  16. package/templates/base/githat/api/users.ts.hbs +14 -0
  17. package/templates/base/githat/auth/guard.tsx.hbs +53 -0
  18. package/templates/base/githat/auth/index.ts.hbs +3 -0
  19. package/templates/base/githat/config.ts.hbs +18 -0
  20. package/templates/base/githat/dashboard/agents.tsx.hbs +121 -0
  21. package/templates/base/githat/dashboard/apps.tsx.hbs +53 -0
  22. package/templates/base/githat/dashboard/layout.tsx.hbs +83 -0
  23. package/templates/base/githat/dashboard/mcp-servers.tsx.hbs +111 -0
  24. package/templates/base/githat/dashboard/members.tsx.hbs +123 -0
  25. package/templates/base/githat/dashboard/overview.tsx.hbs +37 -0
  26. package/templates/base/githat/dashboard/settings.tsx.hbs +87 -0
  27. package/templates/nextjs/app/(auth)/forgot-password/page.tsx.hbs +63 -0
  28. package/templates/nextjs/app/(auth)/reset-password/page.tsx.hbs +98 -0
  29. package/templates/nextjs/app/(auth)/sign-in/page.tsx.hbs +9 -0
  30. package/templates/nextjs/app/(auth)/sign-up/page.tsx.hbs +9 -0
  31. package/templates/nextjs/app/(auth)/verify-email/page.tsx.hbs +58 -0
  32. package/templates/nextjs/app/dashboard/agents/page.tsx.hbs +9 -0
  33. package/templates/nextjs/app/dashboard/apps/page.tsx.hbs +9 -0
  34. package/templates/nextjs/app/dashboard/layout.tsx.hbs +28 -0
  35. package/templates/nextjs/app/dashboard/mcp/page.tsx.hbs +9 -0
  36. package/templates/nextjs/app/dashboard/members/page.tsx.hbs +9 -0
  37. package/templates/nextjs/app/dashboard/page.tsx.hbs +30 -0
  38. package/templates/nextjs/app/dashboard/settings/page.tsx.hbs +9 -0
  39. package/templates/nextjs/app/globals.css.hbs +20 -0
  40. package/templates/nextjs/app/layout.tsx.hbs +33 -0
  41. package/templates/nextjs/app/page.tsx.hbs +73 -0
  42. package/templates/nextjs/next.config.ts.hbs +5 -0
  43. package/templates/nextjs/postcss.config.mjs.hbs +9 -0
  44. package/templates/nextjs/proxy.ts.hbs +10 -0
  45. package/templates/nextjs/tsconfig.json.hbs +21 -0
  46. package/templates/react-vite/index.html.hbs +12 -0
  47. package/templates/react-vite/src/App.tsx.hbs +46 -0
  48. package/templates/react-vite/src/index.css.hbs +20 -0
  49. package/templates/react-vite/src/main.tsx.hbs +30 -0
  50. package/templates/react-vite/src/pages/Dashboard.tsx.hbs +68 -0
  51. package/templates/react-vite/src/pages/ForgotPassword.tsx.hbs +58 -0
  52. package/templates/react-vite/src/pages/Home.tsx.hbs +73 -0
  53. package/templates/react-vite/src/pages/SignIn.tsx.hbs +9 -0
  54. package/templates/react-vite/src/pages/SignUp.tsx.hbs +9 -0
  55. package/templates/react-vite/src/pages/VerifyEmail.tsx.hbs +51 -0
  56. package/templates/react-vite/tsconfig.json.hbs +16 -0
  57. package/templates/react-vite/vite.config.ts.hbs +14 -0
  58. package/src/cli.js +0 -131
  59. package/src/scaffold.js +0 -529
  60. package/src/templates/components.js +0 -97
  61. package/src/templates/index.js +0 -172
  62. package/src/templates/pages.js +0 -471
  63. package/src/templates/react.js +0 -191
package/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ # License
2
+
3
+ Copyright (c) 2026 GitHat. All rights reserved.
4
+
5
+ This software and associated documentation files (the "Software") are the
6
+ proprietary property of GitHat. You may use the hosted GitHat service at
7
+ https://githat.io subject to the terms published there.
8
+
9
+ You may NOT copy, modify, merge, publish, distribute, sublicense, or sell
10
+ copies of the Software, or permit others to do so, without the prior written
11
+ permission of GitHat.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ GITHAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
17
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,223 +1,278 @@
1
1
  # create-githat-app
2
2
 
3
- **Ship authenticated apps in seconds, not weeks.**
3
+ Scaffold a production-ready app with a fully-managed backend — auth, teams, orgs, API keys, MCP verification, and AI agent identity. **No backend to deploy.**
4
4
 
5
- `create-githat-app` scaffolds a complete, production-ready application with authentication, team management, and a polished dashboard all wired up and ready to go. One command. Zero boilerplate.
5
+ [GitHat](https://githat.io) is your backend. When you run `create-githat-app`, your generated project connects to GitHat's hosted platform at `api.githat.io`. User accounts, organizations, teams, API keys, MCP servers, and AI agents are all stored and managed by GitHat. You write frontend code only.
6
6
 
7
- [![npm version](https://img.shields.io/npm/v/create-githat-app.svg)](https://www.npmjs.com/package/create-githat-app)
8
- [![license](https://img.shields.io/npm/l/create-githat-app.svg)](https://github.com/GitHat-IO/create-githat-app/blob/main/LICENSE)
7
+ ## Install & Launch
9
8
 
10
- ---
11
-
12
- ## Quick Start
9
+ Run one command from anywhere:
13
10
 
14
11
  ```bash
15
- npx create-githat-app my-app
12
+ npx create-githat-app
16
13
  ```
17
14
 
18
- That's it. You now have a fully functional app with sign-in, sign-up, protected routes, a dashboard, team management, API keys, and more.
15
+ Or with a project name:
19
16
 
20
17
  ```bash
21
- cd my-app
22
- npm run dev
18
+ npx create-githat-app my-app
23
19
  ```
24
20
 
25
- Open [http://localhost:3000](http://localhost:3000) and see it live.
21
+ Or install globally:
26
22
 
27
- ---
23
+ ```bash
24
+ npm i -g create-githat-app
25
+ create-githat-app my-app
26
+ ```
28
27
 
29
- ## What You Get
28
+ The CLI launches an interactive wizard that walks you through every decision.
30
29
 
31
- Every scaffolded app comes with **all of this** out of the box:
30
+ ## How It Works
32
31
 
33
- - **Authentication**Sign in, sign up, sign out, fully wired
34
- - **Forgot / Reset Password** — Complete recovery flow
35
- - **Protected Routes** — Middleware (Next.js) or route guards (React)
36
- - **Dashboard** — Sidebar navigation, responsive layout
37
- - **Settings** — Profile editing, avatar upload, password change
38
- - **Team Management** — Invite members, change roles, remove users
39
- - **API Keys** — Create apps, view and copy publishable/secret keys
40
- - **Email Verification** — Banner prompting unverified users
41
- - **Org Switcher** — Switch between organizations seamlessly
42
- - **Dark Theme** — Beautiful dark UI, responsive on all devices
32
+ ### Step 1 Answer the prompts
43
33
 
44
- No glue code. No half-baked starters. A **complete application** from the first `npm run dev`.
34
+ The CLI asks you a series of questions:
45
35
 
46
- ---
36
+ ```
37
+ ◆ Project name?
38
+ │ my-saas-app
39
+
40
+ ◆ Business name?
41
+ │ Acme Corp
42
+
43
+ ◆ Framework?
44
+ │ ● Next.js 16 (App Router)
45
+ │ ○ React 19 + Vite 7
46
+
47
+ ◆ Language?
48
+ │ ● TypeScript
49
+ │ ○ JavaScript
50
+
51
+ ◆ Package manager?
52
+ │ ● npm
53
+ │ ○ yarn
54
+ │ ○ pnpm
55
+ │ ○ bun
56
+
57
+ ◆ GitHat publishable key?
58
+ │ pk_live_abc123...
59
+
60
+ ◆ Auth features to include?
61
+ │ ◻ Forgot password
62
+ │ ◻ Email verification
63
+ │ ◻ Organization management
64
+ │ ◻ MCP server identity
65
+ │ ◻ AI agent identity
66
+
67
+ ◆ Database?
68
+ │ ● None
69
+ │ ○ Prisma + PostgreSQL
70
+ │ ○ Prisma + MySQL
71
+ │ ○ Drizzle + PostgreSQL
72
+ │ ○ Drizzle + SQLite
73
+
74
+ ◆ Include Tailwind CSS 4?
75
+ │ ● Yes ○ No
76
+
77
+ ◆ Include platform dashboard?
78
+ │ ● Yes ○ No
79
+
80
+ ◆ Initialize git repository?
81
+ │ ● Yes ○ No
82
+
83
+ ◆ Install dependencies now?
84
+ │ ● Yes ○ No
85
+ ```
47
86
 
48
- ## Frameworks
87
+ ### Step 2 — Project is generated
49
88
 
50
- | Framework | Router | Styling | Dev Server |
51
- |--------------------------|--------------------|-----------------------|---------------------|
52
- | **Next.js** (App Router) | File-based routing | CSS Modules / globals | `next dev` on :3000 |
53
- | **React** (Vite) | React Router DOM | CSS / inline styles | `vite` on :5173 |
89
+ ```
90
+ ◇ Project structure created
91
+ ◇ package.json generated
92
+ ◇ Git repository initialized
93
+ ◇ Dependencies installed
54
94
 
55
- ---
95
+ ◇ Setup complete!
96
+ ```
56
97
 
57
- ## CLI Options & Flags
98
+ ### Step 3 Start building
58
99
 
59
100
  ```bash
60
- npx create-githat-app [project-name] [options]
101
+ cd my-saas-app
102
+ npm run dev
61
103
  ```
62
104
 
63
- | Option | Description |
64
- |---------------------------|------------------------------------------------------|
65
- | `project-name` | Directory name for your app (prompted if omitted) |
66
- | `--js` | Use JavaScript instead of TypeScript (Next.js only) |
67
- | `--key <publishable_key>` | Set your GitHat publishable key upfront |
105
+ Your app is running at `http://localhost:3000` with auth, dashboard, and the full GitHat platform wired up.
68
106
 
69
- ### Examples
107
+ ## CLI Flags
70
108
 
71
- ```bash
72
- # Interactive — prompts for everything
73
- npx create-githat-app
109
+ Skip prompts with flags:
74
110
 
75
- # Named project with defaults
76
- npx create-githat-app my-app
111
+ ```bash
112
+ # Use JavaScript instead of TypeScript
113
+ npx create-githat-app my-app --js
77
114
 
78
- # JavaScript project with key pre-configured
79
- npx create-githat-app my-app --js --key pk_live_abc123
80
- ```
115
+ # Use TypeScript (default)
116
+ npx create-githat-app my-app --ts
81
117
 
82
- ---
118
+ # Pass your publishable key directly
119
+ npx create-githat-app my-app --key pk_live_abc123
83
120
 
84
- ## Interactive Prompts
121
+ # Combine flags
122
+ npx create-githat-app my-app --js --key pk_live_abc123
85
123
 
86
- When you run the CLI, you'll be guided through:
124
+ # Show help
125
+ npx create-githat-app --help
87
126
 
88
- 1. **Project name** — if not provided as an argument
89
- 2. **Framework** — Next.js (App Router) or React (Vite)
90
- 3. **Package manager** — npm, pnpm, or yarn
91
- 4. **Publishable key** — optional; you can add it to `.env` later
92
- 5. **Features** — multi-select the pages you want:
93
- - Dashboard
94
- - Settings (profile, avatar, password)
95
- - Team management (invites, roles)
96
- - Apps (API key management)
97
- - Forgot Password (recovery flow)
127
+ # Show version
128
+ npx create-githat-app --version
129
+ ```
98
130
 
99
- Select only what you need, or grab them all.
131
+ ## What You Get
100
132
 
101
- ---
133
+ A production-ready project connected to GitHat's hosted backend:
102
134
 
103
- ## Project Structure
135
+ - **Fully-managed backend** — `api.githat.io` handles auth, orgs, teams, API keys, agents, MCP
136
+ - **Auth pages** — sign-in, sign-up, forgot password, email verification
137
+ - **Protected dashboard** — sidebar navigation, org switcher, user button
138
+ - **`@githat/nextjs` SDK** — `<GitHatProvider>`, `<ProtectedRoute>`, `useAuth()`
139
+ - **`githat/` platform folder** — typed API client for all 42+ backend endpoints
140
+ - **Dark theme** — zinc/purple design system out of the box
141
+ - **Database ready** — Prisma or Drizzle for your app's own data (optional)
142
+ - **Tailwind CSS 4** — utility-first styling (optional)
104
143
 
105
- ### Next.js (App Router)
144
+ ## The `githat/` Folder
106
145
 
107
- ```text
108
- my-app/
109
- ├── app/
110
- │ ├── layout.tsx # GitHatProvider wrapper
111
- │ ├── page.tsx # Home with sign-in/up buttons
112
- │ ├── globals.css
113
- │ ├── middleware.ts # Auth route protection
114
- │ ├── (auth)/
115
- │ │ ├── sign-in/page.tsx
116
- │ │ ├── sign-up/page.tsx
117
- │ │ ├── forgot-password/page.tsx
118
- │ │ └── reset-password/page.tsx
119
- │ └── dashboard/
120
- │ ├── layout.tsx # Protected layout + sidebar
121
- │ ├── page.tsx
122
- │ ├── settings/page.tsx
123
- │ ├── team/page.tsx
124
- │ └── apps/page.tsx
125
- ├── .env.local
126
- ├── .env.example
127
- ├── package.json
128
- └── next.config.mjs
129
- ```
130
-
131
- ### React (Vite)
132
-
133
- ```text
134
- my-app/
135
- ├── src/
136
- │ ├── main.jsx # BrowserRouter + GitHatProvider
137
- │ ├── App.jsx # Route definitions
138
- │ ├── pages/
139
- │ │ ├── Home.jsx
140
- │ │ ├── SignIn.jsx
141
- │ │ ├── SignUp.jsx
142
- │ │ ├── Dashboard.jsx
143
- │ │ ├── DashboardLayout.jsx
144
- │ │ ├── Settings.jsx
145
- │ │ ├── Team.jsx
146
- │ │ ├── Apps.jsx
147
- │ │ ├── ForgotPassword.jsx
148
- │ │ └── ResetPassword.jsx
149
- │ └── components/
150
- │ ├── Sidebar.jsx
151
- │ └── VerifyEmailBanner.jsx
152
- ├── .env
153
- ├── .env.example
154
- ├── index.html
155
- └── vite.config.js
156
- ```
157
-
158
- ---
159
-
160
- ## Configuration
161
-
162
- After scaffolding, add your GitHat publishable key to the environment file:
163
-
164
- **Next.js** — `.env.local`
146
+ Your generated project includes a `githat/` directory — a local integration layer between your app and the GitHat platform API:
165
147
 
166
- ```env
167
- NEXT_PUBLIC_GITHAT_PUBLISHABLE_KEY=pk_live_your_key_here
148
+ ```
149
+ githat/
150
+ config.ts # Central configuration (env vars, feature flags)
151
+ api/
152
+ client.ts # Typed fetch wrapper with token refresh
153
+ types.ts # TypeScript interfaces for all API responses
154
+ auth.ts # Login, register, forgot password, verify email
155
+ orgs.ts # Create/update orgs, invite/remove members
156
+ users.ts # List orgs, switch org
157
+ mcp.ts # Register/verify MCP servers
158
+ agents.ts # Register/verify AI agent wallets
159
+ auth/
160
+ guard.tsx # Role-based route protection component
161
+ index.ts # Auth exports
162
+ dashboard/
163
+ layout.tsx # Dashboard shell with sidebar navigation
164
+ overview.tsx # Stats overview page
165
+ apps.tsx # App + API key management
166
+ members.tsx # Invite members, manage roles, remove
167
+ settings.tsx # Edit org name, brand color, save
168
+ mcp-servers.tsx # Register MCP servers, verify, remove
169
+ agents.tsx # Register AI agent wallets, verify, remove
168
170
  ```
169
171
 
170
- **React (Vite)** `.env`
172
+ All API calls go to `api.githat.io`. The client handles auth tokens and automatic refresh.
171
173
 
172
- ```env
173
- VITE_GITHAT_PUBLISHABLE_KEY=pk_live_your_key_here
174
- ```
174
+ ## Your Backend is GitHat
175
175
 
176
- If you passed `--key pk_live_xxx` during setup, this is already configured for you.
176
+ You don't deploy or maintain a backend. GitHat's hosted platform handles:
177
177
 
178
- > A `.env.example` file is included in every project for reference.
178
+ - **Authentication** sign-up, sign-in, email verification, password reset
179
+ - **Organizations** — create, switch, branding, custom domains
180
+ - **Team management** — invite members by email, assign roles (owner/admin/member), remove
181
+ - **API key management** — publishable + secret keys per app, rotation
182
+ - **MCP server registration** — domain verification via DNS TXT, OAuth2 credentials
183
+ - **AI agent registration** — Ethereum wallet verification, challenge-response tokens
184
+ - **Email delivery** — verification emails, invitations, password resets (via AWS SES)
185
+ - **Database** — users, orgs, teams, apps, agents, MCP servers (DynamoDB, managed by GitHat)
186
+ - **Public verification** — anyone can verify an agent or MCP server at `githat.io/verify/`
179
187
 
180
- ---
188
+ Your data lives in GitHat's infrastructure. You write frontend code, GitHat handles the rest.
181
189
 
182
- ## Getting Your Publishable Key
190
+ ## Three Identity Types
183
191
 
184
- 1. Go to [https://githat.io](https://githat.io) and create an account
185
- 2. Create an organization (or use your default one)
186
- 3. Navigate to **Apps** in the dashboard
187
- 4. Create a new app and copy the **Publishable Key**
188
- 5. Paste it into your `.env.local` or `.env` file
192
+ GitHat supports three types of identity in a single platform:
189
193
 
190
- ---
194
+ | Type | Auth Method | Dashboard Page |
195
+ | --------------- | -------------------------- | -------------- |
196
+ | **Humans** | Email + password | Members |
197
+ | **MCP Servers** | Domain verification | MCP Servers |
198
+ | **AI Agents** | Ethereum wallet signatures | AI Agents |
199
+
200
+ ## Project Structure
191
201
 
192
- ## Dependencies
202
+ ### Next.js 16
193
203
 
194
- The CLI installs only what your chosen framework needs:
204
+ ```
205
+ my-app/
206
+ app/
207
+ layout.tsx
208
+ page.tsx
209
+ globals.css
210
+ (auth)/
211
+ sign-in/page.tsx
212
+ sign-up/page.tsx
213
+ forgot-password/page.tsx
214
+ verify-email/page.tsx
215
+ dashboard/
216
+ layout.tsx
217
+ page.tsx
218
+ apps/page.tsx
219
+ members/page.tsx
220
+ settings/page.tsx
221
+ mcp/page.tsx
222
+ agents/page.tsx
223
+ githat/
224
+ ...
225
+ middleware.ts
226
+ next.config.ts
227
+ .env.local
228
+ ```
195
229
 
196
- **Next.js projects:**
230
+ ### React 19 + Vite 7
197
231
 
198
- - `@githat/nextjs` — GitHat SDK (auth provider, components, hooks)
199
- - `next` — Next.js framework
200
- - `react` / `react-dom` — React
232
+ ```
233
+ my-app/
234
+ src/
235
+ main.tsx
236
+ App.tsx
237
+ index.css
238
+ pages/
239
+ Home.tsx
240
+ SignIn.tsx
241
+ SignUp.tsx
242
+ ForgotPassword.tsx
243
+ VerifyEmail.tsx
244
+ Dashboard.tsx
245
+ githat/
246
+ ...
247
+ index.html
248
+ vite.config.ts
249
+ .env.local
250
+ ```
201
251
 
202
- **React (Vite) projects:**
252
+ ## Environment Variables
203
253
 
204
- - `@githat/nextjs` — GitHat SDK (works with any React setup)
205
- - `react` / `react-dom` — React
206
- - `react-router-dom` — Client-side routing
207
- - `vite` / `@vitejs/plugin-react` — Build tooling
254
+ Generated `.env.local`:
208
255
 
209
- ---
256
+ ```env
257
+ # Next.js
258
+ NEXT_PUBLIC_GITHAT_PUBLISHABLE_KEY=pk_live_...
259
+ NEXT_PUBLIC_GITHAT_API_URL=https://api.githat.io
210
260
 
211
- ## Links
261
+ # React/Vite
262
+ VITE_GITHAT_PUBLISHABLE_KEY=pk_live_...
263
+ VITE_GITHAT_API_URL=https://api.githat.io
264
+ ```
212
265
 
213
- - **GitHat Platform** — [https://githat.io](https://githat.io)
214
- - **SDK Documentation** — [@githat/nextjs on npm](https://www.npmjs.com/package/@githat/nextjs)
215
- - **CLI on npm** — [create-githat-app](https://www.npmjs.com/package/create-githat-app)
216
- - **GitHub** — [GitHat-IO/create-githat-app](https://github.com/GitHat-IO/create-githat-app)
217
- - **Report Issues** — [GitHub Issues](https://github.com/GitHat-IO/create-githat-app/issues)
266
+ ## Contributing
218
267
 
219
- ---
268
+ ```bash
269
+ git clone https://github.com/GitHat-IO/create-githat-app.git
270
+ cd create-githat-app
271
+ npm install
272
+ npm run build
273
+ node bin/index.js test-app
274
+ ```
220
275
 
221
276
  ## License
222
277
 
223
- Proprietary — see [LICENSE](../../LICENSE) for details.
278
+ MIT
package/bin/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { cli } = require('../src/cli');
4
- cli(process.argv.slice(2)).catch((err) => {
5
- console.error(err.message);
3
+ import('../dist/cli.js').catch((err) => {
4
+ console.error(err.message || err);
6
5
  process.exit(1);
7
6
  });