create-chaaskit 0.1.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 (122) hide show
  1. package/dist/cli.d.ts +3 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/cli.js +25 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/commands/add-infra.d.ts +6 -0
  6. package/dist/commands/add-infra.d.ts.map +1 -0
  7. package/dist/commands/add-infra.js +160 -0
  8. package/dist/commands/add-infra.js.map +1 -0
  9. package/dist/commands/build.d.ts +2 -0
  10. package/dist/commands/build.d.ts.map +1 -0
  11. package/dist/commands/build.js +63 -0
  12. package/dist/commands/build.js.map +1 -0
  13. package/dist/commands/db-sync.d.ts +13 -0
  14. package/dist/commands/db-sync.d.ts.map +1 -0
  15. package/dist/commands/db-sync.js +108 -0
  16. package/dist/commands/db-sync.js.map +1 -0
  17. package/dist/commands/dev.d.ts +7 -0
  18. package/dist/commands/dev.d.ts.map +1 -0
  19. package/dist/commands/dev.js +61 -0
  20. package/dist/commands/dev.js.map +1 -0
  21. package/dist/commands/init.d.ts +9 -0
  22. package/dist/commands/init.d.ts.map +1 -0
  23. package/dist/commands/init.js +214 -0
  24. package/dist/commands/init.js.map +1 -0
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +57 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/templates/.env.example +24 -0
  30. package/dist/templates/README.md +81 -0
  31. package/dist/templates/app/components/AcceptInviteClient.tsx +10 -0
  32. package/dist/templates/app/components/AdminDashboardClient.tsx +10 -0
  33. package/dist/templates/app/components/AdminTeamClient.tsx +10 -0
  34. package/dist/templates/app/components/AdminTeamsClient.tsx +10 -0
  35. package/dist/templates/app/components/AdminUsersClient.tsx +10 -0
  36. package/dist/templates/app/components/ApiKeysClient.tsx +10 -0
  37. package/dist/templates/app/components/AutomationsClient.tsx +10 -0
  38. package/dist/templates/app/components/ChatClient.tsx +13 -0
  39. package/dist/templates/app/components/ClientOnly.tsx +6 -0
  40. package/dist/templates/app/components/DocumentsClient.tsx +10 -0
  41. package/dist/templates/app/components/OAuthConsentClient.tsx +10 -0
  42. package/dist/templates/app/components/PricingClient.tsx +10 -0
  43. package/dist/templates/app/components/TeamSettingsClient.tsx +10 -0
  44. package/dist/templates/app/components/VerifyEmailClient.tsx +10 -0
  45. package/dist/templates/app/entry.client.tsx +12 -0
  46. package/dist/templates/app/entry.server.tsx +67 -0
  47. package/dist/templates/app/root.tsx +91 -0
  48. package/dist/templates/app/routes/_index.tsx +82 -0
  49. package/dist/templates/app/routes/admin._index.tsx +57 -0
  50. package/dist/templates/app/routes/admin.teams.$teamId.tsx +57 -0
  51. package/dist/templates/app/routes/admin.teams._index.tsx +57 -0
  52. package/dist/templates/app/routes/admin.users.tsx +57 -0
  53. package/dist/templates/app/routes/api-keys.tsx +57 -0
  54. package/dist/templates/app/routes/automations.tsx +57 -0
  55. package/dist/templates/app/routes/chat._index.tsx +11 -0
  56. package/dist/templates/app/routes/chat.admin._index.tsx +10 -0
  57. package/dist/templates/app/routes/chat.admin.teams.$teamId.tsx +10 -0
  58. package/dist/templates/app/routes/chat.admin.teams._index.tsx +10 -0
  59. package/dist/templates/app/routes/chat.admin.users.tsx +10 -0
  60. package/dist/templates/app/routes/chat.api-keys.tsx +10 -0
  61. package/dist/templates/app/routes/chat.automations.tsx +10 -0
  62. package/dist/templates/app/routes/chat.documents.tsx +10 -0
  63. package/dist/templates/app/routes/chat.team.$teamId.settings.tsx +10 -0
  64. package/dist/templates/app/routes/chat.thread.$threadId.tsx +11 -0
  65. package/dist/templates/app/routes/chat.tsx +39 -0
  66. package/dist/templates/app/routes/documents.tsx +57 -0
  67. package/dist/templates/app/routes/invite.$token.tsx +10 -0
  68. package/dist/templates/app/routes/login.tsx +334 -0
  69. package/dist/templates/app/routes/oauth.consent.tsx +10 -0
  70. package/dist/templates/app/routes/pricing.tsx +10 -0
  71. package/dist/templates/app/routes/privacy.tsx +197 -0
  72. package/dist/templates/app/routes/register.tsx +398 -0
  73. package/dist/templates/app/routes/shared.$shareId.tsx +226 -0
  74. package/dist/templates/app/routes/team.$teamId.settings.tsx +57 -0
  75. package/dist/templates/app/routes/terms.tsx +173 -0
  76. package/dist/templates/app/routes/thread.$threadId.tsx +102 -0
  77. package/dist/templates/app/routes/verify-email.tsx +10 -0
  78. package/dist/templates/app/routes.ts +47 -0
  79. package/dist/templates/config/app.config.ts +216 -0
  80. package/dist/templates/docs/admin.md +257 -0
  81. package/dist/templates/docs/api-keys.md +403 -0
  82. package/dist/templates/docs/authentication.md +247 -0
  83. package/dist/templates/docs/configuration.md +1212 -0
  84. package/dist/templates/docs/custom-pages.md +466 -0
  85. package/dist/templates/docs/deployment.md +362 -0
  86. package/dist/templates/docs/development.md +411 -0
  87. package/dist/templates/docs/documents.md +293 -0
  88. package/dist/templates/docs/extensions.md +639 -0
  89. package/dist/templates/docs/index.md +139 -0
  90. package/dist/templates/docs/installation.md +286 -0
  91. package/dist/templates/docs/mcp.md +952 -0
  92. package/dist/templates/docs/native-tools.md +688 -0
  93. package/dist/templates/docs/queue.md +514 -0
  94. package/dist/templates/docs/scheduled-prompts.md +279 -0
  95. package/dist/templates/docs/settings.md +415 -0
  96. package/dist/templates/docs/slack.md +318 -0
  97. package/dist/templates/docs/styling.md +288 -0
  98. package/dist/templates/extensions/agents/.gitkeep +0 -0
  99. package/dist/templates/extensions/pages/.gitkeep +0 -0
  100. package/dist/templates/extensions/payment-plans/.gitkeep +0 -0
  101. package/dist/templates/index.html +16 -0
  102. package/dist/templates/infra-aws/.github/workflows/deploy.yml +95 -0
  103. package/dist/templates/infra-aws/README.md +207 -0
  104. package/dist/templates/infra-aws/bin/cdk.ts +18 -0
  105. package/dist/templates/infra-aws/cdk.json +43 -0
  106. package/dist/templates/infra-aws/config/deployment.ts +156 -0
  107. package/dist/templates/infra-aws/lib/chaaskit-stack.ts +419 -0
  108. package/dist/templates/infra-aws/package.json +27 -0
  109. package/dist/templates/infra-aws/scripts/build-app.sh +63 -0
  110. package/dist/templates/infra-aws/tsconfig.json +25 -0
  111. package/dist/templates/package.json +46 -0
  112. package/dist/templates/prisma/schema/base.prisma +584 -0
  113. package/dist/templates/prisma/schema/custom.prisma +24 -0
  114. package/dist/templates/prisma/schema.prisma +271 -0
  115. package/dist/templates/public/favicon.svg +4 -0
  116. package/dist/templates/public/logo.svg +4 -0
  117. package/dist/templates/react-router.config.ts +11 -0
  118. package/dist/templates/server.js +52 -0
  119. package/dist/templates/src/main.tsx +8 -0
  120. package/dist/templates/tsconfig.json +26 -0
  121. package/dist/templates/vite.config.ts +26 -0
  122. package/package.json +46 -0
