vasuzex 2.0.5 → 2.0.7

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 (185) hide show
  1. package/README.md +156 -40
  2. package/TODO.md +248 -0
  3. package/apps/pilot-test/api/.env.example +8 -0
  4. package/apps/pilot-test/api/README.md +105 -0
  5. package/apps/pilot-test/api/config/database.js +27 -0
  6. package/apps/pilot-test/api/database/migrations/2025_12_06_19_20_57_create_users_table.js +21 -0
  7. package/apps/pilot-test/api/database/seeders/UserSeeder.js +30 -0
  8. package/apps/pilot-test/api/package.json +26 -0
  9. package/apps/pilot-test/api/src/app.js +67 -0
  10. package/apps/pilot-test/api/src/controllers/AuthController.js +90 -0
  11. package/apps/pilot-test/api/src/controllers/BaseController.js +25 -0
  12. package/apps/pilot-test/api/src/helpers/env.js +8 -0
  13. package/apps/pilot-test/api/src/index.js +112 -0
  14. package/apps/pilot-test/api/src/middleware/authMiddleware.js +48 -0
  15. package/apps/pilot-test/api/src/middleware/errorHandler.js +30 -0
  16. package/apps/pilot-test/api/src/models/User.js +76 -0
  17. package/apps/pilot-test/api/src/requests/AuthRequests.js +16 -0
  18. package/apps/pilot-test/api/src/routes/auth.routes.js +20 -0
  19. package/apps/pilot-test/api/src/routes/index.js +33 -0
  20. package/apps/pilot-test/api/src/routes/post.routes.js +25 -0
  21. package/apps/pilot-test/api/src/services/AuthService.js +95 -0
  22. package/bin/create-vasuzex.js +63 -16
  23. package/config/cache.cjs +11 -0
  24. package/config/cdn.cjs +221 -0
  25. package/config/geoip.cjs +52 -12
  26. package/config/index.cjs +8 -0
  27. package/config/logging.cjs +22 -4
  28. package/config/media.cjs +67 -1
  29. package/config/payment.cjs +184 -0
  30. package/config/security.cjs +230 -0
  31. package/database/index.js +19 -0
  32. package/examples/client-config-routes.js +151 -0
  33. package/examples/debug-example.js +165 -0
  34. package/examples/integration-test.mjs +101 -0
  35. package/examples/test-client-config.mjs +98 -0
  36. package/framework/Console/Commands/utils/apiStructure.js +40 -37
  37. package/framework/Console/Commands/utils/apiTemplates.js +209 -22
  38. package/framework/Console/Commands/utils/packageManager.js +59 -5
  39. package/framework/Console/Commands/utils/templateGenerator.js +683 -48
  40. package/framework/Console/Commands/utils/webStructure.js +39 -2
  41. package/framework/Exceptions/ApiError.js +74 -0
  42. package/framework/Exceptions/ErrorTypes.js +133 -0
  43. package/framework/Exceptions/Handler.js +226 -0
  44. package/framework/Exceptions/asyncHandler.js +42 -0
  45. package/framework/Exceptions/index.js +23 -0
  46. package/framework/Foundation/BaseApp.js +27 -0
  47. package/framework/Foundation/BaseServer.js +6 -0
  48. package/framework/Foundation/BaseService.js +384 -0
  49. package/framework/Foundation/Bootstrap/LoadConfiguration.js +1 -1
  50. package/framework/Foundation/Bootstrap/LoadEnvironmentVariables.js +1 -1
  51. package/framework/Foundation/Providers/AuthServiceProvider.js +1 -1
  52. package/framework/Foundation/Providers/BroadcastServiceProvider.js +1 -1
  53. package/framework/Foundation/Providers/CacheServiceProvider.js +1 -1
  54. package/framework/Foundation/Providers/CookieServiceProvider.js +1 -1
  55. package/framework/Foundation/Providers/EncryptionServiceProvider.js +1 -1
  56. package/framework/Foundation/Providers/EventServiceProvider.js +1 -1
  57. package/framework/Foundation/Providers/HashServiceProvider.js +1 -1
  58. package/framework/Foundation/Providers/LogServiceProvider.js +1 -1
  59. package/framework/Foundation/Providers/NotificationServiceProvider.js +1 -1
  60. package/framework/Foundation/Providers/QueueServiceProvider.js +1 -1
  61. package/framework/Foundation/Providers/RateLimiterServiceProvider.js +1 -1
  62. package/framework/Foundation/Providers/SessionServiceProvider.js +1 -1
  63. package/framework/Foundation/Providers/TranslationServiceProvider.js +1 -1
  64. package/framework/Foundation/Providers/ValidationServiceProvider.js +1 -1
  65. package/framework/Foundation/index.js +1 -0
  66. package/framework/Http/ClientConfigGenerator.js +304 -0
  67. package/framework/Http/Middleware/Authenticate.js +125 -0
  68. package/framework/Http/Middleware/Authorize.js +232 -0
  69. package/framework/Http/Middleware/HandleErrors.js +62 -0
  70. package/framework/Http/Middleware/MediaServerMiddleware.js +452 -0
  71. package/framework/Http/Middleware/RateLimiter.js +133 -0
  72. package/framework/Http/Middleware/SecurityMiddleware.js +234 -0
  73. package/framework/Http/Middleware/ValidateRequest.js +218 -0
  74. package/framework/Http/Middleware/index.js +64 -0
  75. package/framework/Http/index.js +4 -0
  76. package/framework/Patterns/RepositoryFactory.js +238 -0
  77. package/framework/Patterns/ServiceFactory.js +151 -0
  78. package/framework/Patterns/index.js +13 -0
  79. package/framework/Services/Cache/CacheManager.js +21 -0
  80. package/framework/Services/Cache/Stores/FileStore.js +203 -0
  81. package/framework/Services/Cache/Stores/MemoryStore.js +189 -0
  82. package/framework/Services/Formatter/FormatterServiceProvider.js +1 -1
  83. package/framework/Services/GeoIP/GeoIPManager.js +211 -95
  84. package/framework/Services/GeoIP/GeoIPServiceProvider.js +1 -1
  85. package/framework/Services/GeoIP/Providers/GeoIPProvider.js +218 -0
  86. package/framework/Services/GeoIP/Providers/IP2LocationProvider.js +205 -0
  87. package/framework/Services/GeoIP/Providers/MaxMindProvider.js +176 -0
  88. package/framework/Services/GeoIP/Providers/index.js +5 -0
  89. package/framework/Services/Log/Drivers/ConsoleLogger.js +28 -2
  90. package/framework/Services/Log/Drivers/FileLogger.js +79 -8
  91. package/framework/Services/Log/Drivers/SyslogLogger.js +123 -0
  92. package/framework/Services/Log/LogManager.js +18 -2
  93. package/framework/Services/Media/CDNManager.js +265 -0
  94. package/framework/Services/Media/MediaServiceProvider.js +1 -1
  95. package/framework/Services/Media/index.js +2 -0
  96. package/framework/Services/Payment/Gateways/PhonePeGateway.js +304 -0
  97. package/framework/Services/Payment/Gateways/RazorpayGateway.js +393 -0
  98. package/framework/Services/Payment/Gateways/StripeGateway.js +416 -0
  99. package/framework/Services/Payment/PaymentGateway.js +204 -0
  100. package/framework/Services/Payment/PaymentManager.js +259 -0
  101. package/framework/Services/Payment/index.js +5 -0
  102. package/framework/Services/index.js +1 -0
  103. package/framework/Support/Arr.js +14 -0
  104. package/framework/Support/Helpers/DateHelper.js +585 -0
  105. package/framework/Support/Helpers/DebugHelper.js +186 -0
  106. package/framework/Support/Helpers/JwtHelper.js +370 -0
  107. package/framework/Support/Helpers/OtpHelper.js +370 -0
  108. package/framework/Support/Helpers/PaginationHelper.js +381 -0
  109. package/framework/Support/Helpers/ResponseHelper.js +253 -0
  110. package/framework/Support/Helpers/SanitizationHelper.js +363 -0
  111. package/framework/Support/Helpers/ValidationHelper.js +319 -0
  112. package/framework/Support/Helpers/index.js +24 -0
  113. package/framework/Support/index.js +1 -0
  114. package/framework/index.js +7 -0
  115. package/framework/package.json +4 -0
  116. package/frontend/client/Alerts/SwalHelper.js +110 -0
  117. package/frontend/client/Alerts/index.js +6 -0
  118. package/frontend/client/Config/ConfigLoader.js +193 -0
  119. package/frontend/client/Config/index.js +6 -0
  120. package/frontend/client/Errors/FormErrorHandler.js +220 -0
  121. package/frontend/client/Errors/index.js +13 -0
  122. package/frontend/client/Formatters/CurrencyFormatter.js +72 -0
  123. package/frontend/client/Formatters/DateFormatter.js +76 -0
  124. package/frontend/client/Formatters/PhoneFormatter.js +29 -0
  125. package/frontend/client/Formatters/RelativeTimeFormatter.js +73 -0
  126. package/frontend/client/Formatters/index.js +16 -0
  127. package/frontend/client/Http/ApiClient.js +256 -0
  128. package/frontend/client/Http/index.js +6 -0
  129. package/frontend/client/Storage/LocalStorage.js +86 -0
  130. package/frontend/client/Storage/index.js +6 -0
  131. package/frontend/client/Validation/Validators.js +203 -0
  132. package/frontend/client/Validation/YupValidators.js +81 -0
  133. package/frontend/client/Validation/index.js +7 -0
  134. package/frontend/client/index.js +39 -0
  135. package/frontend/client/package.json +84 -0
  136. package/frontend/react-ui/components/Autocomplete/Autocomplete.jsx +369 -0
  137. package/frontend/react-ui/components/Autocomplete/index.js +10 -0
  138. package/frontend/react-ui/components/DataTable/DataTable.jsx +359 -0
  139. package/frontend/react-ui/components/DataTable/Filters.jsx +63 -0
  140. package/frontend/react-ui/components/DataTable/Pagination.jsx +153 -0
  141. package/frontend/react-ui/components/DataTable/TableActions.jsx +53 -0
  142. package/frontend/react-ui/components/DataTable/TableBody.jsx +188 -0
  143. package/frontend/react-ui/components/DataTable/TableHeader.jsx +117 -0
  144. package/frontend/react-ui/components/DataTable/index.js +16 -0
  145. package/frontend/react-ui/components/Forms/FormButtons.jsx +94 -0
  146. package/frontend/react-ui/components/Forms/FormField.jsx +135 -0
  147. package/frontend/react-ui/components/Forms/FormGroup.jsx +58 -0
  148. package/frontend/react-ui/components/Forms/ValidationMessage.jsx +51 -0
  149. package/frontend/react-ui/components/Forms/index.js +12 -0
  150. package/frontend/react-ui/components/PhotoManager/PhotoManager.jsx +335 -0
  151. package/frontend/react-ui/components/PhotoManager/index.js +10 -0
  152. package/frontend/react-ui/hooks/index.js +16 -0
  153. package/frontend/react-ui/hooks/useAnnouncer.js +66 -0
  154. package/frontend/react-ui/hooks/useApiClient.js +37 -0
  155. package/frontend/react-ui/hooks/useAppConfig.js +35 -0
  156. package/frontend/react-ui/hooks/useDebounce.js +48 -0
  157. package/frontend/react-ui/hooks/useFocusTrap.js +82 -0
  158. package/frontend/react-ui/hooks/useKeyboardNavigation.js +128 -0
  159. package/frontend/react-ui/hooks/useLocalStorage.js +79 -0
  160. package/frontend/react-ui/hooks/useValidationErrors.js +130 -0
  161. package/frontend/react-ui/index.js +21 -0
  162. package/frontend/react-ui/package.json +114 -0
  163. package/frontend/react-ui/providers/ApiClientProvider.jsx +68 -0
  164. package/frontend/react-ui/providers/AppConfigProvider.jsx +84 -0
  165. package/frontend/react-ui/providers/VasuzexProvider.jsx +66 -0
  166. package/frontend/react-ui/providers/index.js +11 -0
  167. package/frontend/react-ui/styles/accessibility.css +200 -0
  168. package/frontend/react-ui/utils/accessibility.js +130 -0
  169. package/frontend/react-ui/utils/index.js +16 -0
  170. package/jest.config.js +9 -28
  171. package/jest.config.test.cjs +12 -3
  172. package/jsconfig.json +9 -9
  173. package/package.json +31 -14
  174. package/test-results.txt +6880 -0
  175. package/VASUZEX_FRAMEWORK_ROADMAP.md +0 -1362
  176. package/analyze-codebase.cjs +0 -53
  177. package/config/README.md +0 -54
  178. package/deep-scan-issues.cjs +0 -78
  179. package/framework/Services/Formatter/README.md +0 -379
  180. package/framework/Services/GeoIP/README.md +0 -409
  181. package/framework/Services/Location/README.md +0 -555
  182. package/framework/Services/SMS/README.md +0 -707
  183. package/framework/Services/Upload/README.md +0 -935
  184. package/framework/Services/Validation/README.md +0 -481
  185. package/test-route-pattern.cjs +0 -56
