@digilogiclabs/create-saas-app 1.17.1 → 1.18.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 (45) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/cli/commands/create.d.ts.map +1 -1
  4. package/dist/cli/commands/create.js +6 -2
  5. package/dist/cli/commands/create.js.map +1 -1
  6. package/dist/cli/index.js +1 -1
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/generators/template-generator.d.ts.map +1 -1
  9. package/dist/generators/template-generator.js +13 -7
  10. package/dist/generators/template-generator.js.map +1 -1
  11. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/README.md +655 -0
  12. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +683 -0
  13. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +787 -0
  14. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +346 -0
  15. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +180 -0
  16. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/package.json +113 -0
  17. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +599 -0
  18. package/dist/templates/web/ui-auth-payments-ai-rag/template/README.md +434 -0
  19. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +642 -0
  20. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +466 -0
  21. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +393 -0
  22. package/dist/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +457 -0
  23. package/dist/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +478 -0
  24. package/dist/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +250 -0
  25. package/dist/templates/web/ui-auth-payments-ai-rag/template/package.json +74 -0
  26. package/dist/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +622 -0
  27. package/dist/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +396 -0
  28. package/package.json +1 -1
  29. package/src/templates/mobile/ui-auth-payments-ai-rag/template/README.md +655 -0
  30. package/src/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +683 -0
  31. package/src/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +787 -0
  32. package/src/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +346 -0
  33. package/src/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +180 -0
  34. package/src/templates/mobile/ui-auth-payments-ai-rag/template/package.json +113 -0
  35. package/src/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +599 -0
  36. package/src/templates/web/ui-auth-payments-ai-rag/template/README.md +434 -0
  37. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +642 -0
  38. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +466 -0
  39. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +393 -0
  40. package/src/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +457 -0
  41. package/src/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +478 -0
  42. package/src/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +250 -0
  43. package/src/templates/web/ui-auth-payments-ai-rag/template/package.json +74 -0
  44. package/src/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +622 -0
  45. package/src/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +396 -0