@@ -0,0 +1,139 @@
1
+ # {{PROJECT_NAME}} Documentation
2
+
3
+ Welcome to your ChaasKit application. This documentation covers how to configure, extend, and deploy your app.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Configure environment
9
+ cp .env.example .env
10
+ # Edit .env with your DATABASE_URL and API keys
11
+
12
+ # Setup database
13
+ pnpm db:push
14
+
15
+ # Start development
16
+ pnpm dev
17
+ ```
18
+
19
+ Your app will be available at:
20
+ - **Frontend**: http://localhost:5173
21
+ - **Backend**: http://localhost:3000
22
+
23
+ ## Documentation
24
+
25
+ ### Getting Started
26
+ | Guide | Description |
27
+ |-------|-------------|
28
+ | [Installation](./installation.md) | Initial setup and requirements |
29
+ | [Configuration](./configuration.md) | App settings, theming, AI providers |
30
+ | [Development](./development.md) | Development workflow and tips |
31
+ | [Deployment](./deployment.md) | Production deployment guide |
32
+
33
+ ### Features
34
+ | Guide | Description |
35
+ |-------|-------------|
36
+ | [Authentication](./authentication.md) | Email/password, OAuth, Magic Links |
37
+ | [Custom Pages](./custom-pages.md) | Adding marketing pages, landing pages |
38
+ | [Documents](./documents.md) | Mentionable documents with @mentions |
39
+ | [API Keys](./api-keys.md) | Programmatic API access |
40
+ | [MCP Integration](./mcp.md) | Connect AI to external tools |
41
+ | [Native Tools](./native-tools.md) | Built-in tools and creating custom ones |
42
+
43
+ ### Advanced
44
+ | Guide | Description |
45
+ |-------|-------------|
46
+ | [Extensions](./extensions.md) | Custom agents, pages, payment plans |
47
+ | [Queue System](./queue.md) | Background jobs and async processing |
48
+ | [Scheduled Prompts](./scheduled-prompts.md) | Automated recurring AI tasks |
49
+ | [Slack Integration](./slack.md) | Connect your app to Slack |
50
+ | [Admin Dashboard](./admin.md) | Site-wide administration |
51
+ | [Settings](./settings.md) | User preferences and settings |
52
+ | [Styling](./styling.md) | UI conventions and theming |
53
+
54
+ ## Project Structure
55
+
56
+ ```
57
+ {{PROJECT_NAME}}/
58
+ ├── config/
59
+ │ └── app.config.ts # Your app configuration
60
+ ├── docs/ # This documentation
61
+ ├── extensions/
62
+ │ ├── agents/ # Custom AI agents
63
+ │ ├── payment-plans/ # Custom pricing plans
64
+ │ └── pages/ # Custom frontend pages
65
+ ├── prisma/
66
+ │ └── schema.prisma # Database schema
67
+ ├── public/
68
+ │ └── logo.svg # Your logo
69
+ ├── src/
70
+ │ └── main.tsx # Frontend entry point
71
+ ├── .env # Environment variables (create from .env.example)
72
+ ├── index.html
73
+ ├── package.json
74
+ └── vite.config.ts
75
+ ```
76
+
77
+ ## Key Files
78
+
79
+ | File | Purpose |
80
+ |------|---------|
81
+ | `config/app.config.ts` | Main configuration (UI, themes, auth, AI, payments) |
82
+ | `.env` | Environment variables and secrets |
83
+ | `prisma/schema.prisma` | Database schema |
84
+ | `public/logo.svg` | Application logo |
85
+ | `extensions/` | Your custom code |
86
+
87
+ ## Commands
88
+
89
+ ```bash
90
+ pnpm dev # Start development servers
91
+ pnpm build # Build for production
92
+ pnpm start # Run production server
93
+ pnpm db:push # Push schema changes (development)
94
+ pnpm db:migrate # Run migrations (production)
95
+ pnpm db:studio # Open Prisma Studio GUI
96
+ pnpm db:generate # Regenerate Prisma client
97
+ pnpm typecheck # Run TypeScript checks
98
+ ```
99
+
100
+ ## Environment Variables
101
+
102
+ Required in `.env`:
103
+
104
+ ```bash
105
+ # Database
106
+ DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
107
+
108
+ # Auth secrets (min 32 chars - generate with: openssl rand -base64 32)
109
+ SESSION_SECRET=your-session-secret
110
+ JWT_SECRET=your-jwt-secret
111
+
112
+ # AI Provider (at least one required)
113
+ ANTHROPIC_API_KEY=sk-ant-...
114
+ # or
115
+ OPENAI_API_KEY=sk-...
116
+
117
+ # URLs
118
+ APP_URL=http://localhost:5173
119
+ API_URL=http://localhost:3000
120
+ ```
121
+
122
+ Optional:
123
+ ```bash
124
+ # Payments
125
+ STRIPE_SECRET_KEY=sk_...
126
+ STRIPE_WEBHOOK_SECRET=whsec_...
127
+
128
+ # OAuth
129
+ GOOGLE_CLIENT_ID=...
130
+ GOOGLE_CLIENT_SECRET=...
131
+ GITHUB_CLIENT_ID=...
132
+ GITHUB_CLIENT_SECRET=...
133
+ ```
134
+
135
+ ## Getting Help
136
+
137
+ - Check the documentation in this `docs/` folder
138
+ - Review `config/app.config.ts` for available options
139
+ - See the [ChaasKit Template repository](https://github.com/your-org/chaaskit) for updates
@@ -0,0 +1,286 @@
1
+ # Installation
2
+
3
+ ChaasKit uses React Router v7 framework mode to provide a full-stack application with server-side rendering and a rich client experience.
4
+
5
+ ## Prerequisites
6
+
7
+ - **Node.js** 18 or higher
8
+ - **pnpm** 8 or higher (recommended) or npm/yarn
9
+ - **PostgreSQL** 14 or higher
10
+
11
+ ## Create a New Project
12
+
13
+ ```bash
14
+ # Create a new ChaasKit project
15
+ npx chaaskit create my-app
16
+
17
+ # Navigate to your project
18
+ cd my-app
19
+ ```
20
+
21
+ Or with options:
22
+ ```bash
23
+ npx chaaskit create my-app --skip-install --use-npm
24
+ ```
25
+
26
+ ## Configure Environment
27
+
28
+ Copy the example environment file and configure it:
29
+
30
+ ```bash
31
+ cp .env.example .env
32
+ ```
33
+
34
+ Edit `.env` with your settings:
35
+
36
+ ```bash
37
+ # Database (required)
38
+ DATABASE_URL="postgresql://user:password@localhost:5432/my_app"
39
+
40
+ # Auth secrets (required - generate with: openssl rand -base64 32)
41
+ SESSION_SECRET=your-session-secret-min-32-chars
42
+ JWT_SECRET=your-jwt-secret-min-32-chars
43
+
44
+ # AI Provider (at least one required)
45
+ OPENAI_API_KEY=sk-...
46
+ # or
47
+ ANTHROPIC_API_KEY=sk-ant-...
48
+
49
+ # Application URLs (optional in development)
50
+ APP_URL=http://localhost:5173
51
+ API_URL=http://localhost:3000
52
+ ```
53
+
54
+ ## Setup Database
55
+
56
+ Push the schema to your database:
57
+
58
+ ```bash
59
+ pnpm db:push
60
+ ```
61
+
62
+ This creates all the required tables. For production, use migrations instead:
63
+
64
+ ```bash
65
+ pnpm db:migrate
66
+ ```
67
+
68
+ ## Start Development
69
+
70
+ ```bash
71
+ pnpm dev
72
+ ```
73
+
74
+ This starts:
75
+ - The React Router dev server with HMR at `http://localhost:5173`
76
+ - The Express API server at `http://localhost:3000`
77
+
78
+ Visit `http://localhost:5173` to see your app!
79
+
80
+ ## Project Structure
81
+
82
+ ```
83
+ my-app/
84
+ ├── app/
85
+ │ ├── routes/ # React Router v7 routes
86
+ │ │ ├── _index.tsx # Landing page (/)
87
+ │ │ ├── login.tsx # Login page (/login)
88
+ │ │ ├── register.tsx # Register page (/register)
89
+ │ │ ├── chat._index.tsx # Main chat (/chat)
90
+ │ │ ├── chat.thread.$threadId.tsx # Thread view (/chat/thread/:id)
91
+ │ │ ├── chat.documents.tsx # Documents page (/chat/documents)
92
+ │ │ └── ... # Other routes
93
+ │ ├── components/ # Client wrapper components
94
+ │ │ ├── ChatClient.tsx # Chat page client wrapper
95
+ │ │ ├── ClientOnly.tsx # SSR boundary component
96
+ │ │ └── ...
97
+ │ ├── root.tsx # HTML shell, theme, providers
98
+ │ ├── routes.ts # Route configuration
99
+ │ ├── entry.client.tsx # Client-side entry
100
+ │ └── entry.server.tsx # Server-side entry
101
+ ├── config/
102
+ │ └── app.config.ts # Application configuration
103
+ ├── extensions/
104
+ │ ├── agents/ # Custom AI agents
105
+ │ ├── payment-plans/ # Custom pricing plans
106
+ │ └── pages/ # Custom frontend pages
107
+ ├── prisma/
108
+ │ └── schema/
109
+ │ ├── base.prisma # ChaasKit models (synced from package)
110
+ │ └── custom.prisma # Your custom models
111
+ ├── public/
112
+ │ ├── logo.svg # Your logo
113
+ │ └── favicon.svg # Favicon
114
+ ├── .env # Environment variables
115
+ ├── server.js # Production server
116
+ ├── vite.config.ts # Vite configuration
117
+ ├── react-router.config.ts # React Router configuration
118
+ └── package.json
119
+ ```
120
+
121
+ ## Configure Your App
122
+
123
+ Edit `config/app.config.ts` to customize your application:
124
+
125
+ ```typescript
126
+ import type { AppConfig } from '@chaaskit/shared';
127
+
128
+ export const config: AppConfig = {
129
+ app: {
130
+ name: 'My Chat App',
131
+ description: 'AI-powered chat application',
132
+ url: 'http://localhost:5173',
133
+ basePath: '/chat', // Chat app routes live under /chat
134
+ },
135
+
136
+ agent: {
137
+ type: 'built-in',
138
+ provider: 'openai', // or 'anthropic'
139
+ model: 'gpt-4o-mini',
140
+ systemPrompt: 'You are a helpful AI assistant.',
141
+ },
142
+
143
+ // Enable features
144
+ teams: { enabled: true },
145
+ projects: {
146
+ enabled: true,
147
+ colors: ['#6366f1', '#8b5cf6', '#ec4899', /* ... */],
148
+ },
149
+ documents: {
150
+ enabled: true,
151
+ storage: { provider: 'database' },
152
+ },
153
+
154
+ // ... see Configuration docs for all options
155
+ };
156
+ ```
157
+
158
+ See [Configuration](./configuration.md) for all available options.
159
+
160
+ ## Updating ChaasKit
161
+
162
+ When new versions of ChaasKit are released:
163
+
164
+ ```bash
165
+ # 1. Update the packages
166
+ pnpm update @chaaskit/server @chaaskit/client @chaaskit/db @chaaskit/shared
167
+
168
+ # 2. Sync the database schema
169
+ # This updates base.prisma with new models while preserving your custom.prisma
170
+ pnpm db:sync
171
+
172
+ # 3. Regenerate Prisma client
173
+ pnpm db:generate
174
+
175
+ # 4. Apply any schema changes to your database
176
+ pnpm db:push
177
+ ```
178
+
179
+ The `db:sync` command is safe to run - it only updates `prisma/schema/base.prisma` (the ChaasKit models) and never touches your custom models in `prisma/schema/custom.prisma`.
180
+
181
+ ## Database Options
182
+
183
+ ### Local PostgreSQL
184
+
185
+ ```bash
186
+ # Create a database
187
+ createdb my_app
188
+
189
+ # Connection string
190
+ DATABASE_URL="postgresql://localhost:5432/my_app"
191
+ ```
192
+
193
+ ### Supabase
194
+
195
+ 1. Create a project at [supabase.com](https://supabase.com)
196
+ 2. Go to Settings > Database
197
+ 3. Use the "Transaction pooler" connection string for Prisma
198
+
199
+ ### Neon
200
+
201
+ 1. Create a project at [neon.tech](https://neon.tech)
202
+ 2. Copy the connection string
203
+ 3. Enable connection pooling for production
204
+
205
+ ## AI Provider Setup
206
+
207
+ ### Anthropic
208
+
209
+ 1. Get an API key from [console.anthropic.com](https://console.anthropic.com)
210
+ 2. Set `ANTHROPIC_API_KEY` in `.env`
211
+ 3. Configure in `config/app.config.ts`:
212
+ ```typescript
213
+ agent: {
214
+ type: 'built-in',
215
+ provider: 'anthropic',
216
+ model: 'claude-sonnet-4-20250514',
217
+ }
218
+ ```
219
+
220
+ ### OpenAI
221
+
222
+ 1. Get an API key from [platform.openai.com](https://platform.openai.com)
223
+ 2. Set `OPENAI_API_KEY` in `.env`
224
+ 3. Configure in `config/app.config.ts`:
225
+ ```typescript
226
+ agent: {
227
+ type: 'built-in',
228
+ provider: 'openai',
229
+ model: 'gpt-4o-mini',
230
+ }
231
+ ```
232
+
233
+ ## Verification
234
+
235
+ After setup, verify everything works:
236
+
237
+ 1. Open `http://localhost:5173`
238
+ 2. You should see the landing page
239
+ 3. Click "Get Started" or navigate to `/login`
240
+ 4. Register a new account
241
+ 5. Send a test message in the chat
242
+ 6. Check the terminal for any errors
243
+
244
+ ## Troubleshooting
245
+
246
+ ### Database connection issues
247
+
248
+ - Ensure PostgreSQL is running
249
+ - Check the connection string format
250
+ - Verify the database exists: `createdb my_app`
251
+
252
+ ### "Module not found" errors
253
+
254
+ ```bash
255
+ # Clean install
256
+ rm -rf node_modules
257
+ pnpm install
258
+ ```
259
+
260
+ ### Config not loading
261
+
262
+ The server looks for config in this order:
263
+ 1. Programmatic config (via `setConfig()`)
264
+ 2. `CHAASKIT_CONFIG_PATH` environment variable
265
+ 3. `./config/app.config.ts` (relative to cwd)
266
+ 4. `./config/app.config.js`
267
+ 5. Default built-in config
268
+
269
+ ### Type errors
270
+
271
+ ```bash
272
+ # Regenerate Prisma client
273
+ pnpm db:generate
274
+ pnpm typecheck
275
+ ```
276
+
277
+ ### Theme/hydration warnings
278
+
279
+ If you see hydration warnings about `data-theme`, ensure your `app/root.tsx` uses the cookie-based theme sync pattern (this is set up by default in new projects).
280
+
281
+ ## Next Steps
282
+
283
+ - [Configuration](./configuration.md) - Customize the application
284
+ - [Extensions](./extensions.md) - Add custom functionality
285
+ - [Development](./development.md) - Learn the development workflow
286
+ - [Deployment](./deployment.md) - Deploy to production