package/README.md CHANGED
@@ -9,6 +9,9 @@
9
9
 
10
10
  ---
11
11
 
12
+ ## STRICT ❌ - NOT FOR PROD USE
13
+
14
+
12
15
  ## 🆕 What's New in V2?
13
16
 
14
17
  ### **Hybrid Dependency Management**
@@ -49,63 +52,164 @@ That's it! The installer will:
49
52
 
50
53
  ## 🚀 Quick Start
51
54
 
52
- ### 1. Create New Project
55
+ ### Option 1: Full Stack App (Recommended)
56
+
57
+ Create a complete full stack application with API backend + Web frontend:
58
+
53
59
  ```bash
60
+ # Create project
54
61
  npx create-vasuzex my-app
55
- cd my-app
56
- ```
57
62
 
58
- ### 2. Generate Your First App
59
- ```bash
60
- # Full-stack app (API + Web)
61
- pnpm exec vasuzex generate:app blog
63
+ # Choose "Full Stack (API + Web)" template
64
+ # Select web framework (React/Vue/Svelte)
65
+ # Configure database (PostgreSQL/MySQL/SQLite)
62
66
 
63
- # API only
64
- pnpm exec vasuzex generate:app shop --type api
67
+ cd my-app
65
68
 
66
- # Web only
67
- pnpm exec vasuzex generate:app admin --type web
68
- ```
69
+ # All config files are automatically copied to ./config/
70
+ # All dependencies installed in root node_modules/
69
71
 
