create-cellsweb-rpc-api 1.0.30 → 1.0.31

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CellsWeb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,18 +1,285 @@
1
+ <p align="center">
2
+ <a href="https://cellsweb.com" target="_blank" rel="noopener noreferrer">
3
+ <img src="https://cellsweb.com/logo.svg" alt="CellsWeb Logo" width="340" style="background: rgba(255, 255, 255, 0.96); padding: 16px 24px; border-radius: 16px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08); display: inline-block; max-width: 100%;" />
4
+ </a>
5
+ </p>
6
+
1
7
  # create-cellsweb-rpc-api
2
8
 
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.
9
+ [![npm version](https://img.shields.io/npm/v/create-cellsweb-rpc-api.svg)](https://www.npmjs.com/package/create-cellsweb-rpc-api)
10
+ [![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/CellsWeb/crpc-node/blob/main/LICENSE)
11
+
12
+ The official **CellsWeb RPC** project initializer. Generate a TypeScript RPC
13
+ application with function discovery, TypeBox schemas, middleware examples,
14
+ JSON/multipart handling, environment configuration and a project-local CLI.
15
+ Choose native Node, Bun, Express, Fastify, Hono, Elysia or Ultimate Express while
16
+ keeping function and middleware modules independent of the HTTP adapter.
17
+
18
+ This **1.0.31 documentation patch** preserves the generator/template runtime from
19
+ 1.0.30. Requires **Node>=24.0.0**, with Node 24 LTS the primary toolchain; Bun 1.3.11
20
+ is tested separately. This package generates the project. The installed
21
+ `@cellsweb/rpc-core` supplies the project's runtime and `crpc` executable.
22
+
23
+ | Ecosystem | Responsibility |
24
+ |---|---|
25
+ | [create-cellsweb-rpc-api](https://www.npmjs.com/package/create-cellsweb-rpc-api) | This initializer and project templates |
26
+ | [@cellsweb/rpc-core](https://www.npmjs.com/package/@cellsweb/rpc-core) | Server engine, contracts, adapters and local CLI |
27
+ | [@cellsweb/rpc-client](https://www.npmjs.com/package/@cellsweb/rpc-client) | Separate frontend/client SDK, React hooks and native file support |
28
+ | [CellsWeb RPC Go](https://github.com/CellsWeb/crpc-go) | Go SDK and its separate Go initializer |
29
+
30
+ ## Contents
31
+
32
+ - [Quick start](#quick-start)
33
+ - [Interactive and automated setup](#interactive-and-automated-setup)
34
+ - [Seven supported adapters](#seven-supported-adapters)
35
+ - [Generated project structure](#generated-project-structure)
36
+ - [Functions and middleware](#functions-and-middleware)
37
+ - [Development, build and tests](#development-build-and-tests)
38
+ - [Environment and documentation controls](#environment-and-documentation-controls)
39
+ - [Uploads and application customization](#uploads-and-application-customization)
40
+ - [Deployment and compatibility](#deployment-and-compatibility)
41
+ - [Documentation, contribution and license](#documentation-contribution-and-license)
42
+
43
+ ## Quick start
44
+
45
+ ```sh
46
+ npm create cellsweb-rpc-api@latest my-api -- --framework=node --yes --pm=npm
47
+ cd my-api
48
+ npm run typecheck
49
+ npm run build
50
+ npm test
51
+ npm run dev
52
+ ```
53
+
54
+ The correct npm initializer name is **cellsweb-rpc-api**, not
55
+ create-create-cellsweb-rpc-api. For an exact generator version:
56
+
57
+ ```sh
58
+ npx create-cellsweb-rpc-api@1.0.31 my-api --framework=node --yes --pm=npm
59
+ ```
60
+
61
+ Once running (port4000 by default), invoke the generated hello function:
62
+
63
+ ```sh
64
+ curl http://localhost:4000/rpc \
65
+ -H 'Content-Type: application/json' \
66
+ --data '{"namespace":"public","functionName":"hello","data":{"name":"Ada"}}'
67
+ ```
68
+
69
+ Open `/docs` during development to inspect registered functions and middleware.
70
+ The generated hello contract is the source of truth for its complete response.
71
+ Frontend applications install `@cellsweb/rpc-client` independently.
72
+
73
+ ## Interactive and automated setup
74
+
75
+ With an interactive terminal, the CLI asks for target directory (if omitted),
76
+ package name, package manager and framework. Choose a fresh empty directory;
77
+ this is not an in-place migration tool for existing applications.
78
+
79
+ ```sh
80
+ npm create cellsweb-rpc-api@latest
81
+ # Equivalent executable:
82
+ npx create-cellsweb-rpc-api@latest my-api
83
+ # pnpm initializer:
84
+ pnpm create cellsweb-rpc-api@latest my-api
85
+ ```
86
+
87
+ For automation, provide the target directory first and explicit flags:
88
+
89
+ ```sh
90
+ npx create-cellsweb-rpc-api@1.0.31 generated-api \
91
+ --framework=fastify --name=example-api --pm=npm --yes --skip-install
92
+ cd generated-api
93
+ npm install
94
+ npm run typecheck
95
+ npm run build
96
+ npm test
97
+ ```
98
+
99
+ | Flag | Purpose |
100
+ |---|---|
101
+ | `--framework=name`, `--framework name`, `-f name` | Select adapter |
102
+ | `--yes`, `-y`, `--non-interactive` | Use defaults without prompts |
103
+ | `--skip-install`, `--no-install` | Generate files without installing dependencies |
104
+ | `--pm=npm`, `--pm=pnpm`, `--pm=yarn`, `--pm=bun` | Select package manager |
105
+ | `--name=package-name`, `--name package-name`, `-n package-name` | Generated package name |
106
+
107
+ Without a TTY, defaults are used; explicit `--yes` documents automation intent.
108
+ The default package manager is pnpm. Use `--pm=npm` if you want npm installation.
109
+ The CLI's framework aliases are conveniences; prefer the canonical names below.
110
+
111
+ ## Seven supported adapters
112
+
113
+ | Flag value | Generated HTTP integration | Runtime used in regression coverage |
114
+ |---|---|---|
115
+ | `node` | Native node:http | Node 24 |
116
+ | `express` | Express request/response handler | Node 24 |
117
+ | `fastify` | CRPC Fastify plugin, including multipart stream handoff | Node 24 |
118
+ | `ultimate-express` | uWebSockets-backed Express-compatible requests | Node 24 |
119
+ | `hono` | Fetch handler through @hono/node-server | Node 24; Bun-hosted integrations tested separately |
120
+ | `elysia` | Elysia Fetch plugin | Bun |
121
+ | `bun` | Native Bun.serve | Bun |
122
+
123
+ ```sh
124
+ npx create-cellsweb-rpc-api@1.0.31 node-api --framework=node --yes --skip-install
125
+ npx create-cellsweb-rpc-api@1.0.31 express-api --framework=express --yes --skip-install
126
+ npx create-cellsweb-rpc-api@1.0.31 fastify-api --framework=fastify --yes --skip-install
127
+ npx create-cellsweb-rpc-api@1.0.31 ultimate-api --framework=ultimate-express --yes --skip-install
128
+ npx create-cellsweb-rpc-api@1.0.31 hono-api --framework=hono --yes --skip-install
129
+ npx create-cellsweb-rpc-api@1.0.31 elysia-api --framework=elysia --yes --skip-install
130
+ npx create-cellsweb-rpc-api@1.0.31 bun-api --framework=bun --yes --skip-install
131
+ ```
132
+
133
+ For a Bun application, install/run using Bun after generation:
134
+
135
+ ```sh
136
+ cd bun-api
137
+ bun install
138
+ bun run typecheck
139
+ bun run build
140
+ bun run dev
141
+ ```
142
+
143
+ The CLI detects Bun when the CLI process itself runs under Bun. Use the selected
144
+ adapter's supported runtime; Hono/Fetch integration is not a promise that
145
+ filesystem discovery works in every Edge host. A framework's theoretical
146
+ platform list is different from this project's tested runtime matrix.
147
+
148
+ ## Generated project structure
149
+
150
+ ```text
151
+ my-api/
152
+ package.json # scripts, core SDK and selected adapter
153
+ tsconfig.json # strict TypeScript, emitted declarations
154
+ .env.example # documented environment defaults
155
+ .env # initial copy if absent
156
+ test.ts # integration tests
157
+ src/
158
+ server.ts # selected adapter and startup
159
+ env.ts # dotenv loading, conversion and validation
160
+ functions/public/hello/ # constants, handler, middleware attachments, tests
161
+ middlewares/auth/ # customize credential verification
162
+ middlewares/rateLimit/ # in-memory rate-limiting example
163
+ utils/ # request logging, storage and application helpers
164
+ test/ # test context and lifecycle helpers
165
+ ```
166
+
167
+ Inspect generated files as application-owned code. The initializer currently
168
+ requests **core^1.0.34**; this compatible range includes the documentation-only
169
+ 1.0.35 patch. It is intentionally unchanged because no new runtime dependency is
170
+ required. Generated servers do not depend on rpc-client; your frontend does.
171
+
172
+ ## Functions and middleware
173
+
174
+ Create a function through the installed project-local core CLI:
175
+
176
+ ```sh
177
+ npm run create:function -- --ns catalog --name get --contentType json
178
+ npm run create:middleware -- --name tenant --description 'Resolve tenant'
179
+ ```
180
+
181
+ A function is co-located under `src/functions/<namespace>/<functionName>/`:
182
+
183
+ - constants.ts: metadata, content type, input/output schemas and inferred types.
184
+ - run.ts: application handler, independent of the HTTP framework.
185
+ - middlewares.ts: ordered attachments through `defineMiddlewares`.
186
+ - test.ts: focused tests using the application's test setup.
187
+
188
+ Nested namespaces are supported. Add `--middlewares` to the function generator
189
+ when applicable; JSON `--batch` and `--file` specs support repeated generation.
190
+ These are **project CLI** flags, distinct from the initializer's flags.
191
+
192
+ Authentication belongs to middleware. The generated auth function is an editable
193
+ stub, not a JWT verifier or authorization guarantee. Verify credentials before
194
+ establishing trusted server context; caller JSON cannot bypass middleware.
195
+ Register/discover before serving. Middleware execution is sequential; runtime
196
+ registration during serving is outside the supported concurrency contract.
197
+
198
+ The rateLimit example is in-memory. Select a shared store for distributed limits
199
+ and tune policy for authenticated identities/proxies. Configure trustProxy
200
+ explicitly before trusting forwarded client IPs. Deprecated isPublic is ignored
201
+ and is not generated in new functions; it has no documentation/auth meaning.
202
+
203
+ ## Development, build and tests
204
+
205
+ | Command | Purpose |
206
+ |---|---|
207
+ | `npm run dev` | TypeScript development server/watch |
208
+ | `npm run typecheck` | TypeScript checks without emitting |
209
+ | `npm run build` | Compile and resolve emitted import aliases/extensions |
210
+ | `npm start` | Run production output |
211
+ | `npm test` | Project Vitest tests |
212
+ | `npm run test:watch` | Watch tests |
213
+ | `npm run test:coverage` | Coverage report |
214
+ | `npm run test:audit` | Application test/audit report tooling |
215
+
216
+ Build before production start. Add regression tests that assert actual handler
217
+ results, envelopes, authentication decisions and cleanup, not merely HTTP 200.
218
+ The audit command is a development report, not security certification.
219
+
220
+ ## Environment and documentation controls
221
+
222
+ src/env.ts loads dotenv. Already-exported process variables take precedence over
223
+ `.env`; values are converted/validated before templates pass them into CoreRPC.
224
+
225
+ | Environment | Purpose |
226
+ |---|---|
227
+ | `NODE_ENV` | development, test or production |
228
+ | `API_PORT`, `API_HOST` | Listening address |
229
+ | `API_DOCS_ENABLED` | Explicit production docs enablement; parsed boolean |
230
+ | `API_REQUEST_TIMEOUT_MS` | Application timeout configuration |
231
+ | `MAX_JSON_BODY_BYTES` | JSON intake limit |
232
+ | `MAX_MULTIPART_BYTES`, `MAX_UPLOAD_FILE_BYTES` | Multipart total/per-file limits |
233
+ | `UPLOAD_TMP_DIR` | Temporary upload location |
234
+ | `UPLOAD_MODE`, `UPLOAD_DIR` | Application storage helper mode/directory |
235
+
236
+ Every adapter template enables docs outside production by default, and requires
237
+ parsed API_DOCS_ENABLED=true in production. `false` does not enable production
238
+ docs. An explicit application `docs:false` overrides environment defaults.
239
+ Parsing accepts trimmed true/false or1/0 (case-insensitive); invalid production
240
+ values fall back to disabled. Set docs:false for private development environments
241
+ as well. Change the app's `docsEndpoint` for a custom path.
242
+
243
+ Docs may list every registered function and show schemas, middleware headers and
244
+ descriptions. They never read live secret option values. No per-function
245
+ hideFromDocs flag exists. Use middleware for RPC authorization and global docs
246
+ configuration for documentation exposure.
247
+
248
+ ## Uploads and application customization
249
+
250
+ Use File/Files in TypeBox input schemas for physical uploads and FormNum/FormBool
251
+ where multipart text conversion is intended. The client accepts top-level
252
+ File/Blob/native URI assets and direct file arrays; nested file objects are not
253
+ supported. Keep routing headers/body consistent and let FormData set its boundary.
254
+
255
+ Native Node stream adapters use Busboy. Fetch adapters may buffer at the runtime
256
+ formData interface. Temp files are cleaned after processing; persist within the
257
+ handler to an application-owned unique path when needed. MIME limits do not
258
+ sanitize uploaded content; validate content for your use case. Existing server
259
+ file-array completion order is not a stable business ordering guarantee.
260
+
261
+ Customize storage.ts for local/S3 persistence and telemetry helpers for your
262
+ monitoring. Optional SDKs in generated applications do not establish production
263
+ credentials or configure your infrastructure automatically.
264
+
265
+ ## Deployment and compatibility
266
+
267
+ Keep .env and credentials out of version control. Install/build in your release
268
+ environment, set production configuration, run tests, then start the compiled
269
+ entrypoint. Handle process shutdown in your application's host integration.
270
+
271
+ This is a documentation-only initializer patch. Function discovery, schemas,
272
+ middleware order, HTTP 200 application-error envelopes, multipart handling and
273
+ server APIs are unchanged. Upgrade the core independently according to your
274
+ application's package manager and lockfile policy.
275
+
276
+ ## Documentation, contribution and license
277
+
278
+ [Getting started](https://cellsweb.github.io/crpc-node/getting-started/) ·
279
+ [CLI guide](https://cellsweb.github.io/crpc-node/cli/) ·
280
+ [Adapters](https://cellsweb.github.io/crpc-node/adapters/) ·
281
+ [Source](https://github.com/CellsWeb/crpc-node/tree/main/packages/create-cellsweb-rpc-api) ·
282
+ [Contributing](https://github.com/CellsWeb/crpc-node/blob/main/CONTRIBUTING.md) ·
283
+ [Security policy](https://github.com/CellsWeb/crpc-node/security/policy)
284
+
285
+ MIT ©2026 CellsWeb. See [LICENSE](https://github.com/CellsWeb/crpc-node/blob/main/LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cellsweb-rpc-api",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -10,9 +10,8 @@ npm run build
10
10
  npm start
11
11
  ```
12
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.
13
+ The generated core requirement is ^1.0.34 and resolves from public npm.
14
+ Use ordinary package installation; no local SDK checkout or override is required.
16
15
 
17
16
  Use npm run dev for Node development. For Bun select Bun execution, for example
18
17
  `bun run src/server.ts` with the Bun-native template. The local crpc CLI supplies