@goatlab/node-backend 1.0.1 → 1.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.
package/README.md CHANGED
@@ -157,16 +157,56 @@ const appRouter = t.router({
157
157
  hello: t.procedure.query(() => 'Hello World!')
158
158
  })
159
159
 
160
- const app = getExpressTrpcApp({
160
+ // Minimal configuration - just trpcRouter is required
161
+ const { app, server, waitForShutdown } = getExpressTrpcApp({
162
+ trpcRouter: appRouter
163
+ })
164
+
165
+ // Keep the process alive until shutdown
166
+ await waitForShutdown()
167
+
168
+ // With custom configuration
169
+ const { app, server, waitForShutdown } = getExpressTrpcApp({
161
170
  trpcRouter: appRouter,
162
- port: 3000,
163
- sentryService,
164
- expressResources: [customRouter], // Optional Express routers
165
- customHandlers: [middleware1, middleware2], // Optional middleware
166
- shouldInitOpenApiDocs: true, // Optional OpenAPI documentation
171
+ port: 8080,
172
+ environment: 'prod',
173
+ appName: 'My API',
174
+
175
+ // Feature flags
176
+ features: {
177
+ openApiDocs: true,
178
+ sentry: true,
179
+ trustProxy: true
180
+ },
181
+
182
+ // Security customization
183
+ security: {
184
+ cors: {
185
+ allowedOrigins: ['https://myapp.com'],
186
+ maxAge: 7200
187
+ },
188
+ rateLimit: {
189
+ api: { max: 1000 }
190
+ }
191
+ },
192
+
193
+ // Optional extensions
194
+ expressResources: [customRouter],
195
+ customHandlers: [middleware1, middleware2],
196
+ sentryService
167
197
  })
168
198
  ```
169
199
 
200
+ ### Configuration (New!)
201
+
202
+ The `getExpressTrpcApp` function now uses a fully typed configuration object instead of process.env variables:
203
+
204
+ - **Minimal config**: Only `trpcRouter` is required
205
+ - **Deep merging**: Customize specific settings without losing defaults
206
+ - **Type safety**: Full TypeScript support for all configuration options
207
+ - **Environment-aware**: Automatically adjusts defaults based on environment
208
+ - **Graceful shutdown**: Use `waitForShutdown()` to keep the process alive until the server closes
209
+
170
210
  ### Performance Features (New!)
171
211
 
172
212
  - **Optimized Compression**: Automatically skips compression for small responses (<1KB), SSE, WebSocket upgrades, and pre-compressed content
package/dist/index.d.ts CHANGED
@@ -3,6 +3,8 @@ import type { Options } from 'keyv';
3
3
  export { Cache };
4
4
  export type { Options };
5
5
  export { getExpressTrpcApp } from './server/bootstraps/getExpressTrpcApp';
6
+ export type { ExpressTrpcAppConfig } from './server/bootstraps/ExpressTrpcAppConfig';
7
+ export { getDefaultConfig } from './server/bootstraps/ExpressTrpcAppConfig';
6
8
  export { SentryService } from './server/sentry/sentry.service';
7
9
  export { getSentry } from './server/sentry/getSentry';
8
10
  export { getLogger } from './server/middleware/logger/logger.service';
package/dist/index.js CHANGED
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zodCompat = exports.getDistributedCacheInvalidator = exports.DistributedCacheInvalidator = exports.createServiceCache = exports.Container = exports.tr = exports.translationService = exports.TRPCError = exports.paginationUtility = exports.UrlService = exports.SecretService = exports.getGcpServiceAccountFromBase64 = exports.SendgridService = exports.EmailCategory = exports.Content = exports.Layout = exports.EmailService = exports.config = exports.mockedAuthenticatedTrpcRouter = exports.requestContext = exports.getTrpc = exports.useCloudTaskDecryptMiddleware = exports.handleRequest = exports.getLogger = exports.getSentry = exports.SentryService = exports.getExpressTrpcApp = exports.Cache = void 0;
3
+ exports.zodCompat = exports.getDistributedCacheInvalidator = exports.DistributedCacheInvalidator = exports.createServiceCache = exports.Container = exports.tr = exports.translationService = exports.TRPCError = exports.paginationUtility = exports.UrlService = exports.SecretService = exports.getGcpServiceAccountFromBase64 = exports.SendgridService = exports.EmailCategory = exports.Content = exports.Layout = exports.EmailService = exports.config = exports.mockedAuthenticatedTrpcRouter = exports.requestContext = exports.getTrpc = exports.useCloudTaskDecryptMiddleware = exports.handleRequest = exports.getLogger = exports.getSentry = exports.SentryService = exports.getDefaultConfig = exports.getExpressTrpcApp = exports.Cache = void 0;
4
4
  const Cache_1 = require("./Cache");
5
5
  Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return Cache_1.Cache; } });
6
6
  // New backend package
7
7
  var getExpressTrpcApp_1 = require("./server/bootstraps/getExpressTrpcApp");
8
8
  Object.defineProperty(exports, "getExpressTrpcApp", { enumerable: true, get: function () { return getExpressTrpcApp_1.getExpressTrpcApp; } });
9
+ var ExpressTrpcAppConfig_1 = require("./server/bootstraps/ExpressTrpcAppConfig");
10
+ Object.defineProperty(exports, "getDefaultConfig", { enumerable: true, get: function () { return ExpressTrpcAppConfig_1.getDefaultConfig; } });
9
11
  var sentry_service_1 = require("./server/sentry/sentry.service");
10
12
  Object.defineProperty(exports, "SentryService", { enumerable: true, get: function () { return sentry_service_1.SentryService; } });
11
13
  var getSentry_1 = require("./server/sentry/getSentry");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAGtB,sFAHA,aAAK,OAGA;AAGd,sBAAsB;AACtB,2EAAyE;AAAhE,sHAAA,iBAAiB,OAAA;AAC1B,iEAA8D;AAArD,+GAAA,aAAa,OAAA;AACtB,uDAAqD;AAA5C,sGAAA,SAAS,OAAA;AAClB,4EAAqE;AAA5D,2GAAA,SAAS,OAAA;AAClB,yFAA4E;AAAnE,yHAAA,aAAa,OAAA;AACtB,+FAA+F;AAAtF,4IAAA,6BAA6B,OAAA;AACtC,sCAAuC;AAA9B,+FAAA,OAAO,OAAA;AAChB,oEAAiE;AAAxD,iHAAA,cAAc,OAAA;AAEvB,qDAAuE;AAA9D,0HAAA,6BAA6B,OAAA;AAMtC,0CAAwC;AAA/B,gGAAA,MAAM,OAAA;AACf,uEAAoE;AAA3D,6GAAA,YAAY,OAAA;AACrB,mEAI4C;AAH1C,qGAAA,MAAM,OAAA;AACN,sGAAA,OAAO,OAAA;AACP,4GAAA,aAAa,OAAA;AAOf,sFAAgF;AAAvE,sHAAA,eAAe,OAAA;AACxB,uGAAqG;AAA5F,gJAA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,sFAAgF;AAAvE,sHAAA,eAAe,OAAA;AACxB,uGAAqG;AAA5F,gJAAA,8BAA8B,OAAA;AAMvC,2EAAwE;AAA/D,+GAAA,aAAa,OAAA;AACtB,kEAA+D;AAAtD,yGAAA,UAAU,OAAA;AACnB,gEAAqE;AAA5D,+GAAA,iBAAiB,OAAA;AAE1B,uCAAwC;AAA/B,mGAAA,SAAS,OAAA;AAClB,0FAG2D;AAFzD,yHAAA,kBAAkB,OAAA;AAClB,yGAAA,EAAE,OAAA;AAKJ,wBAAwB;AACxB,mBAAmB;AACnB,wBAAwB;AACxB,mDAAiD;AAAxC,sGAAA,SAAS,OAAA;AAelB,iDAAyD;AAAhD,8GAAA,kBAAkB,OAAA;AAC3B,uFAGgD;AAF9C,0IAAA,2BAA2B,OAAA;AAC3B,6IAAA,8BAA8B,OAAA;AAGhC,wBAAwB;AACxB,oBAAoB;AACpB,wBAAwB;AACxB,mDAAgD"}
@@ -0,0 +1,118 @@
1
+ import type { BuiltRouter } from '@trpc/server/unstable-core-do-not-import';
2
+ import type { RequestHandler, Router } from 'express';
3
+ import type { CommonLogger } from '@goatlab/js-utils';
4
+ import type { SentryService } from '../sentry/sentry.service';
5
+ import type { Environment } from '../types/Envinronment';
6
+ export interface RequiredExpressTrpcAppConfig {
7
+ trpcRouter: BuiltRouter<any, any>;
8
+ }
9
+ export interface OptionalExpressTrpcAppConfig {
10
+ appName?: string;
11
+ appVersion?: string;
12
+ port?: number;
13
+ baseUrl?: string;
14
+ environment?: Environment;
15
+ sentryService?: SentryService;
16
+ logger?: CommonLogger;
17
+ expressResources?: Router[] | readonly Router[];
18
+ customHandlers?: RequestHandler[];
19
+ features?: {
20
+ openApiDocs?: boolean;
21
+ sentry?: boolean;
22
+ trustProxy?: boolean;
23
+ etag?: 'weak' | 'strong' | boolean;
24
+ };
25
+ security?: {
26
+ cors?: {
27
+ allowedOrigins?: string[];
28
+ credentials?: boolean;
29
+ maxAge?: number;
30
+ };
31
+ helmet?: {
32
+ contentSecurityPolicy?: boolean | object;
33
+ crossOriginEmbedderPolicy?: boolean;
34
+ };
35
+ rateLimit?: {
36
+ global?: {
37
+ windowMs?: number;
38
+ max?: number;
39
+ };
40
+ auth?: {
41
+ windowMs?: number;
42
+ max?: number;
43
+ };
44
+ api?: {
45
+ windowMs?: number;
46
+ max?: number;
47
+ };
48
+ };
49
+ requestTimeout?: number;
50
+ };
51
+ bodyParsing?: {
52
+ json?: {
53
+ limit?: string;
54
+ type?: string[];
55
+ };
56
+ urlencoded?: {
57
+ limit?: string;
58
+ extended?: boolean;
59
+ };
60
+ raw?: {
61
+ limit?: string;
62
+ inflate?: boolean;
63
+ };
64
+ };
65
+ performance?: {
66
+ compression?: {
67
+ enabled?: boolean;
68
+ level?: number;
69
+ threshold?: number;
70
+ chunkSize?: number;
71
+ memLevel?: number;
72
+ };
73
+ memoryMonitoring?: {
74
+ enabled?: boolean;
75
+ warningThreshold?: number;
76
+ criticalThreshold?: number;
77
+ monitorInterval?: number;
78
+ enableGarbageCollection?: boolean;
79
+ addHeaders?: boolean;
80
+ };
81
+ caching?: {
82
+ staticAssets?: {
83
+ maxAge?: number;
84
+ };
85
+ };
86
+ };
87
+ server?: {
88
+ viewEngine?: string;
89
+ viewPaths?: string[];
90
+ };
91
+ healthCheck?: {
92
+ path?: string;
93
+ customChecks?: () => Promise<any>;
94
+ };
95
+ readyCheck?: {
96
+ path?: string;
97
+ customChecks?: () => Promise<any>;
98
+ };
99
+ processManagement?: {
100
+ gracefulShutdown?: {
101
+ enabled?: boolean;
102
+ timeout?: number;
103
+ onShutdown?: () => Promise<void>;
104
+ };
105
+ uncaughtException?: {
106
+ handler?: (error: Error) => void;
107
+ };
108
+ unhandledRejection?: {
109
+ handler?: (reason: any, promise: Promise<any>) => void;
110
+ };
111
+ };
112
+ }
113
+ export type ExpressTrpcAppConfig = RequiredExpressTrpcAppConfig & Required<OptionalExpressTrpcAppConfig>;
114
+ export type ExpressTrpcAppConfigInput = RequiredExpressTrpcAppConfig & Partial<OptionalExpressTrpcAppConfig>;
115
+ /**
116
+ * Get complete default configuration
117
+ */
118
+ export declare function getDefaultConfig(userConfig: ExpressTrpcAppConfigInput): ExpressTrpcAppConfig;
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultConfig = getDefaultConfig;
4
+ const consts_1 = require("../consts");
5
+ /**
6
+ * Deep merge utility for configuration objects
7
+ * Arrays are replaced, not merged
8
+ */
9
+ function deepMerge(target, source) {
10
+ const result = { ...target };
11
+ for (const key in source) {
12
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
13
+ const sourceValue = source[key];
14
+ const targetValue = target[key];
15
+ if (sourceValue === undefined) {
16
+ continue;
17
+ }
18
+ if (sourceValue === null ||
19
+ typeof sourceValue !== 'object' ||
20
+ Array.isArray(sourceValue)) {
21
+ // For primitives, null, and arrays, replace the value
22
+ ;
23
+ result[key] = sourceValue;
24
+ }
25
+ else if (targetValue &&
26
+ typeof targetValue === 'object' &&
27
+ !Array.isArray(targetValue)) {
28
+ // For objects, merge recursively
29
+ ;
30
+ result[key] = deepMerge(targetValue, sourceValue);
31
+ }
32
+ else {
33
+ // If target doesn't have this object, just assign it
34
+ ;
35
+ result[key] = sourceValue;
36
+ }
37
+ }
38
+ }
39
+ return result;
40
+ }
41
+ /**
42
+ * Get complete default configuration
43
+ */
44
+ function getDefaultConfig(userConfig) {
45
+ // Determine environment from user config or default
46
+ const environment = userConfig.environment || 'local';
47
+ const isProduction = environment === 'prod';
48
+ const isDevelopment = environment === 'local' || environment === 'dev';
49
+ // Determine port from user config or default
50
+ const port = userConfig.port || 3000;
51
+ // Build complete default configuration
52
+ const defaults = {
53
+ // Required fields from user config
54
+ trpcRouter: userConfig.trpcRouter,
55
+ // Basic app info with defaults
56
+ appName: consts_1.pkg.name || 'express-trpc-app',
57
+ appVersion: consts_1.pkg.version || '1.0.0',
58
+ port,
59
+ environment,
60
+ baseUrl: `http://localhost:${port}`,
61
+ // Optional dependencies
62
+ sentryService: undefined,
63
+ logger: console,
64
+ // Express extensions
65
+ expressResources: [],
66
+ customHandlers: [],
67
+ // Feature flags
68
+ features: {
69
+ openApiDocs: false,
70
+ sentry: isProduction,
71
+ trustProxy: true,
72
+ etag: 'strong'
73
+ },
74
+ // Security configuration
75
+ security: {
76
+ cors: {
77
+ allowedOrigins: isProduction
78
+ ? []
79
+ : ['http://localhost:3000', 'http://localhost:3001'],
80
+ credentials: true,
81
+ maxAge: 86400
82
+ },
83
+ helmet: {
84
+ contentSecurityPolicy: isProduction,
85
+ crossOriginEmbedderPolicy: !isDevelopment
86
+ },
87
+ rateLimit: {
88
+ global: {
89
+ windowMs: 15 * 60 * 1000, // 15 minutes
90
+ max: 100
91
+ },
92
+ auth: {
93
+ windowMs: 15 * 60 * 1000, // 15 minutes
94
+ max: 5
95
+ },
96
+ api: {
97
+ windowMs: 15 * 60 * 1000, // 15 minutes
98
+ max: 100
99
+ }
100
+ },
101
+ requestTimeout: 30000 // 30 seconds
102
+ },
103
+ // Body parsing configuration
104
+ bodyParsing: {
105
+ json: {
106
+ limit: '100kb',
107
+ type: ['application/json', 'text/plain']
108
+ },
109
+ urlencoded: {
110
+ limit: '100kb',
111
+ extended: true
112
+ },
113
+ raw: {
114
+ limit: '100kb',
115
+ inflate: true
116
+ }
117
+ },
118
+ // Performance settings
119
+ performance: {
120
+ compression: {
121
+ enabled: true,
122
+ level: 6,
123
+ threshold: 1024,
124
+ chunkSize: 16 * 1024,
125
+ memLevel: 8
126
+ },
127
+ memoryMonitoring: {
128
+ enabled: true,
129
+ warningThreshold: 90,
130
+ criticalThreshold: 95,
131
+ monitorInterval: 30000,
132
+ enableGarbageCollection: isProduction,
133
+ addHeaders: !isProduction
134
+ },
135
+ caching: {
136
+ staticAssets: {
137
+ maxAge: 31536000 // 1 year
138
+ }
139
+ }
140
+ },
141
+ // Server configuration
142
+ server: {
143
+ viewEngine: 'ejs',
144
+ viewPaths: []
145
+ },
146
+ // Health check configuration
147
+ healthCheck: {
148
+ path: '/health',
149
+ customChecks: undefined
150
+ },
151
+ // Ready check configuration
152
+ readyCheck: {
153
+ path: '/ready',
154
+ customChecks: undefined
155
+ },
156
+ // Process management
157
+ processManagement: {
158
+ gracefulShutdown: {
159
+ enabled: true,
160
+ timeout: 30000,
161
+ onShutdown: undefined
162
+ },
163
+ uncaughtException: undefined,
164
+ unhandledRejection: undefined
165
+ }
166
+ };
167
+ // Deep merge user configuration with defaults
168
+ const merged = deepMerge(defaults, userConfig);
169
+ // Special handling for baseUrl - use user-provided value if given
170
+ if (userConfig.baseUrl) {
171
+ merged.baseUrl = userConfig.baseUrl;
172
+ }
173
+ return merged;
174
+ }
175
+ //# sourceMappingURL=ExpressTrpcAppConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpressTrpcAppConfig.js","sourceRoot":"","sources":["../../../src/server/bootstraps/ExpressTrpcAppConfig.ts"],"names":[],"mappings":";;AAmMA,4CAoJC;AAlVD,sCAA+B;AAgJ/B;;;GAGG;AACH,SAAS,SAAS,CAChB,MAAS,EACT,MAAkB;IAElB,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAA;IAE5B,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YACtD,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;YAC/B,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;YAE/B,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,SAAQ;YACV,CAAC;YAED,IACE,WAAW,KAAK,IAAI;gBACpB,OAAO,WAAW,KAAK,QAAQ;gBAC/B,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAC1B,CAAC;gBACD,sDAAsD;gBACtD,CAAC;gBAAC,MAAc,CAAC,G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ChB,OAAO,EAAE,IAAI;gBACb,gBAAgB,EAAE,EAAE;gBACpB,iBAAiB,EAAE,EAAE;gBACrB,eAAe,EAAE,KAAK;gBACtB,uBAAuB,EAAE,YAAY;gBACrC,UAAU,EAAE,CAAC,YAAY;aAC1B;YACD,OAAO,EAAE;gBACP,YAAY,EAAE;oBACZ,MAAM,EAAE,QAAQ,CAAC,SAAS;iBAC3B;aACF;SACF;QAED,uBAAuB;QACvB,MAAM,EAAE;YACN,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,EAAE;SACd;QAED,6BAA6B;QAC7B,WAAW,EAAE;YACX,IAAI,EAAE,SAAS;YACf,YAAY,EAAE,SAAS;SACxB;QAED,4BAA4B;QAC5B,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,SAAS;SACxB;QAED,qBAAqB;QACrB,iBAAiB,EAAE;YACjB,gBAAgB,EAAE;gBAChB,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,SAAS;aACtB;YACD,iBAAiB,EAAE,SAAS;YAC5B,kBAAkB,EAAE,SAAS;SAC9B;KACF,CAAA;IAED,8CAA8C;IAC9C,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;IAE9C,kEAAkE;IAClE,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACvB,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAA;IACrC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -1,21 +1,9 @@
1
- import type { BuiltRouter } from '@trpc/server/unstable-core-do-not-import';
2
- import type { Express, RequestHandler, Router } from 'express';
1
+ import type { Express } from 'express';
3
2
  import type { Server } from 'http';
4
- import { CommonLogger } from '@goatlab/js-utils';
5
- import { SentryService } from '../sentry/sentry.service';
6
- export declare function getExpressTrpcApp({ trpcRouter, port, expressResources, shouldInitOpenApiDocs, baseUrl, shouldEnableSentry, sentryService, logger, customHandlers }: {
7
- appName?: string;
8
- appVersion?: string;
9
- port: number;
10
- baseUrl?: string;
11
- trpcRouter: BuiltRouter<any, any>;
12
- expressResources?: Router[] | readonly Router[];
13
- sentryService: SentryService;
14
- shouldInitOpenApiDocs?: boolean;
15
- shouldEnableSentry?: boolean;
16
- logger?: CommonLogger;
17
- customHandlers?: RequestHandler[];
18
- }): {
3
+ import type { ExpressTrpcAppConfigInput } from './ExpressTrpcAppConfig';
4
+ export declare function getExpressTrpcApp(config: ExpressTrpcAppConfigInput): {
19
5
  app: Express;
20
6
  server?: Server;
7
+ memoryMonitor?: any;
8
+ waitForShutdown: () => Promise<void>;
21
9
  };