@veloxts/core 0.6.25 → 0.6.27

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 +363 -0
  2. package/GUIDE.md +220 -0
  3. package/package.json +5 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,363 @@
1
+ # @veloxts/core
2
+
3
+ ## 0.6.27
4
+
5
+ ### Patch Changes
6
+
7
+ - chore: add GUIDE, LICENSE and CHANGELOG.md to npm files
8
+
9
+ ## 0.6.26
10
+
11
+ ### Patch Changes
12
+
13
+ - docs(mcp): add README and GUIDE, docs(web): simplify README and create concise GUIDE
14
+
15
+ ## 0.6.25
16
+
17
+ ### Patch Changes
18
+
19
+ - docs(create): add guide for React Server Components setup
20
+
21
+ ## 0.6.24
22
+
23
+ ### Patch Changes
24
+
25
+ - clarify installation paths and package contents
26
+
27
+ ## 0.6.23
28
+
29
+ ### Patch Changes
30
+
31
+ - add defineContract for improved type inference DX
32
+
33
+ ## 0.6.22
34
+
35
+ ### Patch Changes
36
+
37
+ - support {method, path} route entry format
38
+
39
+ ## 0.6.21
40
+
41
+ ### Patch Changes
42
+
43
+ - separate schemas from procedures for browser-safe import
44
+
45
+ ## 0.6.20
46
+
47
+ ### Patch Changes
48
+
49
+ - add Fastify ecosystem stubs and debuglog to util
50
+
51
+ ## 0.6.19
52
+
53
+ ### Patch Changes
54
+
55
+ - restore dotenv stub for browser compatibility
56
+
57
+ ## 0.6.18
58
+
59
+ ### Patch Changes
60
+
61
+ - add node:fs/promises stub and fix esbuild plugin
62
+
63
+ ## 0.6.17
64
+
65
+ ### Patch Changes
66
+
67
+ - remove optimizeDeps.exclude to fix CJS/ESM interop
68
+
69
+ ## 0.6.16
70
+
71
+ ### Patch Changes
72
+
73
+ - add stubs for Fastify ecosystem packages
74
+
75
+ ## 0.6.15
76
+
77
+ ### Patch Changes
78
+
79
+ - implement three-layer Node.js stubbing for Vite
80
+
81
+ ## 0.6.14
82
+
83
+ ### Patch Changes
84
+
85
+ - stub dotenv as virtual module instead of process shims
86
+
87
+ ## 0.6.13
88
+
89
+ ### Patch Changes
90
+
91
+ - add process.argv stub for dotenv browser compatibility
92
+
93
+ ## 0.6.12
94
+
95
+ ### Patch Changes
96
+
97
+ - Fixes the "process is not defined" error from dotenv
98
+
99
+ ## 0.6.11
100
+
101
+ ### Patch Changes
102
+
103
+ - add Vite plugin for Node.js module stubs
104
+
105
+ ## 0.6.10
106
+
107
+ ### Patch Changes
108
+
109
+ - use import() type syntax for AppRouter
110
+
111
+ ## 0.6.9
112
+
113
+ ### Patch Changes
114
+
115
+ - isolate auth procedures from database imports
116
+
117
+ ## 0.6.8
118
+
119
+ ### Patch Changes
120
+
121
+ - prevent dotenv from leaking into browser bundle
122
+
123
+ ## 0.6.7
124
+
125
+ ### Patch Changes
126
+
127
+ - better-sqlite3 versions mismatch fix
128
+
129
+ ## 0.6.6
130
+
131
+ ### Patch Changes
132
+
133
+ - ensure the web app never imports server-side code paths
134
+
135
+ ## 0.6.5
136
+
137
+ ### Patch Changes
138
+
139
+ - move @prisma/client-runtime-utils to root package.json
140
+
141
+ ## 0.6.4
142
+
143
+ ### Patch Changes
144
+
145
+ - add @prisma/client-runtime-utils dependency
146
+
147
+ ## 0.6.3
148
+
149
+ ### Patch Changes
150
+
151
+ - Add workspaces field to root package.json template + Fix Prisma ESM/CJS import for Node.js v24
152
+
153
+ ## 0.6.2
154
+
155
+ ### Patch Changes
156
+
157
+ - add server actions, removed some deprecated and other chore
158
+
159
+ ## 0.6.1
160
+
161
+ ### Patch Changes
162
+
163
+ - route groups for file-based routing; add dynamic route support with [param] segments
164
+
165
+ ## 0.6.0
166
+
167
+ ### Minor Changes
168
+
169
+ - RSC streaming, dynamic routes, Vinxi integration
170
+
171
+ ## 0.5.0
172
+
173
+ ### Minor Changes
174
+
175
+ - Auto-register procedures + inject Prisma models feature
176
+
177
+ ## 0.4.21
178
+
179
+ ### Patch Changes
180
+
181
+ - format Prisma default values correctly by type
182
+
183
+ ## 0.4.20
184
+
185
+ ### Patch Changes
186
+
187
+ - import consolidation: update import paths for `@veloxts/velox`
188
+
189
+ ## 0.4.19
190
+
191
+ ### Patch Changes
192
+
193
+ - update default dev server port to 3030
194
+
195
+ ## 0.4.18
196
+
197
+ ### Patch Changes
198
+
199
+ - introduce interactive field menu and templates for resource generation
200
+
201
+ ## 0.4.17
202
+
203
+ ### Patch Changes
204
+
205
+ - add interactive field prompts for resource generation
206
+
207
+ ## 0.4.16
208
+
209
+ ### Patch Changes
210
+
211
+ - fixed velox procedures list
212
+
213
+ ## 0.4.15
214
+
215
+ ### Patch Changes
216
+
217
+ - chore lint fixes
218
+
219
+ ## 0.4.14
220
+
221
+ ### Patch Changes
222
+
223
+ - fixed proxy-type inferance and update proxy hooks for optional input handling
224
+
225
+ ## 0.4.13
226
+
227
+ ### Patch Changes
228
+
229
+ - add debug mode to dev server
230
+
231
+ ## 0.4.12
232
+
233
+ ### Patch Changes
234
+
235
+ - preserve type info in trpc template AppRouter export
236
+
237
+ ## 0.4.11
238
+
239
+ ### Patch Changes
240
+
241
+ - fixed api.health.check.useQuery is not a function issue
242
+
243
+ ## 0.4.10
244
+
245
+ ### Patch Changes
246
+
247
+ - fixed ReferenceError: styles is not defined in rpc template
248
+
249
+ ## 0.4.7
250
+
251
+ ### Patch Changes
252
+
253
+ - Add dynamic headers and routes config to client
254
+
255
+ ## 0.4.6
256
+
257
+ ### Patch Changes
258
+
259
+ - Fix broken npm packages - republish with correct dependencies
260
+
261
+ ## 0.4.5
262
+
263
+ ### Patch Changes
264
+
265
+ - b06631b: CI CD npm Trusted Publishing setup
266
+
267
+ ## 0.4.4
268
+
269
+ ### Patch Changes
270
+
271
+ - 05ae1a5: Update to boilerplate, work in progress
272
+ - 9961b52: full-stack React frontend implementation
273
+
274
+ ## 0.4.3
275
+
276
+ ### Patch Changes
277
+
278
+ - ef8d5d0: Dynamically load VeloxTS version from `package.json` in shared template configuration
279
+
280
+ ## 0.4.2
281
+
282
+ ### Patch Changes
283
+
284
+ - 5b4f02c: Updated documentations
285
+ - 0d8d775: Updated guides and readme files
286
+
287
+ ## 0.4.1
288
+
289
+ ### Patch Changes
290
+
291
+ - 0eea918: Completed CLI generators
292
+
293
+ ## 0.4.0
294
+
295
+ ### Minor Changes
296
+
297
+ - b478fee: Performance Benchmarks | 34k req/s, <1ms p50 latency, 75MB memory, 530ms startup
298
+
299
+ ## 0.3.6
300
+
301
+ ### Patch Changes
302
+
303
+ - 929f2ab: Interactive CLI setup
304
+
305
+ ## 0.3.5
306
+
307
+ ### Patch Changes
308
+
309
+ - 658e83f: @veloxts/auth, Full REST Support, Better error messages, Type tests with tsd
310
+
311
+ ## 0.3.4
312
+
313
+ ### Patch Changes
314
+
315
+ - 65ef3e7: DI container and Auth Guards
316
+
317
+ ## 0.3.3
318
+
319
+ ### Patch Changes
320
+
321
+ - 4ee103b: Full REST support PUT, PATCH and DELETE
322
+
323
+ ## 0.3.2
324
+
325
+ ### Patch Changes
326
+
327
+ - abf270e: Dynamically set core `VELOX_VERSION` from package.json
328
+
329
+ ## 0.3.1
330
+
331
+ ### Patch Changes
332
+
333
+ - cb9806e: Fixed the value for VELOXTS_VERSION in create app template
334
+
335
+ ## 0.3.0
336
+
337
+ ### Minor Changes
338
+
339
+ - 1adce10: Introduced an umbrella package for server side packages: @veloxts/velox
340
+
341
+ ## 0.2.2
342
+
343
+ ### Patch Changes
344
+
345
+ - Version bump to sync with create-velox-app native module fix
346
+
347
+ ## 0.2.0
348
+
349
+ ### Minor Changes
350
+
351
+ - 9404976: fix Prisma client generation. README adjustments
352
+
353
+ ## 0.1.1
354
+
355
+ ### Patch Changes
356
+
357
+ - Fix Prisma client generation in scaffolder
358
+
359
+ - Added automatic Prisma client generation after dependency installation in create-velox-app
360
+ - Fixed database template to validate DATABASE_URL environment variable
361
+ - Added alpha release warning to all package READMEs
362
+ - Fixed TypeScript type for registerTRPCPlugin to accept FastifyInstance
363
+ - 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.25",
3
+ "version": "0.6.27",
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__",