70
- ### 3. Run Database Migrations
71
- ```bash
72
+ # Run migrations
72
73
  pnpm db:migrate
74
+
75
+ # Terminal 1 - Start API server
76
+ cd apps/blog/api
77
+ pnpm dev
78
+
79
+ # Terminal 2 - Start web app
80
+ cd apps/blog/web
81
+ pnpm dev
73
82
  ```
74
83
 
75
- ### 4. Start Development
84
+ - API Server: http://localhost:3000
85
+ - ✅ Web App: http://localhost:3001
86
+ - ✅ All configs in `./config/` directory
87
+
88
+ ### Option 2: Manual App Generation
89
+
76
90
  ```bash
77
- # Start all apps
78
- pnpm dev
91
+ # 1. Create minimal project
92
+ npx create-vasuzex my-app
93
+ cd my-app
79
94
 
80
- # Or start specific app
81
- pnpm dev:blog-api # API at http://localhost:3000
82
- pnpm dev:blog-web # Web at http://localhost:5173
95
+ # 2. Generate apps manually
96
+ pnpm exec vasuzex generate:app blog --type fullstack
97
+ # or
98
+ pnpm exec vasuzex generate:app shop --type api
99
+ pnpm exec vasuzex generate:app admin --type web
83
100
  ```
84
101
 
