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,271 @@
1
+ generator client {
2
+ provider = "prisma-client-js"
3
+ }
4
+
5
+ datasource db {
6
+ provider = "postgresql"
7
+ url = env("DATABASE_URL")
8
+ }
9
+
10
+ model User {
11
+ id String @id @default(cuid())
12
+ email String @unique
13
+ passwordHash String?
14
+ name String?
15
+ avatarUrl String?
16
+
17
+ // Auth
18
+ emailVerified Boolean @default(false)
19
+ oauthProvider String?
20
+ oauthId String?
21
+
22
+ // Admin flag
23
+ isAdmin Boolean @default(false)
24
+
25
+ // Subscription
26
+ plan String @default("free")
27
+ stripeCustomerId String? @unique
28
+ credits Int @default(0)
29
+ messagesThisMonth Int @default(0)
30
+
31
+ // User settings/context (JSON)
32
+ settings Json @default("{}")
33
+ themePreference String?
34
+
35
+ // Relations
36
+ threads Thread[]
37
+ projects Project[]
38
+ teamMemberships TeamMember[]
39
+ feedback MessageFeedback[]
40
+ templates PromptTemplate[]
41
+ magicLinks MagicLink[]
42
+ mcpCredentials MCPCredential[]
43
+
44
+ createdAt DateTime @default(now())
45
+ updatedAt DateTime @updatedAt
46
+
47
+ @@index([email])
48
+ @@index([stripeCustomerId])
49
+ }
50
+
51
+ model Thread {
52
+ id String @id @default(cuid())
53
+ title String @default("New Chat")
54
+ userId String?
55
+ user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
56
+
57
+ // Agent used for this thread (null = default agent)
58
+ agentId String?
59
+
60
+ // For team threads
61
+ teamId String?
62
+ team Team? @relation(fields: [teamId], references: [id], onDelete: SetNull)
63
+
64
+ // For project threads
65
+ projectId String?
66
+ project Project? @relation(fields: [projectId], references: [id], onDelete: SetNull)
67
+
68
+ // Branching support
69
+ parentThreadId String?
70
+ parentMessageId String?
71
+ parentThread Thread? @relation("ThreadBranches", fields: [parentThreadId], references: [id], onDelete: SetNull)
72
+ branches Thread[] @relation("ThreadBranches")
73
+
74
+ // Archived threads (hidden but preserved)
75
+ archivedAt DateTime?
76
+
77
+ // Relations
78
+ messages Message[]
79
+ sharedLinks SharedThread[]
80
+
81
+ createdAt DateTime @default(now())
82
+ updatedAt DateTime @updatedAt
83
+
84
+ @@index([userId])
85
+ @@index([teamId])
86
+ @@index([projectId])
87
+ @@index([parentThreadId])
88
+ @@index([agentId])
89
+ }
90
+
91
+ model Message {
92
+ id String @id @default(cuid())
93
+ threadId String
94
+ thread Thread @relation(fields: [threadId], references: [id], onDelete: Cascade)
95
+ role String // 'user' | 'assistant' | 'system'
96
+ content String
97
+
98
+ // File attachments (JSON array)
99
+ files Json?
100
+
101
+ // Tool calls and results (JSON)
102
+ toolCalls Json?
103
+ toolResults Json?
104
+
105
+ // Token usage
106
+ inputTokens Int?
107
+ outputTokens Int?
108
+
109
+ // Relations
110
+ feedback MessageFeedback[]
111
+
112
+ createdAt DateTime @default(now())
113
+
114
+ @@index([threadId])
115
+ @@index([createdAt])
116
+ }
117
+
118
+ model MessageFeedback {
119
+ id String @id @default(cuid())
120
+ messageId String
121
+ message Message @relation(fields: [messageId], references: [id], onDelete: Cascade)
122
+ userId String
123
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
124
+ type String // 'up' | 'down'
125
+ comment String?
126
+ createdAt DateTime @default(now())
127
+
128
+ @@unique([messageId, userId])
129
+ @@index([messageId])
130
+ }
131
+
132
+ model SharedThread {
133
+ id String @id @default(cuid())
134
+ shareId String @unique @default(cuid())
135
+ threadId String
136
+ thread Thread @relation(fields: [threadId], references: [id], onDelete: Cascade)
137
+ expiresAt DateTime?
138
+ createdAt DateTime @default(now())
139
+
140
+ @@index([shareId])
141
+ @@index([threadId])
142
+ }
143
+
144
+ model PromptTemplate {
145
+ id String @id @default(cuid())
146
+ userId String
147
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
148
+ name String
149
+ prompt String
150
+ variables Json @default("[]")
151
+ createdAt DateTime @default(now())
152
+ updatedAt DateTime @updatedAt
153
+
154
+ @@index([userId])
155
+ }
156
+
157
+ model MagicLink {
158
+ id String @id @default(cuid())
159
+ token String @unique
160
+ userId String
161
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
162
+ expiresAt DateTime
163
+ usedAt DateTime?
164
+ createdAt DateTime @default(now())
165
+
166
+ @@index([token])
167
+ @@index([userId])
168
+ }
169
+
170
+ model PasswordReset {
171
+ id String @id @default(cuid())
172
+ token String @unique
173
+ email String
174
+ expiresAt DateTime
175
+ usedAt DateTime?
176
+ createdAt DateTime @default(now())
177
+
178
+ @@index([token])
179
+ @@index([email])
180
+ }
181
+
182
+ // Projects - organizational folders for threads with AI context
183
+ model Project {
184
+ id String @id @default(cuid())
185
+ name String
186
+ context String? // AI context for project threads
187
+ color String // hex color from preset list
188
+ sharing String @default("private") // 'private' | 'team'
189
+ userId String // creator
190
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
191
+ teamId String? // optional team association
192
+ team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade)
193
+ threads Thread[]
194
+ archivedAt DateTime? // null = active, set = archived
195
+ createdAt DateTime @default(now())
196
+ updatedAt DateTime @updatedAt
197
+
198
+ @@index([userId])
199
+ @@index([teamId])
200
+ }
201
+
202
+ // Team workspaces
203
+ model Team {
204
+ id String @id @default(cuid())
205
+ name String
206
+ context String? // Additional context passed to AI agent for team threads
207
+ archivedAt DateTime? // null = active, set = archived
208
+
209
+ // Billing fields
210
+ plan String @default("free")
211
+ stripeCustomerId String? @unique
212
+ credits Int @default(0)
213
+ messagesThisMonth Int @default(0)
214
+
215
+ members TeamMember[]
216
+ threads Thread[]
217
+ projects Project[]
218
+ invites TeamInvite[]
219
+ createdAt DateTime @default(now())
220
+ updatedAt DateTime @updatedAt
221
+
222
+ @@index([stripeCustomerId])
223
+ }
224
+
225
+ model TeamMember {
226
+ id String @id @default(cuid())
227
+ teamId String
228
+ team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
229
+ userId String
230
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
231
+ role String // 'owner' | 'admin' | 'member' | 'viewer'
232
+
233
+ createdAt DateTime @default(now())
234
+
235
+ @@unique([teamId, userId])
236
+ @@index([teamId])
237
+ @@index([userId])
238
+ }
239
+
240
+ model TeamInvite {
241
+ id String @id @default(cuid())
242
+ teamId String
243
+ team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
244
+ email String
245
+ role String // 'admin' | 'member' | 'viewer'
246
+ token String @unique
247
+ invitedBy String
248
+ expiresAt DateTime
249
+ acceptedAt DateTime?
250
+ createdAt DateTime @default(now())
251
+
252
+ @@unique([teamId, email])
253
+ @@index([token])
254
+ }
255
+
256
+ // MCP Server Credentials
257
+ model MCPCredential {
258
+ id String @id @default(cuid())
259
+ userId String
260
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
261
+ serverId String
262
+ credentialType String // 'api_key' | 'oauth'
263
+ encryptedData String // Encrypted JSON: {apiKey} or {accessToken, refreshToken, expiresAt}
264
+ oauthState String? // Temporary state during OAuth flow
265
+ codeVerifier String? // PKCE verifier (encrypted)
266
+ createdAt DateTime @default(now())
267
+ updatedAt DateTime @updatedAt
268
+
269
+ @@unique([userId, serverId])
270
+ @@index([userId])
271
+ }
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
2
+ <rect width="100" height="100" rx="20" fill="#6366f1"/>
3
+ <path d="M30 35h40M30 50h30M30 65h35" stroke="white" stroke-width="6" stroke-linecap="round"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
2
+ <rect width="100" height="100" rx="20" fill="#6366f1"/>
3
+ <path d="M30 35h40M30 50h30M30 65h35" stroke="white" stroke-width="6" stroke-linecap="round"/>
4
+ </svg>
@@ -0,0 +1,11 @@
1
+ import type { Config } from '@react-router/dev/config';
2
+
3
+ export default {
4
+ // Server-side rendering enabled
5
+ ssr: true,
6
+
7
+ // Future flags for v7 compatibility
8
+ future: {
9
+ unstable_optimizeDeps: true,
10
+ },
11
+ } satisfies Config;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Production server that serves both the API and the React Router SSR app.
3
+ *
4
+ * This is a single server that handles:
5
+ * - API routes at /api/*, /mcp/*, /v1/*
6
+ * - SSR for all other routes via React Router
7
+ */
8
+ import { createApp } from '@chaaskit/server';
9
+ import { createRequestHandler } from '@react-router/express';
10
+ import express from 'express';
11
+ import path from 'path';
12
+ import { fileURLToPath } from 'url';
13
+
14
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
15
+
16
+ async function startServer() {
17
+ // Create the chaaskit Express app with all API routes
18
+ // serveSpa: false disables the built-in SPA fallback since React Router handles SSR
19
+ const app = await createApp({ serveSpa: false });
20
+
21
+ // Serve static assets from the React Router build
22
+ app.use(
23
+ '/assets',
24
+ express.static(path.join(__dirname, 'build/client/assets'), {
25
+ immutable: true,
26
+ maxAge: '1y',
27
+ })
28
+ );
29
+ app.use(express.static(path.join(__dirname, 'build/client'), { maxAge: '1h' }));
30
+
31
+ // Handle all other routes with React Router SSR
32
+ // This must come after API routes (which are already registered in createApp)
33
+ app.all(
34
+ '*',
35
+ createRequestHandler({
36
+ // @ts-expect-error - build types
37
+ build: await import('./build/server/index.js'),
38
+ })
39
+ );
40
+
41
+ const port = process.env.PORT || 3000;
42
+ app.listen(port, () => {
43
+ console.log(`Server running on port ${port}`);
44
+ console.log(` - API: http://localhost:${port}/api`);
45
+ console.log(` - Frontend: http://localhost:${port}`);
46
+ });
47
+ }
48
+
49
+ startServer().catch((error) => {
50
+ console.error('Failed to start server:', error);
51
+ process.exit(1);
52
+ });
@@ -0,0 +1,8 @@
1
+ import { renderApp } from '@chaaskit/client';
2
+ import '@chaaskit/client/styles';
3
+ import { config } from '../config/app.config';
4
+
5
+ // Render the ChaasKit application
6
+ renderApp(document.getElementById('root'), {
7
+ basePath: config.app.basePath,
8
+ });
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "strict": true,
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true,
10
+ "allowSyntheticDefaultImports": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "react-jsx"
16
+ },
17
+ "include": [
18
+ "app/**/*",
19
+ "config/**/*",
20
+ "extensions/**/*",
21
+ ".react-router/**/*"
22
+ ],
23
+ "exclude": [
24
+ "node_modules"
25
+ ]
26
+ }
@@ -0,0 +1,26 @@
1
+ import { reactRouter } from '@react-router/dev/vite';
2
+ import { defineConfig } from 'vite';
3
+ import tsconfigPaths from 'vite-tsconfig-paths';
4
+
5
+ export default defineConfig({
6
+ plugins: [reactRouter(), tsconfigPaths()],
7
+ server: {
8
+ host: true,
9
+ port: 5173,
10
+ // Proxy API requests to the chaaskit-server
11
+ proxy: {
12
+ '/api': {
13
+ target: 'http://localhost:3000',
14
+ changeOrigin: true,
15
+ },
16
+ '/mcp': {
17
+ target: 'http://localhost:3000',
18
+ changeOrigin: true,
19
+ },
20
+ '/v1': {
21
+ target: 'http://localhost:3000',
22
+ changeOrigin: true,
23
+ },
24
+ },
25
+ },
26
+ });
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "create-chaaskit",
3
+ "version": "0.1.0",
4
+ "description": "CLI to create and manage ChaasKit AI chat SaaS applications",
5
+ "license": "MIT",
6
+ "author": "Matt Ferrante <@ferrants>",
7
+ "homepage": "https://chaaskit.com",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/ferrants/chaaskit.git",
11
+ "directory": "packages/create-chaaskit"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/ferrants/chaaskit/issues"
15
+ },
16
+ "keywords": ["chaaskit", "ai", "chat", "saas", "cli", "create", "scaffold", "template"],
17
+ "type": "module",
18
+ "main": "./dist/index.js",
19
+ "bin": {
20
+ "create-chaaskit": "./dist/index.js"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "templates"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc && npm run copy-templates",
28
+ "copy-templates": "cp -r src/templates dist/",
29
+ "dev": "tsc --watch",
30
+ "typecheck": "tsc --noEmit",
31
+ "clean": "rm -rf dist"
32
+ },
33
+ "dependencies": {
34
+ "commander": "^12.0.0",
35
+ "fs-extra": "^11.2.0",
36
+ "chalk": "^5.3.0",
37
+ "ora": "^8.0.1",
38
+ "prompts": "^2.4.2"
39
+ },
40
+ "devDependencies": {
41
+ "@types/fs-extra": "^11.0.4",
42
+ "@types/node": "^20.11.0",
43
+ "@types/prompts": "^2.4.9",
44
+ "typescript": "^5.3.3"
45
+ }
46
+ }