create-cellsweb-rpc-api 1.0.28 → 1.0.30

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
@@ -1,88 +1,18 @@
1
- # `create-cellsweb-rpc-api`
2
-
3
- [![npm version](https://img.shields.io/npm/v/create-cellsweb-rpc-api.svg)](https://www.npmjs.com/package/create-cellsweb-rpc-api)
4
- [![license](https://img.shields.io/npm/l/create-cellsweb-rpc-api.svg)](LICENSE)
5
-
6
- > Official CLI scaffolder for **CellsWeb RPC API** service projects.
7
-
8
- > [!TIP]
9
- > **CellsWeb RPC Ecosystem**:
10
- > - ⚡ **Backend RPC Engine**: [`@cellsweb/rpc-core`](https://www.npmjs.com/package/@cellsweb/rpc-core) ($O(1)$ dispatching, TypeBox schemas, Busboy multipart)
11
- > - 🌐 **Client SDK & React/RN Hooks**: [`@cellsweb/rpc-client`](https://www.npmjs.com/package/@cellsweb/rpc-client) (Universal fetch & automatic multipart form-data)
12
-
13
- ---
14
-
15
- ## Usage
16
-
17
- ```bash
18
- # Interactive setup
19
- npm create cellsweb-rpc-api@latest my-app
20
- # or
21
- npx create-cellsweb-rpc-api@latest my-app
22
- # or
23
- pnpm create cellsweb-rpc-api@latest my-app
24
- ```
25
-
26
- ### Non-Interactive & Framework Flags
27
-
28
- You can specify your preferred base web framework directly using the `--framework` (or `-f`) flag:
29
-
30
- ```bash
31
- # 1. Vanilla Node.js (Default — zero extra dependencies, native node:http)
32
- npx create-cellsweb-rpc-api@latest my-app --framework node
33
-
34
- # 2. Express (Standard — easiest for adding traditional REST routes & middleware)
35
- npx create-cellsweb-rpc-api@latest my-app --framework express
36
-
37
- # 3. Fastify (Modern — high performance & rich plugin ecosystem)
38
- npx create-cellsweb-rpc-api@latest my-app --framework fastify
39
-
40
- # 4. Ultimate-Express (Extreme Throughput — uWebSockets.js-backed Express drop-in)
41
- npx create-cellsweb-rpc-api@latest my-app --framework ultimate-express
42
-
43
- # 5. Hono (Ultra-fast Web Standards & multi-runtime: Bun, Node.js, Deno)
44
- npx create-cellsweb-rpc-api@latest my-app --framework hono
45
-
46
- # 6. Elysia.js (Bun-native & TypeBox first-class)
47
- npx create-cellsweb-rpc-api@latest my-app --framework elysia
48
-
49
- # 7. Bun Native (Zero extra dependencies, native Bun.serve)
50
- bun create cellsweb-rpc-api@latest my-app --framework bun
51
- ```
52
-
53
- ### Automation & CI Flags
54
- - `--skip-install` / `--no-install`: Skip automated package installation.
55
- - `--yes` / `-y`: Non-interactive mode using defaults.
56
- - `--pm [npm|pnpm|yarn|bun]`: Specify package manager explicitly.
57
-
58
- ---
59
-
60
- ## Supported Base Frameworks
61
-
62
- | Framework | Dependencies | Description |
63
- | :--- | :--- | :--- |
64
- | **Vanilla Node.js** *(Default)* | *None (Zero extra deps)* | Highest raw performance directly on native `node:http`. |
65
- | **Express** | `express`, `@types/express` | Standard Express server; easily mount traditional REST routes alongside `/rpc`. |
66
- | **Fastify** | `fastify` | Fastify server with built-in plugin adapter (`app.createFastifyPlugin()`). |
67
- | **Ultimate-Express** | `ultimate-express` | Drop-in Express replacement powered by `uWebSockets.js` for extreme I/O throughput. |
68
- | **Hono** | `hono`, `@hono/node-server` | Universal Web Standards engine running seamlessly across Bun, Node.js, and Edge runtimes. |
69
- | **Elysia.js** | `elysia` | Bun-first web framework with native TypeBox alignment and high developer ergonomics. |
70
- | **Bun Native** | *None (Zero extra deps)* | Ultra-fast execution on native `Bun.serve` with zero third-party web framework overhead. |
71
-
72
- ---
73
-
74
- ## Features
75
-
76
- - **Multi-Framework Flexibility**: Choose between Vanilla Node.js, Express, Fastify, or Ultimate-Express while keeping RPC function and middleware code 100% identical.
77
- - **Unified Framework CLI (`crpc`)**: Integrated single-binary developer CLI for dev with hot-reload (`crpc dev`), production build (`crpc build`), serving (`crpc start`), and test suites (`crpc test`).
78
- - **Pre-wired `@cellsweb/rpc-core`**: High performance $O(1)$ dispatching engine with sub-microsecond JIT schema validation.
79
- - **Interactive & AI Batch Generators**: Built-in CLI scripts for adding new functions (`crpc create:function`) and middlewares (`crpc create:middleware`) supporting non-interactive flags, JSON batch scaffolding (`--batch '<JSON>'`), and file specs (`--file spec.json`).
80
- - **Security & Integration Audit Testing**: Built-in in-process security audit test harness with HTML/JSON report generation (`crpc test:audit`).
81
- - **Pre-scaffolded Common Middlewares**: Includes `auth` (JWT verification stub) and `rateLimit` (in-memory rate limiting).
82
- - **Pluggable Extensions**: Modular application-level `env.ts` (TypeBox), `telemetry.ts` (Sentry), and `storage.ts` (Local/S3 uploads).
83
-
84
- ---
85
-
86
- ## License
87
-
88
- MIT © Minhazur Rahman
1
+ # create-cellsweb-rpc-api
2
+
3
+ Prepared candidate 1.0.30, not published by this work. Public 1.0.29 is older.
4
+ The candidate generates core^1.0.34 and Node >=24.0.0; publish that core before
5
+ publishing this scaffolder. Test unpublished candidates with local packed SDK
6
+ dependencies rather than resolving the older public SDK silently.
7
+
8
+ After publication: `npx create-cellsweb-rpc-api@1.0.30 my-api --framework=node`.
9
+ Supported framework names are node, bun, elysia, express, fastify, hono and
10
+ ultimate-express. Use --yes --skip-install for explicit automation, then install,
11
+ typecheck, build and test. Bun 1.3.11 is tested separately for Bun/Elysia execution;
12
+ Node 24 LTS is primary. Hono's tested Node host does not imply Edge discovery.
13
+
14
+ Generated src/env.ts loads dotenv with process exports taking precedence.
15
+ Production docs require parsed API_DOCS_ENABLED=true; other environments keep
16
+ the development default. Explicit app docs:false overrides it. Auth modules are
17
+ customization stubs; supply real verification. Legacy isPublic is not generated.
18
+ See repository docs/cli.md, docs/adapters.md and RELEASE.md for exact workflow.
@@ -136,7 +136,6 @@ import { File, Files } from "@cellsweb/rpc-core";
136
136
 
137
137
  export const metadata = {
138
138
  description: "${descriptionStr}",
139
- isPublic: ${ns.startsWith("public")},
140
139
  deprecated: false,
141
140
  tags: ["upload"] as string[],
142
141
  };
@@ -173,7 +172,7 @@ export const outputSchema = Type.Object({
173
172
  * SCHEMA & CONTRACT DEFINITION
174
173
  *
175
174
  * WHAT TO TOUCH:
176
- * - metadata: Description, public access, tags.
175
+ * - metadata: Description, deprecation, tags.
177
176
  * - contentType: "application/json" (default).
178
177
  * - inputSchema: Define fields expected in req.body.data. Include description in Type properties!
179
178
  * - outputSchema: Define structure returned by run(). Include description in Type properties!
@@ -183,7 +182,6 @@ import { Type } from "@sinclair/typebox";
183
182
 
184
183
  export const metadata = {
185
184
  description: "${descriptionStr}",
186
- isPublic: ${ns.startsWith("public")},
187
185
  deprecated: false,
188
186
  tags: [] as string[],
189
187
  };
File without changes
package/bin/create.js CHANGED
@@ -217,10 +217,10 @@ async function main() {
217
217
  "create:middleware": "crpc create:middleware",
218
218
  },
219
219
  engines: {
220
- node: ">=20.0.0",
220
+ node: ">=24.0.0",
221
221
  },
222
222
  dependencies: {
223
- "@cellsweb/rpc-core": "^1.0.32",
223
+ "@cellsweb/rpc-core": "^1.0.34",
224
224
  "@aws-sdk/client-s3": "^3.700.0",
225
225
  "@paralleldrive/cuid2": "^2.2.2",
226
226
  "@sentry/node": "^8.40.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cellsweb-rpc-api",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,6 +16,9 @@
16
16
  "template",
17
17
  "templates"
18
18
  ],
19
+ "scripts": {
20
+ "test": "node --import tsx --test --test-concurrency=1 test/*.test.mjs"
21
+ },
19
22
  "keywords": [
20
23
  "rpc",
21
24
  "create-app",
@@ -27,16 +30,27 @@
27
30
  "license": "MIT",
28
31
  "repository": {
29
32
  "type": "git",
30
- "url": "git+https://github.com/MinhazurSarker/cellsweb-rpc.git"
33
+ "url": "git+https://github.com/CellsWeb/crpc-node.git"
31
34
  },
32
35
  "dependencies": {
33
36
  "@clack/prompts": "^1.7.0",
34
37
  "tinyglobby": "^0.2.17"
35
38
  },
36
39
  "devDependencies": {
37
- "@types/node": "^26.6.6"
40
+ "@hono/node-server": "^1.19.19",
41
+ "@sinclair/typebox": "^0.34.52",
42
+ "@types/express": "^5.0.6",
43
+ "@types/node": "^26.6.6",
44
+ "dotenv": "^17.4.2",
45
+ "elysia": "^1.4.32",
46
+ "express": "^4.22.3",
47
+ "fastify": "^5.12.8",
48
+ "hono": "^4.13.18",
49
+ "tsx": "^4.22.0",
50
+ "typescript": "^7.0.2",
51
+ "ultimate-express": "^2.2.4"
38
52
  },
39
- "scripts": {
40
- "test": "echo \"CLI scaffolder test suite\""
53
+ "engines": {
54
+ "node": ">=24.0.0"
41
55
  }
42
- }
56
+ }
@@ -1,116 +1,37 @@
1
- # CellsWeb RPC API Service
2
-
3
- Welcome to your production-ready **CellsWeb RPC API** service!
4
-
5
- Powered by `@cellsweb/rpc-core` — zero framework overhead, TypeBox schema validation, $O(1)$ in-memory function dispatching, and built-in interactive CLI generators.
6
-
7
- ---
8
-
9
- ## Quick Start Commands
10
-
11
- ```bash
12
- pnpm run dev # Start dev server with hot-reload (http://localhost:4000)
13
- pnpm run typecheck # Check TypeScript types
14
- pnpm test # Run Vitest test suite
15
- pnpm run create:function # Interactively scaffold a new API function + test
16
- pnpm run create:middleware # Interactively scaffold a new central middleware + test
17
- pnpm run build # Compile TypeScript to dist/ for production
18
- pnpm start # Run compiled server (node dist/server.js)
19
- ```
20
-
21
- ---
22
-
23
- ## Architecture Overview
24
-
25
- ```txt
26
- src/
27
- ├── server.ts — Entrypoint initializing CoreRPC
28
- ├── env.ts — TypeBox environment configuration
29
- ├── telemetry.ts — Optional Sentry error tracking hook
30
- ├── utils/
31
- │ └── storage.ts — Dual Local & AWS S3 file storage utility
32
- ├── middlewares/
33
- │ ├── auth/ — Pre-scaffolded JWT auth stub with instructions
34
- │ └── rateLimit/ — Pre-scaffolded rate limit stub with instructions
35
- └── functions/
36
- └── public/
37
- └── hello/ — Sample JSON RPC function
38
- ```
39
-
40
- ---
41
-
42
- ## Single API Endpoint (`POST /rpc` or `POST /api`)
43
-
44
- ### JSON Request Example
45
- ```json
46
- {
47
- "namespace": "public",
48
- "functionName": "hello",
49
- "data": {
50
- "name": "Alice"
51
- }
52
- }
53
- ```
54
-
55
- ### Multipart Request Example (`Content-Type: multipart/form-data`)
56
- Pass form-data fields:
57
- - `namespace`: `"public"`
58
- - `functionName`: `"uploadAvatar"`
59
- - `title`: `"My Avatar"`
60
- - `avatar`: `<file attachment>`
61
-
62
- ---
63
-
64
- ## Creating Functions & Middlewares
65
-
66
- ### Scaffold a New Function
67
- ```bash
68
- pnpm run create:function
69
- ```
70
-
71
- Generates:
72
- ```txt
73
- src/functions/{namespace}/{functionName}/
74
- ├── constants.ts — Metadata, accepted Content-Type, and TypeBox schemas
75
- ├── run.ts — Business logic handler
76
- ├── middlewares.ts — Declarative middleware pipeline ({ name, options })
77
- └── test.ts — Vitest unit test
78
- ```
79
-
80
- ### Scaffold a New Middleware
81
- ```bash
82
- pnpm run create:middleware
83
- ```
84
-
85
- Generates:
86
- ```txt
87
- src/middlewares/{middlewareName}/
88
- ├── constants.ts — Metadata, headersSchema, and optionsSchema
89
- ├── run.ts — Middleware logic (receives headers, options, function, context)
90
- └── test.ts — Vitest unit test
91
- ```
92
-
93
- ---
94
-
95
- ## Storage & File Uploads
96
-
97
- Use `storage.upload()` inside function `run.ts`:
98
-
99
- ```ts
100
- import { storage } from "@/utils/storage";
101
-
102
- export const run = async (input, _context) => {
103
- const fileBuffer = await input.avatar.toBuffer();
104
- const saved = await storage.upload(fileBuffer, input.avatar.filename, "avatars");
105
- return { url: saved.url };
106
- };
107
- ```
108
-
109
- Set `UPLOAD_MODE=s3` in `.env` along with `S3_BUCKET`, `S3_REGION`, `S3_ACCESS_KEY`, `S3_SECRET_KEY` to switch to S3 mode seamlessly.
110
-
111
- ---
112
-
113
- ## Interactive Documentation & Health
114
-
115
- - **Interactive API Docs**: Visit `http://localhost:4000/docs` in your browser.
116
- - **Health Check**: `GET http://localhost:4000/health`.
1
+ # Generated CellsWeb RPC application
2
+
3
+ Node 24 LTS is primary (engines >=24.0.0). Bun/Elysia templates run under Bun,
4
+ tested separately with 1.3.11. Install dependencies, then run:
5
+
6
+ ```sh
7
+ npm run typecheck
8
+ npm test
9
+ npm run build
10
+ npm start
11
+ ```
12
+
13
+ The generated core requirement is ^1.0.34. Before that candidate is published,
14
+ select its local tarball explicitly for local testing. The public older SDK does
15
+ not contain every reviewed fix. See the source repository RELEASE.md.
16
+
17
+ Use npm run dev for Node development. For Bun select Bun execution, for example
18
+ `bun run src/server.ts` with the Bun-native template. The local crpc CLI supplies
19
+ function/middleware generation, build and tests. Complete templates cover native
20
+ Node, Express, Fastify, Hono, Ultimate Express, Bun and Elysia.
21
+
22
+ src/env.ts loads .env without overriding exported values. API_PORT/API_HOST
23
+ default to 4000/0.0.0.0. Docs are enabled outside production; production requires
24
+ parsed API_DOCS_ENABLED=true (true/false/1/0, trimmed and case-insensitive).
25
+ To disable even in development set the explicit CoreRPC docs:false option.
26
+ Disabling docs blocks their pages, not function execution. No visibility flag
27
+ exists; deprecated isPublic is ignored and new functions omit it.
28
+
29
+ Replace the generated auth stub with real credential verification. Middleware
30
+ owns authentication/authorization; remote clients forward headers, not trusted
31
+ context or a middleware-skip switch. Function input/output schemas remain active.
32
+
33
+ Use File/Files for uploads. Node UploadedFile exposes path, filename, mimeType,
34
+ byteLength and stream/buffer/blob methods. Persist into application-owned storage
35
+ while the handler runs; temporary uploads are cleaned afterward. Use configured
36
+ limits and top-level/direct-array file fields. Fetch multipart may buffer at the
37
+ runtime boundary; no zero-memory guarantee is implied.
@@ -13,6 +13,7 @@ export const EnvSchema = Type.Object({
13
13
  API_HOST: Type.Optional(Type.String({ default: "0.0.0.0" })),
14
14
  API_REQUEST_TIMEOUT_MS: Type.Optional(Type.Number({ default: 30000 })),
15
15
  API_LOG_LEVEL: Type.Optional(Type.String({ default: "info" })),
16
+ API_DOCS_ENABLED: Type.Optional(Type.Boolean({ default: false })),
16
17
 
17
18
  MAX_JSON_BODY_BYTES: Type.Optional(Type.Number({ default: 1_048_576 })),
18
19
  MAX_MULTIPART_BYTES: Type.Optional(Type.Number({ default: 25_000_000 })),
@@ -67,9 +68,12 @@ function parseEnv(): Env {
67
68
  raw.UPLOAD_MODE ??= "local";
68
69
  raw.UPLOAD_DIR ??= "public/uploads";
69
70
  raw.SERVER_URL ??= "http://localhost:4000";
71
+ raw.API_DOCS_ENABLED = booleanFromEnv(raw.API_DOCS_ENABLED, false);
70
72
  raw.TELEMETRY_ENABLED = booleanFromEnv(raw.TELEMETRY_ENABLED, true);
71
73
 
72
- const withDefaults = Value.Default(EnvSchema, raw);
74
+ const withDefaults = (Value as any).Default
75
+ ? (Value as any).Default(EnvSchema, raw)
76
+ : Value.Cast(EnvSchema, raw);
73
77
 
74
78
  if (!Value.Check(EnvSchema, withDefaults)) {
75
79
  const errors = [...Value.Errors(EnvSchema, withDefaults)];
@@ -8,7 +8,6 @@ import { Type } from "@sinclair/typebox";
8
8
 
9
9
  export const metadata = {
10
10
  description: "Sample hello JSON RPC function",
11
- isPublic: true,
12
11
  deprecated: false,
13
12
  tags: ["sample"],
14
13
  };
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
14
14
  middlewaresDir: "./src/middlewares",
15
15
  port: env.API_PORT,
16
16
  host: env.API_HOST,
17
- docs: true,
17
+ docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
18
18
  });
19
19
 
20
20
  const rpcHandler = await app.createHandler();
@@ -28,7 +28,10 @@ export const server = http.createServer(async (req, res) => {
28
28
  const filePath = decodeURIComponent(url.replace(/^\/uploads\//, ""));
29
29
  const result = await storage.serve(filePath);
30
30
  if (!result) {
31
- res.writeHead(404, { "Content-Type": "application/json" });
31
+ res.writeHead(404, {
32
+ "Content-Type": "application/json",
33
+ "X-Content-Type-Options": "nosniff",
34
+ });
32
35
  res.end(
33
36
  JSON.stringify({
34
37
  status: "error",
@@ -41,6 +44,7 @@ export const server = http.createServer(async (req, res) => {
41
44
  res.writeHead(200, {
42
45
  "Content-Type": result.mimeType,
43
46
  "Cache-Control": "public, max-age=86400",
47
+ "X-Content-Type-Options": "nosniff",
44
48
  });
45
49
  res.end(result.buffer);
46
50
  return;
@@ -50,6 +54,35 @@ export const server = http.createServer(async (req, res) => {
50
54
  await rpcHandler(req, res);
51
55
  });
52
56
 
57
+ // Graceful shutdown handler for container environments (K8s, Docker, Cloud Run)
58
+ const handleGracefulShutdown = (signal: string) => {
59
+ console.log(`Received ${signal}, initiating graceful shutdown...`);
60
+ if (typeof (server as any).closeIdleConnections === "function") {
61
+ (server as any).closeIdleConnections();
62
+ }
63
+ server.close(async () => {
64
+ try {
65
+ await app.close();
66
+ console.log("Server and background workers shut down cleanly.");
67
+ process.exit(0);
68
+ } catch (err) {
69
+ console.error("Error during graceful shutdown cleanup:", err);
70
+ process.exit(1);
71
+ }
72
+ });
73
+
74
+ // Force termination if connections fail to drain within 10s
75
+ setTimeout(() => {
76
+ console.error("Graceful shutdown timed out after 10s. Forcing exit.");
77
+ process.exit(1);
78
+ }, 10000).unref();
79
+ };
80
+
81
+ if (process.env.NODE_ENV !== "test" && !process.env.VITEST) {
82
+ process.once("SIGTERM", () => handleGracefulShutdown("SIGTERM"));
83
+ process.once("SIGINT", () => handleGracefulShutdown("SIGINT"));
84
+ }
85
+
53
86
  // Only start HTTP listener if not running inside test environment (Vitest)
54
87
  if (process.env.NODE_ENV !== "test" && !process.env.VITEST) {
55
88
  const port = env.API_PORT ?? 4000;
@@ -136,16 +136,24 @@ async function localUpload(
136
136
  originalName: string,
137
137
  dir: string = "",
138
138
  ): Promise<UploadResult> {
139
- const uploadRoot = getUploadRoot();
139
+ const uploadRoot = path.resolve(getUploadRoot());
140
+ const rootWithSep = uploadRoot.endsWith(path.sep) ? uploadRoot : uploadRoot + path.sep;
141
+
142
+ // Security: prevent directory traversal in target directory
143
+ const cleanDir = cleanStoragePath(dir).replace(/\.\./g, "").replace(/^\/+/, "");
144
+ const targetDir = path.resolve(uploadRoot, cleanDir);
145
+
146
+ if (!targetDir.startsWith(rootWithSep) && targetDir !== uploadRoot) {
147
+ throw new Error("Security Violation: Path traversal detected in upload directory");
148
+ }
149
+
140
150
  const safeName = sanitizeFilename(originalName);
141
- const relDir = dir.replace(/^\/+/, "");
142
- const savePath = path.join(uploadRoot, relDir, safeName);
143
- const dirPath = path.dirname(savePath);
151
+ const savePath = path.join(targetDir, safeName);
144
152
 
145
- await fs.mkdir(dirPath, { recursive: true });
153
+ await fs.mkdir(targetDir, { recursive: true });
146
154
  await fs.writeFile(savePath, buffer);
147
155
 
148
- const relativePath = relDir ? `${relDir}/${safeName}` : safeName;
156
+ const relativePath = cleanDir ? `${cleanDir}/${safeName}` : safeName;
149
157
  const normalizedRelPath = relativePath.replace(/\\/g, "/");
150
158
  const relUrl = `uploads/${normalizedRelPath}`;
151
159
 
package/template/test.ts CHANGED
@@ -50,7 +50,7 @@ describe("CellsWeb RPC API Boilerplate Suite", () => {
50
50
  fs.writeFileSync(
51
51
  path.join(echoDir, "constants.ts"),
52
52
  `import { Type } from "@sinclair/typebox";
53
- export const metadata = { description: "echo", isPublic: true };
53
+ export const metadata = { description: "echo" };
54
54
  export const contentType = "application/json";
55
55
  export const inputSchema = Type.Object({ message: Type.String({ minLength: 2 }) });
56
56
  export const outputSchema = Type.Object({ reply: Type.String() });`,
@@ -13,7 +13,7 @@ export const app = new CoreRPC({
13
13
  middlewaresDir: "./src/middlewares",
14
14
  port: env.API_PORT,
15
15
  host: env.API_HOST,
16
- docs: true,
16
+ docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
17
17
  });
18
18
 
19
19
  export const fetchHandler = async (req: Request): Promise<Response> => {
@@ -36,7 +36,7 @@ export const fetchHandler = async (req: Request): Promise<Response> => {
36
36
  },
37
37
  );
38
38
  }
39
- return new Response(result.buffer, {
39
+ return new Response(new Uint8Array(result.buffer), {
40
40
  status: 200,
41
41
  headers: {
42
42
  "Content-Type": result.mimeType,
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
14
14
  middlewaresDir: "./src/middlewares",
15
15
  port: env.API_PORT,
16
16
  host: env.API_HOST,
17
- docs: true,
17
+ docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
18
18
  });
19
19
 
20
20
  export const server = new Elysia();
@@ -36,7 +36,7 @@ server.get("/uploads/*", async ({ path }) => {
36
36
  },
37
37
  );
38
38
  }
39
- return new Response(result.buffer, {
39
+ return new Response(new Uint8Array(result.buffer), {
40
40
  status: 200,
41
41
  headers: {
42
42
  "Content-Type": result.mimeType,
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
14
14
  middlewaresDir: "./src/middlewares",
15
15
  port: env.API_PORT,
16
16
  host: env.API_HOST,
17
- docs: true,
17
+ docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
18
18
  });
19
19
 
20
20
  export const server: Express = express();
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
14
14
  middlewaresDir: "./src/middlewares",
15
15
  port: env.API_PORT,
16
16
  host: env.API_HOST,
17
- docs: true,
17
+ docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
18
18
  });
19
19
 
20
20
  export const server = Fastify({ logger: false });
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
14
14
  middlewaresDir: "./src/middlewares",
15
15
  port: env.API_PORT,
16
16
  host: env.API_HOST,
17
- docs: true,
17
+ docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
18
18
  });
19
19
 
20
20
  export const server = new Hono();
@@ -33,7 +33,7 @@ server.get("/uploads/*", async (c) => {
33
33
  404,
34
34
  );
35
35
  }
36
- return new Response(result.buffer, {
36
+ return new Response(new Uint8Array(result.buffer), {
37
37
  status: 200,
38
38
  headers: {
39
39
  "Content-Type": result.mimeType,
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
14
14
  middlewaresDir: "./src/middlewares",
15
15
  port: env.API_PORT,
16
16
  host: env.API_HOST,
17
- docs: true,
17
+ docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
18
18
  });
19
19
 
20
20
  const rpcHandler = await app.createHandler();
@@ -14,10 +14,10 @@ export const app = new CoreRPC({
14
14
  middlewaresDir: "./src/middlewares",
15
15
  port: env.API_PORT,
16
16
  host: env.API_HOST,
17
- docs: true,
17
+ docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
18
18
  });
19
19
 
20
- export const server = express();
20
+ export const server: ReturnType<typeof express> = express();
21
21
  const rpcHandler = await app.createHandler();
22
22
 
23
23
  // ── Static Files Route (/uploads/*) ──