85
- ### 5. Generated Project Structure
102
+ ### Project Structure After Installation
103
+
86
104
  ```
87
105
  my-app/
106
+ ├── config/ # ⭐ ALL framework configs copied here
107
+ │ ├── app.cjs # Application settings
108
+ │ ├── auth.cjs # JWT authentication
109
+ │ ├── database.cjs # Database connections
110
+ │ ├── filesystems.cjs # File storage (S3, Local)
111
+ │ ├── mail.cjs # Email settings
112
+ │ ├── cache.cjs # Cache drivers
113
+ │ ├── queue.cjs # Queue jobs
114
+ │ ├── session.cjs # Sessions
115
+ │ ├── http.cjs # HTTP server
116
+ │ ├── upload.cjs # File uploads
117
+ │ ├── media.cjs # Media processing
118
+ │ ├── image.cjs # Image manipulation
119
+ │ ├── sms.cjs # SMS services
120
+ │ ├── payment.cjs # Payment gateways
121
+ │ ├── translation.cjs # Multi-language
122
+ │ └── ... (20+ config files)
123
+
88
124
  ├── apps/
89
- ├── blog/
90
- ├── api/ # Express API
91
- ├── src/
92
- │ │ ├── routes/
93
- │ │ └── package.json # Scripts only, NO dependencies
94
- │ │ └── web/ # React/Vue/Svelte app
95
- │ │ ├── src/
96
- │ │ └── package.json # Scripts only, NO dependencies
97
- ├── config/ # Framework config
125
+ └── blog/
126
+ ├── api/ # Backend Express server
127
+ │ ├── src/
128
+ │ │ ├── controllers/ # HTTP controllers
129
+ │ │ ├── services/ # Business logic
130
+ ├── middleware/ # Auth, validation
131
+ ├── routes/ # API routes
132
+ └── models/ # Database models
133
+ │ │ ├── index.js # Server entry point
134
+ │ │ └── package.json # Scripts only (no deps)
135
+ │ │
136
+ │ └── web/ # Frontend React/Vue/Svelte
137
+ │ ├── src/
138
+ │ │ ├── components/
139
+ │ │ ├── pages/
140
+ │ │ └── services/ # API client
141
+ │ ├── index.html
142
+ │ ├── vite.config.js
143
+ │ └── package.json # Scripts only (no deps)
144
+
98
145
  ├── database/
99
- │ ├── models/ # GuruORM models
146
+ │ ├── models/ # Shared GuruORM models
100
147
  │ ├── migrations/ # Database migrations
101
148
  │ └── seeders/ # Database seeders
102
- ├── node_modules/ # Single hoisted node_modules
103
- ├── package.json # ALL dependencies here
104
- ├── .npmrc # Hoisting config
105
- └── pnpm-workspace.yaml # Workspace definition
149
+
150
+ ├── node_modules/ # Single hoisted node_modules (all deps)
151
+ ├── package.json # ALL dependencies defined here
152
+ ├── .env # Root environment config
153
+ ├── pnpm-workspace.yaml # Workspace definition
154
+ └── turbo.json # Build pipeline config
155
+ ```
156
+
157
+ **Key Features:**
158
+ - ✅ **All configs in `./config/`** - Easily customize any framework feature
159
+ - ✅ **Single `node_modules/`** - 64% disk space savings
160
+ - ✅ **Centralized dependencies** - Manage versions in one place
161
+ - ✅ **Zero config for apps** - Apps inherit all dependencies
162
+
163
+ ---
164
+
165
+ ## 🎯 Full Stack Development
166
+
167
+ Vasuzex V2 makes full stack development seamless:
168
+
169
+ ### Backend API (Express)
170
+ ```javascript
171
+ // apps/blog/api/index.js
172
+ import { BaseApp } from 'vasuzex';
173
+
174
+ class BlogServer extends BaseApp {
175
+ async setupRoutes() {
176
+ this.app.use('/api', getAllRoutes());
177
+ }
178
+ }
179
+
180
+ const server = new BlogServer();
181
+ await server.start();
182
+ ```
183
+
184
+ ### Frontend Web (React/Vue/Svelte)
185
+ ```javascript
186
+ // apps/blog/web/src/services/api.js
187
+ import { createApiClient } from '@vasuzex/client';
188
+
189
+ export const api = createApiClient({
190
+ baseURL: 'http://localhost:3000/api'
191
+ });
192
+
193
+ // Usage
194
+ const posts = await api.get('/posts');
195
+ const newPost = await api.post('/posts', { title: 'Hello' });
196
+ ```
197
+
198
+ ### Authentication Flow
199
+ ```javascript
200
+ // Backend: Auto-generated AuthController
201
+ POST /api/auth/register // Register new user
202
+ POST /api/auth/login // Login (returns JWT)
203
+ GET /api/auth/me // Get authenticated user
204
+ POST /api/auth/logout // Logout
205
+
206
+ // Frontend: Auto-configured API client
207
+ const { data } = await api.post('/auth/login', credentials);
208
+ localStorage.setItem('token', data.token);
209
+ api.defaults.headers.common['Authorization'] = `Bearer ${data.token}`;
106
210
  ```
