@veloxts/core 0.6.26 → 0.6.29

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 (3) hide show
  1. package/CHANGELOG.md +375 -0
  2. package/GUIDE.md +220 -0
  3. package/package.json +5 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,375 @@
1
+ # @veloxts/core
2
+
3
+ ## 0.6.29
4
+
5
+ ### Patch Changes
6
+
7
+ - add multi-tenancy and PostgreSQL support - test and lint fix
8
+
9
+ ## 0.6.28
10
+
11
+ ### Patch Changes
12
+
13
+ - add multi-tenancy support and postgresql database
14
+
15
+ ## 0.6.27
16
+
17
+ ### Patch Changes
18
+
19
+ - chore: add GUIDE, LICENSE and CHANGELOG.md to npm files
20
+
21
+ ## 0.6.26
22
+
23
+ ### Patch Changes
24
+
25
+ - docs(mcp): add README and GUIDE, docs(web): simplify README and create concise GUIDE
26
+
27
+ ## 0.6.25
28
+
29
+ ### Patch Changes
30
+
31
+ - docs(create): add guide for React Server Components setup
32
+
33
+ ## 0.6.24
34
+
35
+ ### Patch Changes
36
+
37
+ - clarify installation paths and package contents
38
+
39
+ ## 0.6.23
40
+
41
+ ### Patch Changes
42
+
43
+ - add defineContract for improved type inference DX
44
+
45
+ ## 0.6.22
46
+
47
+ ### Patch Changes
48
+
49
+ - support {method, path} route entry format
50
+
51
+ ## 0.6.21
52
+
53
+ ### Patch Changes
54
+
55
+ - separate schemas from procedures for browser-safe import
56
+
57
+ ## 0.6.20
58
+
59
+ ### Patch Changes
60
+
61
+ - add Fastify ecosystem stubs and debuglog to util
62
+
63
+ ## 0.6.19
64
+
65
+ ### Patch Changes
66
+
67
+ - restore dotenv stub for browser compatibility
68
+
69
+ ## 0.6.18
70
+
71
+ ### Patch Changes
72
+
73
+ - add node:fs/promises stub and fix esbuild plugin
74
+
75
+ ## 0.6.17
76
+
77
+ ### Patch Changes
78
+
79
+ - remove optimizeDeps.exclude to fix CJS/ESM interop
80
+
81
+ ## 0.6.16
82
+
83
+ ### Patch Changes
84
+
85
+ - add stubs for Fastify ecosystem packages
86
+
87
+ ## 0.6.15
88
+
89
+ ### Patch Changes
90
+
91
+ - implement three-layer Node.js stubbing for Vite
92
+
93
+ ## 0.6.14
94
+
95
+ ### Patch Changes
96
+
97
+ - stub dotenv as virtual module instead of process shims
98
+
99
+ ## 0.6.13
100
+
101
+ ### Patch Changes
102
+
103
+ - add process.argv stub for dotenv browser compatibility
104
+
105
+ ## 0.6.12
106
+
107
+ ### Patch Changes
108
+
109
+ - Fixes the "process is not defined" error from dotenv
110
+
111
+ ## 0.6.11
112
+
113
+ ### Patch Changes
114
+
115
+ - add Vite plugin for Node.js module stubs
116
+
117
+ ## 0.6.10
118
+
119
+ ### Patch Changes
120
+
121
+ - use import() type syntax for AppRouter
122
+
123
+ ## 0.6.9
124
+
125
+ ### Patch Changes
126
+
127
+ - isolate auth procedures from database imports
128
+
129
+ ## 0.6.8
130
+
131
+ ### Patch Changes
132
+
133
+ - prevent dotenv from leaking into browser bundle
134
+
135
+ ## 0.6.7
136
+
137
+ ### Patch Changes
138
+
139
+ - better-sqlite3 versions mismatch fix
140
+
141
+ ## 0.6.6
142
+
143
+ ### Patch Changes
144
+
145
+ - ensure the web app never imports server-side code paths
146
+
147
+ ## 0.6.5
148
+
149
+ ### Patch Changes
150
+
151
+ - move @prisma/client-runtime-utils to root package.json
152
+
153
+ ## 0.6.4
154
+
155
+ ### Patch Changes
156
+
157
+ - add @prisma/client-runtime-utils dependency
158
+
159
+ ## 0.6.3
160
+
161
+ ### Patch Changes
162
+
163
+ - Add workspaces field to root package.json template + Fix Prisma ESM/CJS import for Node.js v24
164
+
165
+ ## 0.6.2
166
+
167
+ ### Patch Changes
168
+
169
+ - add server actions, removed some deprecated and other chore
170
+
171
+ ## 0.6.1
172
+
173
+ ### Patch Changes
174
+
175
+ - route groups for file-based routing; add dynamic route support with [param] segments
176
+
177
+ ## 0.6.0
178
+
179
+ ### Minor Changes
180
+
181
+ - RSC streaming, dynamic routes, Vinxi integration
182
+
183
+ ## 0.5.0
184
+
185
+ ### Minor Changes
186
+
187
+ - Auto-register procedures + inject Prisma models feature
188
+
189
+ ## 0.4.21
190
+
191
+ ### Patch Changes
192
+
193
+ - format Prisma default values correctly by type
194
+
195
+ ## 0.4.20
196
+
197
+ ### Patch Changes
198
+
199
+ - import consolidation: update import paths for `@veloxts/velox`
200
+
201
+ ## 0.4.19
202
+
203
+ ### Patch Changes
204
+
205
+ - update default dev server port to 3030
206
+
207
+ ## 0.4.18
208
+
209
+ ### Patch Changes
210
+
211
+ - introduce interactive field menu and templates for resource generation
212
+
213
+ ## 0.4.17
214
+
215
+ ### Patch Changes
216
+
217
+ - add interactive field prompts for resource generation
218
+
219
+ ## 0.4.16
220
+
221
+ ### Patch Changes
222
+
223
+ - fixed velox procedures list
224
+
225
+ ## 0.4.15
226
+
227
+ ### Patch Changes
228
+
229
+ - chore lint fixes
230
+
231
+ ## 0.4.14
232
+
233
+ ### Patch Changes
234
+
235
+ - fixed proxy-type inferance and update proxy hooks for optional input handling
236
+
237
+ ## 0.4.13
238
+
239
+ ### Patch Changes
240
+
241
+ - add debug mode to dev server
242
+
243
+ ## 0.4.12
244
+
245
+ ### Patch Changes
246
+
247
+ - preserve type info in trpc template AppRouter export
248
+
249
+ ## 0.4.11
250
+
251
+ ### Patch Changes
252
+
253
+ - fixed api.health.check.useQuery is not a function issue
254
+
255
+ ## 0.4.10
256
+
257
+ ### Patch Changes
258
+
259
+ - fixed ReferenceError: styles is not defined in rpc template
260
+
261
+ ## 0.4.7
262
+
263
+ ### Patch Changes
264
+
265
+ - Add dynamic headers and routes config to client
266
+
267
+ ## 0.4.6
268
+
269
+ ### Patch Changes
270
+
271
+ - Fix broken npm packages - republish with correct dependencies
272
+
273
+ ## 0.4.5
274
+
275
+ ### Patch Changes
276
+
277
+ - b06631b: CI CD npm Trusted Publishing setup
278
+
279
+ ## 0.4.4
280
+
281
+ ### Patch Changes
282
+
283
+ - 05ae1a5: Update to boilerplate, work in progress
284
+ - 9961b52: full-stack React frontend implementation
285
+
286
+ ## 0.4.3
287
+
288
+ ### Patch Changes
289
+
290
+ - ef8d5d0: Dynamically load VeloxTS version from `package.json` in shared template configuration
291
+
292
+ ## 0.4.2
293
+
294
+ ### Patch Changes
295
+
296
+ - 5b4f02c: Updated documentations
297
+ - 0d8d775: Updated guides and readme files
298
+
299
+ ## 0.4.1
300
+
301
+ ### Patch Changes
302
+
303
+ - 0eea918: Completed CLI generators
304
+
305
+ ## 0.4.0
306
+
307
+ ### Minor Changes
308
+
309
+ - b478fee: Performance Benchmarks | 34k req/s, <1ms p50 latency, 75MB memory, 530ms startup
310
+
311
+ ## 0.3.6
312
+
313
+ ### Patch Changes
314
+
315
+ - 929f2ab: Interactive CLI setup
316
+
317
+ ## 0.3.5
318
+
319
+ ### Patch Changes
320
+
321
+ - 658e83f: @veloxts/auth, Full REST Support, Better error messages, Type tests with tsd
322
+
323
+ ## 0.3.4
324
+
325
+ ### Patch Changes
326
+
327
+ - 65ef3e7: DI container and Auth Guards
328
+
329
+ ## 0.3.3
330
+
331
+ ### Patch Changes
332
+
333
+ - 4ee103b: Full REST support PUT, PATCH and DELETE
334
+
335
+ ## 0.3.2
336
+
337
+ ### Patch Changes
338
+
339
+ - abf270e: Dynamically set core `VELOX_VERSION` from package.json
340
+
341
+ ## 0.3.1
342
+
343
+ ### Patch Changes
344
+
345
+ - cb9806e: Fixed the value for VELOXTS_VERSION in create app template
346
+
347
+ ## 0.3.0
348
+
349
+ ### Minor Changes
350
+
351
+ - 1adce10: Introduced an umbrella package for server side packages: @veloxts/velox
352
+
353
+ ## 0.2.2
354
+
355
+ ### Patch Changes
356
+
357
+ - Version bump to sync with create-velox-app native module fix
358
+
359
+ ## 0.2.0
360
+
361
+ ### Minor Changes
362
+
363
+ - 9404976: fix Prisma client generation. README adjustments
364
+
365
+ ## 0.1.1
366
+
367
+ ### Patch Changes
368
+
369
+ - Fix Prisma client generation in scaffolder
370
+
371
+ - Added automatic Prisma client generation after dependency installation in create-velox-app
372
+ - Fixed database template to validate DATABASE_URL environment variable
373
+ - Added alpha release warning to all package READMEs
374
+ - Fixed TypeScript type for registerTRPCPlugin to accept FastifyInstance
375
+ - Updated playground app to use Prisma 7.x custom output path
package/GUIDE.md ADDED
@@ -0,0 +1,220 @@
1
+ # @veloxts/core
2
+
3
+ Core foundation for VeloxTS Framework providing application bootstrap, plugin system, and dependency injection.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @veloxts/core
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { veloxApp } from '@veloxts/core';
15
+
16
+ const app = await veloxApp({ port: 3030 });
17
+ await app.start();
18
+ console.log(`Server running at ${app.address}`);
19
+ ```
20
+
21
+ ## Application Setup
22
+
23
+ Create a VeloxTS application with sensible defaults:
24
+
25
+ ```typescript
26
+ const app = await veloxApp({
27
+ port: 3030, // Port to listen on
28
+ host: '0.0.0.0', // Host to bind to
29
+ logger: true, // Enable logging
30
+ });
31
+ ```
32
+
33
+ The `VeloxApp` instance provides lifecycle methods:
34
+
35
+ - `app.start()` - Start the HTTP server
36
+ - `app.stop()` - Stop the server gracefully
37
+ - `app.register(plugin)` - Register Fastify plugins
38
+ - `app.server` - Access underlying Fastify instance
39
+
40
+ ## Plugin System
41
+
42
+ Create reusable plugins with `definePlugin()`:
43
+
44
+ ```typescript
45
+ import { definePlugin } from '@veloxts/core';
46
+ import { PrismaClient } from '@prisma/client';
47
+
48
+ export const databasePlugin = definePlugin({
49
+ name: '@myapp/database',
50
+ version: '1.0.0',
51
+ async register(server, options) {
52
+ const db = new PrismaClient();
53
+ server.decorate('db', db);
54
+ server.addHook('onClose', async () => {
55
+ await db.$disconnect();
56
+ });
57
+ },
58
+ });
59
+
60
+ await app.register(databasePlugin);
61
+ ```
62
+
63
+ ## Context Extension
64
+
65
+ Extend the base context using TypeScript declaration merging:
66
+
67
+ ```typescript
68
+ import type { PrismaClient } from '@prisma/client';
69
+
70
+ declare module '@veloxts/core' {
71
+ interface BaseContext {
72
+ db: PrismaClient;
73
+ }
74
+ }
75
+
76
+ // Now ctx.db is available with full type safety
77
+ ```
78
+
79
+ ## Dependency Injection
80
+
81
+ VeloxTS provides a powerful DI container for managing service dependencies:
82
+
83
+ ```typescript
84
+ import { Injectable, Inject, Scope, singleton, scoped } from '@veloxts/core';
85
+
86
+ @Injectable()
87
+ class UserService {
88
+ constructor(private db: PrismaClient) {}
89
+
90
+ async getUser(id: string) {
91
+ return this.db.user.findUnique({ where: { id } });
92
+ }
93
+ }
94
+
95
+ // Register services
96
+ app.container.register(singleton(UserService));
97
+
98
+ // Resolve in procedures
99
+ const userService = app.container.resolve(UserService);
100
+ ```
101
+
102
+ ### Lifecycle Scopes
103
+
104
+ - `Scope.SINGLETON` - One instance for entire application
105
+ - `Scope.REQUEST` - One instance per HTTP request
106
+ - `Scope.TRANSIENT` - New instance every time
107
+
108
+ ### Succinct Helpers
109
+
110
+ ```typescript
111
+ import { singleton, scoped, transient, value, factory } from '@veloxts/core';
112
+
113
+ // Class services
114
+ app.container.register(singleton(ConfigService));
115
+ app.container.register(scoped(UserContext));
116
+ app.container.register(transient(RequestLogger));
117
+
118
+ // Values
119
+ app.container.register(value(CONFIG, { port: 3030 }));
120
+
121
+ // Factories
122
+ app.container.register(
123
+ factory(DATABASE, (config) => new PrismaClient({ url: config.dbUrl }), [ConfigService])
124
+ );
125
+ ```
126
+
127
+ ## Error Handling
128
+
129
+ Use structured error classes for consistent API responses:
130
+
131
+ ```typescript
132
+ import {
133
+ VeloxError,
134
+ ValidationError,
135
+ NotFoundError,
136
+ UnauthorizedError,
137
+ ForbiddenError,
138
+ } from '@veloxts/core';
139
+
140
+ // Basic error
141
+ throw new VeloxError('Something went wrong', 500);
142
+
143
+ // Validation error with field details
144
+ throw new ValidationError('Invalid input', {
145
+ email: 'Must be a valid email',
146
+ age: 'Must be at least 18',
147
+ });
148
+
149
+ // Resource not found
150
+ throw new NotFoundError('User', userId);
151
+
152
+ // Authentication required
153
+ throw new UnauthorizedError('Must be logged in');
154
+
155
+ // Insufficient permissions
156
+ throw new ForbiddenError('Admin access required');
157
+ ```
158
+
159
+ ## Graceful Shutdown
160
+
161
+ Handle shutdown signals properly:
162
+
163
+ ```typescript
164
+ const shutdown = async () => {
165
+ await app.stop();
166
+ process.exit(0);
167
+ };
168
+
169
+ process.on('SIGTERM', shutdown);
170
+ process.on('SIGINT', shutdown);
171
+
172
+ await app.start();
173
+ ```
174
+
175
+ ## Complete Example
176
+
177
+ ```typescript
178
+ import { veloxApp, definePlugin } from '@veloxts/core';
179
+ import { PrismaClient } from '@prisma/client';
180
+
181
+ // Database plugin
182
+ const databasePlugin = definePlugin({
183
+ name: '@myapp/database',
184
+ async register(server) {
185
+ const db = new PrismaClient();
186
+ server.decorate('db', db);
187
+ server.addHook('onClose', () => db.$disconnect());
188
+ },
189
+ });
190
+
191
+ // Create app
192
+ const app = await veloxApp({
193
+ port: Number(process.env.PORT) || 3030,
194
+ logger: true,
195
+ });
196
+
197
+ // Register plugins
198
+ await app.register(databasePlugin);
199
+
200
+ // Graceful shutdown
201
+ process.on('SIGTERM', async () => {
202
+ await app.stop();
203
+ process.exit(0);
204
+ });
205
+
206
+ // Start server
207
+ await app.start();
208
+ console.log(`Server running at ${app.address}`);
209
+ ```
210
+
211
+ ## Learn More
212
+
213
+ - [@veloxts/router](https://www.npmjs.com/package/@veloxts/router) - Procedure-based routing
214
+ - [@veloxts/validation](https://www.npmjs.com/package/@veloxts/validation) - Schema validation
215
+ - [@veloxts/orm](https://www.npmjs.com/package/@veloxts/orm) - Prisma integration
216
+ - [VeloxTS Framework](https://www.npmjs.com/package/@veloxts/velox) - Complete framework
217
+
218
+ ## License
219
+
220
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/core",
3
- "version": "0.6.26",
3
+ "version": "0.6.29",
4
4
  "description": "Fastify wrapper, DI container, and plugin system for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,10 @@
17
17
  },
18
18
  "files": [
19
19
  "dist",
20
- "README.md"
20
+ "README.md",
21
+ "GUIDE.md",
22
+ "LICENSE",
23
+ "CHANGELOG.md"
21
24
  ],
22
25
  "tsd": {
23
26
  "directory": "src/__type-tests__",