@@ -0,0 +1,250 @@
1
+ import {
2
+ createGenericRAGConfig,
3
+ createPlantCareRAGConfig,
4
+ createEcommerceRAGConfig,
5
+ createEducationRAGConfig
6
+ } from '@digilogiclabs/saas-factory-ai';
7
+ import type {
8
+ RAGConfig,
9
+ GenericRAGDocumentSchema,
10
+ PlantKnowledgeSchema,
11
+ EcommerceKnowledgeSchema,
12
+ EducationKnowledgeSchema
13
+ } from '@digilogiclabs/saas-factory-ai-types';
14
+
15
+ // Environment configuration
16
+ const supabaseConfig = {
17
+ url: process.env.NEXT_PUBLIC_SUPABASE_URL!,
18
+ anonKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
19
+ serviceRoleKey: process.env.SUPABASE_SERVICE_ROLE_KEY, // Server-only for embeddings
20
+ };
21
+
22
+ const openAIKey = process.env.OPENAI_API_KEY!;
23
+
24
+ // RAG Configuration Templates
25
+ export const createRAGConfigs = () => {
26
+ const baseNamespace = process.env.NEXT_PUBLIC_APP_NAME || '{{packageName}}';
27
+
28
+ return {
29
+ // Generic AI Assistant
30
+ generic: createGenericRAGConfig<GenericRAGDocumentSchema>(
31
+ baseNamespace,
32
+ supabaseConfig,
33
+ openAIKey,
34
+ {
35
+ retrieval: {
36
+ topK: 6,
37
+ confidenceThreshold: 0.75,
38
+ hybridSearchWeight: { vector: 0.7, text: 0.3 },
39
+ reranking: true // Enable advanced reranking for web
40
+ },
41
+ generation: {
42
+ systemPrompt: `You are an intelligent AI assistant for the ${baseNamespace} platform.
43
+ Use the provided knowledge base to give accurate, comprehensive responses.
44
+ If information isn't in the knowledge base, clearly state this and provide general guidance.
45
+ Format responses with proper markdown for web display.
46
+ Include relevant examples and actionable recommendations.`,
47
+ temperature: 0.3,
48
+ maxTokens: 800,
49
+ streaming: true, // Enable streaming for better UX
50
+ },
51
+ web: {
52
+ enableStreaming: true,
53
+ showSources: true,
54
+ showConfidence: true,
55
+ enableCitations: true,
56
+ maxDisplaySources: 5,
57
+ }
58
+ }
59
+ ),
60
+
61
+ // Plant Care Assistant
62
+ plantCare: createPlantCareRAGConfig(
63
+ `${baseNamespace}-plants`,
64
+ supabaseConfig,
65
+ openAIKey,
66
+ {
67
+ retrieval: {
68
+ topK: 5,
69
+ confidenceThreshold: 0.8,
70
+ hybridSearchWeight: { vector: 0.8, text: 0.2 },
71
+ categoryFilters: ['plant-care', 'diseases', 'pests', 'nutrition']
72
+ },
73
+ generation: {
74
+ systemPrompt: `You are a botanical expert assistant helping users care for their plants.
75
+ Use the comprehensive plant knowledge base to provide specific care instructions, diagnose issues, and suggest solutions.
76
+ Consider seasonal factors, plant growth stages, and environmental conditions.
77
+ Provide practical, step-by-step guidance with clear explanations.
78
+ Include relevant images or diagrams when referencing visual symptoms.
79
+ Format responses with proper markdown including headers, lists, and emphasis.`,
80
+ temperature: 0.2,
81
+ maxTokens: 1000,
82
+ streaming: true,
83
+ }
84
+ }
85
+ ),
86
+
87
+ // E-commerce Assistant
88
+ ecommerce: createEcommerceRAGConfig(
89
+ `${baseNamespace}-store`,
90
+ supabaseConfig,
91
+ openAIKey,
92
+ {
93
+ retrieval: {
94
+ topK: 8,
95
+ confidenceThreshold: 0.7,
96
+ hybridSearchWeight: { vector: 0.6, text: 0.4 },
97
+ includePriceFilters: true,
98
+ includeAvailability: true
99
+ },
100
+ generation: {
101
+ systemPrompt: `You are a knowledgeable shopping assistant for the ${baseNamespace} store.
102
+ Help customers find products, compare options, answer questions about specifications and pricing.
103
+ Provide personalized recommendations based on their needs, budget, and preferences.
104
+ Always mention current stock status, pricing, and any active promotions.
105
+ Include product comparisons in table format when helpful.
106
+ Format responses with proper markdown and highlight key information.`,
107
+ temperature: 0.4,
108
+ maxTokens: 700,
109
+ streaming: true,
110
+ }
111
+ }
112
+ ),
113
+
114
+ // Education Assistant
115
+ education: createEducationRAGConfig(
116
+ `${baseNamespace}-learning`,
117
+ supabaseConfig,
118
+ openAIKey,
119
+ {
120
+ retrieval: {
121
+ topK: 6,
122
+ confidenceThreshold: 0.8,
123
+ hybridSearchWeight: { vector: 0.75, text: 0.25 },
124
+ gradeLevel: 'adaptive', // Adapt to user level
125
+ subject: 'multi-domain'
126
+ },
127
+ generation: {
128
+ systemPrompt: `You are an educational tutor assistant for the ${baseNamespace} learning platform.
129
+ Help students understand concepts, solve problems, and develop critical thinking skills.
130
+ Adapt explanations to the appropriate learning level and style.
131
+ Provide step-by-step solutions with clear reasoning.
132
+ Include examples, analogies, and practice exercises when helpful.
133
+ Use proper academic formatting with mathematical notation when needed.
134
+ Encourage exploration and deeper understanding.`,
135
+ temperature: 0.3,
136
+ maxTokens: 900,
137
+ streaming: true,
138
+ }
139
+ }
140
+ )
141
+ };
142
+ };
143
+
144
+ // Default configuration selector
145
+ export const getRAGConfigForDomain = (domain: string): RAGConfig<any> => {
146
+ const configs = createRAGConfigs();
147
+
148
+ switch (domain.toLowerCase()) {
149
+ case 'plants':
150
+ case 'plant-care':
151
+ case 'gardening':
152
+ case 'botanical':
153
+ return configs.plantCare;
154
+
155
+ case 'store':
156
+ case 'shop':
157
+ case 'ecommerce':
158
+ case 'products':
159
+ case 'retail':
160
+ return configs.ecommerce;
161
+
162
+ case 'education':
163
+ case 'learning':
164
+ case 'courses':
165
+ case 'study':
166
+ case 'academic':
167
+ return configs.education;
168
+
169
+ default:
170
+ return configs.generic;
171
+ }
172
+ };
173
+
174
+ // Web-specific optimizations
175
+ export const webRAGOptions = {
176
+ // Performance settings
177
+ performance: {
178
+ debounceMs: 200, // Faster debounce for web
179
+ maxConcurrentRequests: 3,
180
+ timeout: 15000, // 15 second timeout
181
+ enableRequestCaching: true,
182
+ cacheExpiryMs: 300000, // 5 minutes
183
+ },
184
+
185
+ // Web UX settings
186
+ ui: {
187
+ enableStreaming: true,
188
+ showTypingIndicator: true,
189
+ showConfidenceScores: true,
190
+ showSources: true,
191
+ showCitations: true,
192
+ maxDisplaySources: 5,
193
+ enableExport: true,
194
+ enableShare: true,
195
+ enableFeedback: true,
196
+ },
197
+
198
+ // Search and filtering
199
+ search: {
200
+ enableAdvancedFilters: true,
201
+ enableFacetedSearch: true,
202
+ enableAutocomplete: true,
203
+ enableSearchHistory: true,
204
+ maxSearchHistory: 20,
205
+ },
206
+
207
+ // Analytics and monitoring
208
+ analytics: {
209
+ trackQueries: true,
210
+ trackResponseTime: true,
211
+ trackUserSatisfaction: true,
212
+ enableABTesting: true,
213
+ },
214
+
215
+ // Admin features
216
+ admin: {
217
+ enableKnowledgeManagement: true,
218
+ enableBulkOperations: true,
219
+ enableAnalyticsDashboard: true,
220
+ enableUserManagement: true,
221
+ enableSystemHealth: true,
222
+ }
223
+ };
224
+
225
+ // Environment-specific configurations
226
+ export const getEnvironmentConfig = () => {
227
+ const isDevelopment = process.env.NODE_ENV === 'development';
228
+ const isProduction = process.env.NODE_ENV === 'production';
229
+
230
+ return {
231
+ logging: {
232
+ level: isDevelopment ? 'debug' : 'info',
233
+ enableConsole: isDevelopment,
234
+ enableRemote: isProduction,
235
+ },
236
+
237
+ security: {
238
+ enableRateLimit: isProduction,
239
+ rateLimitRpm: isProduction ? 60 : 300, // Requests per minute
240
+ enableInputSanitization: true,
241
+ enableOutputFiltering: true,
242
+ },
243
+
244
+ features: {
245
+ enableExperimentalFeatures: isDevelopment,
246
+ enableBetaFeatures: !isProduction,
247
+ enableDebugMode: isDevelopment,
248
+ }
249
+ };
250
+ };
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "{{packageName}}",
3
+ "version": "0.1.0",
4
+ "description": "{{description}} - Full-Stack AI Platform with RAG Knowledge Base (UI v0.18.2 + Auth v1.0.0 + Payments + AI v4.0.0)",
5
+ "private": true,
6
+ "scripts": {
7
+ "dev": "next dev",
8
+ "build": "next build",
9
+ "start": "next start",
10
+ "lint": "next lint",
11
+ "type-check": "tsc --noEmit",
12
+ "test": "vitest",
13
+ "test:ui": "vitest --ui",
14
+ "test:run": "vitest run",
15
+ "setup:rag": "node scripts/setup-rag.js",
16
+ "seed:knowledge": "node scripts/seed-knowledge.js",
17
+ "db:types": "supabase gen types --local > types/supabase.ts",
18
+ "db:reset": "supabase db reset",
19
+ "db:push": "supabase db push"
20
+ },
21
+ "dependencies": {
22
+ "next": "^15.0.0",
23
+ "react": "^19.0.0",
24
+ "react-dom": "^19.0.0",
25
+ "@digilogiclabs/saas-factory-ui": "^0.21.0",
26
+ "@digilogiclabs/saas-factory-auth": "^1.0.1",
27
+ "@digilogiclabs/saas-factory-payments": "^1.1.0",
28
+ "@digilogiclabs/saas-factory-ai": "^4.0.0",
29
+ "@digilogiclabs/saas-factory-ai-types": "^4.0.0",
30
+ "stripe": "^14.0.0",
31
+ "tailwindcss": "^3.3.0",
32
+ "autoprefixer": "^10.4.16",
33
+ "postcss": "^8.4.31",
34
+ "clsx": "^2.0.0",
35
+ "class-variance-authority": "^0.7.0",
36
+ "tailwind-merge": "^2.0.0",
37
+ "next-themes": "^0.2.1",
38
+ "lucide-react": "^0.542.0",
39
+ "zod": "^3.22.4",
40
+ "@supabase/supabase-js": "^2.0.0",
41
+ "@supabase/ssr": "^0.5.0",
42
+ "react-hook-form": "^7.48.2",
43
+ "@hookform/resolvers": "^3.3.2",
44
+ "sonner": "^1.4.3",
45
+ "recharts": "^2.8.0",
46
+ "framer-motion": "^11.0.0",
47
+ "@radix-ui/react-dialog": "^1.0.5",
48
+ "@radix-ui/react-dropdown-menu": "^2.0.6",
49
+ "@radix-ui/react-tabs": "^1.0.4",
50
+ "@radix-ui/react-toast": "^1.1.5",
51
+ "@radix-ui/react-tooltip": "^1.0.7",
52
+ "@radix-ui/react-progress": "^1.0.3",
53
+ "@radix-ui/react-separator": "^1.0.3",
54
+ "@radix-ui/react-badge": "^1.0.4"
55
+ },
56
+ "devDependencies": {
57
+ "typescript": "^5.0.0",
58
+ "@types/node": "^20.0.0",
59
+ "@types/react": "^19.0.0",
60
+ "@types/react-dom": "^19.0.0",
61
+ "eslint": "^8.0.0",
62
+ "eslint-config-next": "^15.0.0",
63
+ "prettier": "^3.0.0",
64
+ "vitest": "^1.0.0",
65
+ "@vitejs/plugin-react": "^4.0.0",
66
+ "@testing-library/react": "^16.0.0",
67
+ "@testing-library/jest-dom": "^6.0.0",
68
+ "@testing-library/user-event": "^14.0.0",
69
+ "jsdom": "^24.0.0"
70
+ },
71
+ "engines": {
72
+ "node": ">=18.0.0"
73
+ }
74
+ }