107
211
 
108
- **Key Point:** App `package.json` files contain ONLY scripts. All dependencies in root!
212
+ 📖 **[Full Stack Guide →](./docs/getting-started/fullstack-guide.md)**
109
213
 
110
214
  ---
111
215
 
@@ -475,10 +579,22 @@ pnpm start
475
579
 
476
580
  ## 📚 Documentation
477
581
 
478
- - [Migration Results](./MIGRATION_RESULTS.md) - V2 migration details
479
- - [Dependency Strategy](./docs/DEPENDENCY_MANAGEMENT_STRATEGY.md) - Why hybrid approach?
480
- - [Import Aliases](./docs/IMPORT_ALIASES.md) - How to import modules
481
- - [Getting Started](./docs/getting-started/installation.md) - Detailed setup guide
582
+ ### Getting Started
583
+ - 🚀 [**Full Stack Setup**](./docs/FULL_STACK_SETUP.md) - Quick reference for fullstack apps
584
+ - 📖 [Full Stack Guide](./docs/getting-started/fullstack-guide.md) - Complete fullstack tutorial
585
+ - 📦 [Installation](./docs/getting-started/installation.md) - Detailed setup guide
586
+ - 🏗️ [Project Structure](./docs/getting-started/project-structure.md) - Understanding the structure
587
+
588
+ ### Advanced
589
+ - 🔄 [Migration Results](./MIGRATION_RESULTS.md) - V2 migration details
590
+ - 📦 [Dependency Strategy](./docs/DEPENDENCY_MANAGEMENT_STRATEGY.md) - Why hybrid approach?
591
+ - 🔗 [Import Aliases](./docs/IMPORT_ALIASES.md) - How to import modules
592
+ - 🗄️ [Database Guide](./docs/database/getting-started.md) - Database & migrations
593
+
594
+ ### Configuration
595
+ All 26 config files are in `./config/` directory:
596
+ - `auth.cjs`, `database.cjs`, `mail.cjs`, `sms.cjs`, `payment.cjs`, etc.
597
+ - See [Full Stack Setup](./docs/FULL_STACK_SETUP.md) for complete list
482
598
 
483
599
  ---
484
600
 
package/TODO.md ADDED
@@ -0,0 +1,248 @@
1
+ # VASUZEX v2 - TODO LIST
2
+ > Comprehensive checklist of remaining tasks after recent generator fixes
3
+
4
+ **Last Updated:** Dec 7, 2024
5
+ **Priority:** 🔴 Critical | 🟡 Important | 🟢 Nice to Have
6
+
7
+ ---
8
+
9
+ ## ✅ COMPLETED
10
+
11
+ ### Generator Fixes
12
+ - ✅ Fixed @vasuzex/client imports in templates (was using wrong `vasuzex/client`)
13
+ - ✅ Fixed API response handling (`response.data.data` for actual payload)
14
+ - ✅ Fixed apiClient initialization (using `createApiClient` with proper config)
15
+ - ✅ Fixed logout to manually clear localStorage (no `.clearAuthToken()` method exists)
16
+ - ✅ Fixed import paths in generated code (relative paths, no `#models` aliases)
17
+ - ✅ Added explicit dependencies to generated apps (no hoisting reliance)
18
+ - ✅ Cleaned up unnecessary README files (removed scattered docs)
19
+ - ✅ Verified @vasuzex/client package imports work correctly
20
+
21
+ ### Documentation Cleanup
22
+ - ✅ Deleted unnecessary READMEs from config/, tests/, examples/
23
+ - ✅ Deleted duplicate READMEs from framework/Services/*
24
+ - ✅ Centralized all docs in /docs/ directory
25
+ - ✅ Organized docs structure (getting-started, services, cli, core, frontend)
26
+
27
+ ---
28
+
29
+ ## 🔴 CRITICAL PRIORITY
30
+
31
+ ### 1. **E2E Generator Testing**
32
+ - [ ] Generate fresh fullstack app from scratch
33
+ - [ ] Verify all files created correctly (controllers, models, routes, pages)
34
+ - [ ] Test dependencies install without errors
35
+ - [ ] Run generated API app and verify auth endpoints work
36
+ - [ ] Run generated Web app and verify React auth flow works
37
+ - [ ] Test login/register/logout flow end-to-end
38
+ - [ ] Verify JWT token persistence in localStorage
39
+ - [ ] Check protected routes work correctly
40
+
41
+ **Files to check:**
42
+ - `framework/Console/Commands/generate-app.js`
43
+ - `framework/Console/Commands/utils/apiStructure.js`
44
+ - `framework/Console/Commands/utils/webStructure.js`
45
+
46
+ ### 2. **Vue & Svelte Template Verification**
47
+ - [ ] Check if Vue templates have same issues as React templates had
48
+ - [ ] Check if Svelte templates have same issues
49
+ - [ ] Verify Vue auth flow if it exists (or add TODO to implement)
50
+ - [ ] Verify Svelte auth flow if it exists (or add TODO to implement)
51
+
52
+ **Current Status:**
53
+ - Vue templates exist but NOT VERIFIED for @vasuzex/client usage
54
+ - Svelte templates exist but NOT VERIFIED for @vasuzex/client usage
55
+ - Only React templates were fixed and verified
56
+
57
+ **Files to check:**
58
+ - Lines 1076-1130 in `framework/Console/Commands/utils/templateGenerator.js` (Vue)
59
+ - Lines 1130+ in `framework/Console/Commands/utils/templateGenerator.js` (Svelte)
60
+
61
+ ### 3. **Package Publishing Preparation**
62
+ - [ ] Verify package.json exports are correct for npm publish
63
+ - [ ] Test installation from npm (or local tarball simulation)
64
+ - [ ] Verify CLI bin commands work after npm install
65
+ - [ ] Check if all peer dependencies are listed
66
+ - [ ] Verify @vasuzex/client is properly built before publishing
67
+ - [ ] Test workspace linking vs npm install scenarios
68
+
69
+ **Files to check:**
70
+ - `package.json` (root - main vasuzex package)
71
+ - `frontend/client/package.json` (@vasuzex/client package)
72
+
73
+ ---
74
+
75
+ ## 🟡 IMPORTANT
76
+
77
+ ### 4. **API Template Verification**
78
+ - [ ] Check all generated controllers use correct BaseController pattern
79
+ - [ ] Verify all middleware imports use relative paths (no aliases)
80
+ - [ ] Check AuthService uses correct model imports
81
+ - [ ] Verify database migrations are generated correctly
82
+ - [ ] Test seeder files work with GuruORM
83
+ - [ ] Check .env template has all required variables
84
+
85
+ **Files to check:**
86
+ - `framework/Console/Commands/utils/apiTemplates.js` (all template functions)
87
+
88
+ ### 5. **Config & Database Centralization**
89
+ - [ ] Verify generated apps use /config from root (not app-level config)
90
+ - [ ] Verify generated apps use /database from root (models, migrations)
91
+ - [ ] Check if app.js template uses correct config imports
92
+ - [ ] Test that multiple apps can share same database
93
+ - [ ] Verify migrations run from root, not app directory
94
+
95
+ **Current Design:**
96
+ - Config: Centralized in `/config/` (project root)
97
+ - Database: Centralized in `/database/` (project root)
98
+ - Apps should NOT have their own config/ or database/
99
+
100
+ ### 6. **Monorepo Scripts & Turbo**
101
+ - [ ] Verify turbo.json is configured correctly
102
+ - [ ] Check if dev:app-name scripts are generated in root package.json
103
+ - [ ] Test parallel running of multiple apps
104
+ - [ ] Verify build scripts work for all app types
105
+ - [ ] Check if turbo cache works correctly
106
+
107
+ **Files to check:**
108
+ - `turbo.json`
109
+ - `package.json` (scripts section)
110
+ - `framework/Console/Commands/utils/packageManager.js` (addRootScripts)
111
+
112
+ ---
113
+
114
+ ## 🟢 NICE TO HAVE
115
+
116
+ ### 7. **Frontend Client Package**
117
+ - [ ] Add comprehensive JSDoc documentation to all exports
118
+ - [ ] Add usage examples for each utility
119
+ - [ ] Test tree-shaking works correctly
120
+ - [ ] Verify TypeScript types are exported properly
121
+ - [ ] Add more validators (PAN, GST, Vehicle Number, etc.)
122
+ - [ ] Add Indian-specific formatters (lakhs/crores)
123
+
124
+ **Files to check:**
125
+ - `frontend/client/` (entire package)
126
+ - `frontend/client/README.md` (examples & docs)
127
+
128
+ ### 8. **Error Handling Improvements**
129
+ - [ ] Add better error messages in generators
130
+ - [ ] Validate app names (no spaces, special chars)
131
+ - [ ] Check for port conflicts
132
+ - [ ] Add rollback on failed generation
133
+ - [ ] Better error display (colored, formatted)
134
+
135
+ ### 9. **Testing Infrastructure**
136
+ - [ ] Add tests for generator commands
137
+ - [ ] Test template generation functions
138
+ - [ ] Add integration tests for generated apps
139
+ - [ ] Test @vasuzex/client utilities
140
+ - [ ] Add E2E tests for auth flow
141
+
142
+ **Existing:**
143
+ - Unit tests in `/tests/unit/`
144
+ - E2E placeholder in `/tests/e2e/`
145
+ - Need to add generator-specific tests
146
+
147
+ ### 10. **Documentation Updates**
148
+ - [ ] Update /docs/cli/commands.md with latest generate:app syntax
149
+ - [ ] Add @vasuzex/client usage guide to /docs/frontend/
150
+ - [ ] Document monorepo structure in /docs/getting-started/
151
+ - [ ] Add troubleshooting guide for common errors
152
+ - [ ] Create video walkthrough for generator
153
+
154
+ ---
155
+
156
+ ## 🔍 VERIFICATION CHECKLIST
157
+
158
+ ### Before Publishing v2.0.0:
159
+
160
+ **Package Integrity:**
161
+ - [ ] `vasuzex` package builds successfully
162
+ - [ ] `@vasuzex/client` package builds successfully
163
+ - [ ] No console.log() in production code
164
+ - [ ] No TODO comments in critical code
165
+ - [ ] All imports resolve correctly
166
+
167
+ **Generator Quality:**
168
+ - [ ] Generated API apps run without errors
169
+ - [ ] Generated Web apps run without errors
170
+ - [ ] Auth flow works end-to-end
171
+ - [ ] Database migrations work
172
+ - [ ] Models work with GuruORM
173
+
174
+ **External User Experience:**
175
+ - [ ] `npm create vasuzex@latest myapp` works
176
+ - [ ] Generated apps work WITHOUT monorepo context
177
+ - [ ] Dependencies install correctly
178
+ - [ ] No missing peer dependencies errors
179
+ - [ ] CLI commands accessible via `npx vasuzex`
180
+
181
+ **Code Quality:**
182
+ - [ ] No import aliases in generated code
183
+ - [ ] No hardcoded paths
184
+ - [ ] Proper error handling everywhere
185
+ - [ ] Consistent code style
186
+ - [ ] No security vulnerabilities
187
+
188
+ ---
189
+
190
+ ## 🎯 IMMEDIATE NEXT STEPS
191
+
192
+ 1. **Generate test app:**
193
+ ```bash
194
+ cd /Users/rishi/Desktop/work/vasuzex-v2
195
+ npx vasuzex generate:app testapp --type api --auth
196
+ npx vasuzex generate:app testapp --type web --framework react
197
+ ```
198
+
199
+ 2. **Test generated apps:**
200
+ ```bash
201
+ cd apps/testapp/api
202
+ pnpm install
203
+ pnpm dev
204
+ # Test auth endpoints with curl/Postman
205
+
206
+ cd ../web
207
+ pnpm install
208
+ pnpm dev
209
+ # Test login/register/logout flow
210
+ ```
211
+
212
+ 3. **Check for issues:**
213
+ - File imports work?
214
+ - API responds correctly?
215
+ - Web app connects to API?
216
+ - Token persistence works?
217
+ - Protected routes work?
218
+
219
+ 4. **Fix any bugs found**
220
+
221
+ 5. **Update TODO with findings**
222
+
223
+ ---
224
+
225
+ ## 📝 NOTES
226
+
227
+ ### Known Issues:
228
+ - Vue/Svelte templates NOT verified yet (only React was fixed)
229
+ - No E2E tests for generator yet
230
+ - Documentation needs updates after recent changes
231
+
232
+ ### Design Decisions:
233
+ - Generated apps use explicit dependencies (no hoisting)
234
+ - Import paths are relative (no aliases like #models)
235
+ - @vasuzex/client is separate package on npm
236
+ - Config & database centralized at project root
237
+ - Each app type (api/web) in apps/{name}/{type}/
238
+
239
+ ### Questions to Answer:
240
+ - Should Vue/Svelte have auth templates like React?
241
+ - Should we support Next.js generation?
242
+ - Do we need app-specific config overrides?
243
+ - How to handle database per app vs shared?
244
+
245
+ ---
246
+
247
+ **Status:** In Progress
248
+ **Focus:** E2E testing and Vue/Svelte template verification
@@ -0,0 +1,8 @@
1
+ # PILOT-TEST API Application
2
+ APP_NAME=pilot-test-api
3
+ APP_PORT=3000
4
+ APP_ENV=development
5
+
6
+ # ⚠️ IMPORTANT: Change APP_PORT if running multiple apps
7
+ # Each app needs a unique port number
8
+ # Example: 3000, 3001, 3002, etc.
@@ -0,0 +1,105 @@
1
+ # Pilot-test API
2
+
3
+ Pilot-test application with authentication and framework integration.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ apps/pilot-test/api/
9
+ ├── src/
10
+ │ ├── controllers/ # Controllers (extend BaseController)
11
+ │ │ ├── BaseController.js
12
+ │ │ └── AuthController.js
13
+ │ ├── models/ # Data models
14
+ │ │ └── User.js
15
+ │ ├── services/ # Business logic
16
+ │ │ └── AuthService.js
17
+ │ ├── middleware/ # Express middleware
18
+ │ │ ├── authMiddleware.js
19
+ │ │ └── errorHandler.js
20
+ │ ├── routes/ # API routes
21
+ │ │ └── auth.routes.js
22
+ │ ├── requests/ # Request validators
23
+ │ │ └── AuthRequests.js
24
+ │ ├── app.js # Express app setup
25
+ │ └── index.js # Framework bootstrap
26
+ ├── package.json
27
+ ├── .env
28
+ └── README.md
29
+ ```
30
+
31
+ ## Centralized Config & Database
32
+
33
+ This app uses:
34
+ - **Config**: `/config/` from project root (NO app-level config)
35
+ - **Database**: `/database/` from project root (centralized models & migrations)
36
+
37
+ ## Installation
38
+
39
+ Dependencies are installed from project root:
40
+
41
+ ```bash
42
+ cd /path/to/project-root
43
+ pnpm install
44
+ ```
45
+
46
+ ## Development
47
+
48
+ From project root:
49
+
50
+ ```bash
51
+ pnpm dev:pilot-test-api
52
+ ```
53
+
54
+ Or from app directory:
55
+
56
+ ```bash
57
+ cd apps/pilot-test/api
58
+ pnpm dev
59
+ ```
60
+
61
+ ## API Endpoints
62
+
63
+ ### Health Check
64
+ ```
65
+ GET /health
66
+ ```
67
+
68
+ ### Authentication
69
+ ```
70
+ POST /api/auth/register - Register new user
71
+ POST /api/auth/login - Login user
72
+ GET /api/auth/me - Get current user (protected)
73
+ POST /api/auth/logout - Logout (protected)
74
+ ```
75
+
76
+ ## Authentication Flow
77
+
78
+ 1. **Register:**
79
+ ```bash
80
+ curl -X POST http://localhost:3000/api/auth/register \
81
+ -H "Content-Type: application/json" \
82
+ -d '{"name":"John","email":"john@example.com","password":"123456"}'
83
+ ```
84
+
85
+ 2. **Login:**
86
+ ```bash
87
+ curl -X POST http://localhost:3000/api/auth/login \
88
+ -H "Content-Type: application/json" \
89
+ -d '{"email":"john@example.com","password":"123456"}'
90
+ ```
91
+
92
+ 3. **Access Protected Route:**
93
+ ```bash
94
+ curl -X GET http://localhost:3000/api/auth/me \
95
+ -H "Authorization: Bearer YOUR_TOKEN"
96
+ ```
97
+
98
+ ## Environment Variables
99
+
100
+ ```env
101
+ APP_NAME=pilot-test-api
102
+ APP_PORT=3000
103
+ JWT_SECRET=your-secret-key
104
+ JWT_EXPIRES_IN=7d
105
+ ```
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Database Configuration
3
+ * Uses environment variables via env() helper
4
+ */
5
+
6
+ import { env } from '../helpers/env.js';
7
+
8
+ export default {
9
+ // Database connection URL
10
+ url: env('DATABASE_URL', 'postgresql://user:password@localhost:5432/mydb'),
11
+
12
+ // Connection pool settings
13
+ pool: {
14
+ min: parseInt(env('DB_POOL_MIN', '2')),
15
+ max: parseInt(env('DB_POOL_MAX', '10'))
16
+ },
17
+
18
+ // Migrations path
19
+ migrations: {
20
+ directory: './database/migrations'
21
+ },
22
+
23
+ // Seeds path
24
+ seeds: {
25
+ directory: './database/seeders'
26
+ }
27
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Users Table Migration
3
+ * Creates users table with authentication fields
4
+ */
5
+
6
+ export const up = async (db) => {
7
+ await db.schema.createTable('users', (table) => {
8
+ table.increments('id').primary();
9
+ table.string('name', 255).notNullable();
10
+ table.string('email', 255).unique().notNullable();
11
+ table.string('password', 255).notNullable();
12
+ table.timestamps();
13
+ });
14
+
15
+ console.log('✅ Users table created');
16
+ };
17
+
18
+ export const down = async (db) => {
19
+ await db.schema.dropTableIfExists('users');
20
+ console.log('✅ Users table dropped');
21
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * User Seeder
3
+ * Creates demo users for development
4
+ */
5
+
6
+ import bcrypt from 'bcryptjs';
7
+
8
+ export default class UserSeeder {
9
+ async run(db) {
10
+ const users = [
11
+ {
12
+ name: 'Admin User',
13
+ email: 'admin@example.com',
14
+ password: await bcrypt.hash('password123', 10),
15
+ created_at: new Date(),
16
+ updated_at: new Date()
17
+ },
18
+ {
19
+ name: 'Test User',
20
+ email: 'test@example.com',
21
+ password: await bcrypt.hash('password123', 10),
22
+ created_at: new Date(),
23
+ updated_at: new Date()
24
+ }
25
+ ];
26
+
27
+ await db.table('users').insert(users);
28
+ console.log('✅ Seeded', users.length, 'users');
29
+ }
30
+ }