create-daloy 1.3.5 → 1.3.7
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/package.json +1 -1
- package/sbom.cdx.json +9 -9
- package/sbom.spdx.json +5 -5
- package/templates/bun-basic/AGENTS.md +1 -1
- package/templates/bun-basic/README.md +2 -2
- package/templates/bun-basic/_agents/skills/daloyjs-best-practices/SKILL.md +3 -3
- package/templates/bun-basic/package.json +1 -1
- package/templates/bun-basic/src/build-app.ts +2 -2
- package/templates/cloudflare-worker/AGENTS.md +1 -1
- package/templates/cloudflare-worker/_agents/skills/daloyjs-best-practices/SKILL.md +4 -3
- package/templates/cloudflare-worker/package.json +1 -1
- package/templates/cloudflare-worker/src/index.ts +7 -5
- package/templates/deno-basic/AGENTS.md +1 -1
- package/templates/deno-basic/README.md +2 -2
- package/templates/deno-basic/_agents/skills/daloyjs-best-practices/SKILL.md +3 -3
- package/templates/deno-basic/deno.json +5 -5
- package/templates/deno-basic/src/build-app.ts +2 -2
- package/templates/node-basic/AGENTS.md +1 -1
- package/templates/node-basic/README.md +2 -2
- package/templates/node-basic/_agents/skills/daloyjs-best-practices/SKILL.md +3 -3
- package/templates/node-basic/package.json +1 -1
- package/templates/node-basic/src/build-app.ts +5 -4
- package/templates/vercel/AGENTS.md +1 -1
- package/templates/vercel/README.md +2 -2
- package/templates/vercel/_agents/skills/daloyjs-best-practices/SKILL.md +3 -3
- package/templates/vercel/api/index.ts +2 -2
- package/templates/vercel/package.json +1 -1
- package/templates/bun-basic/CLAUDE.md +0 -1
- package/templates/cloudflare-worker/CLAUDE.md +0 -1
- package/templates/deno-basic/CLAUDE.md +0 -1
- package/templates/node-basic/CLAUDE.md +0 -1
- package/templates/vercel/CLAUDE.md +0 -1
package/package.json
CHANGED
package/sbom.cdx.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bomFormat": "CycloneDX",
|
|
3
3
|
"specVersion": "1.5",
|
|
4
|
-
"serialNumber": "urn:uuid:
|
|
4
|
+
"serialNumber": "urn:uuid:3c483f47-57a8-5ad7-9117-f4a0de859fca",
|
|
5
5
|
"version": 1,
|
|
6
6
|
"metadata": {
|
|
7
|
-
"timestamp": "2026-09-
|
|
7
|
+
"timestamp": "2026-09-26T14:10:43.428Z",
|
|
8
8
|
"tools": [
|
|
9
9
|
{
|
|
10
10
|
"vendor": "DaloyJS",
|
|
11
11
|
"name": "daloy-generate-sbom",
|
|
12
|
-
"version": "1.3.
|
|
12
|
+
"version": "1.3.7"
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
"authors": [],
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "library",
|
|
18
|
-
"bom-ref": "pkg:npm/create-daloy@1.3.
|
|
18
|
+
"bom-ref": "pkg:npm/create-daloy@1.3.7",
|
|
19
19
|
"name": "create-daloy",
|
|
20
|
-
"version": "1.3.
|
|
20
|
+
"version": "1.3.7",
|
|
21
21
|
"description": "Scaffold a new DaloyJS project. Run with `pnpm create daloy`, `npm create daloy@latest`, `yarn create daloy`, or `bun create daloy`.",
|
|
22
|
-
"purl": "pkg:npm/create-daloy@1.3.
|
|
22
|
+
"purl": "pkg:npm/create-daloy@1.3.7",
|
|
23
23
|
"licenses": [
|
|
24
24
|
{
|
|
25
25
|
"license": {
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
}
|
|
43
43
|
],
|
|
44
44
|
"swid": {
|
|
45
|
-
"tagId": "swidtag-create-daloy-1.3.
|
|
45
|
+
"tagId": "swidtag-create-daloy-1.3.7",
|
|
46
46
|
"name": "create-daloy",
|
|
47
|
-
"version": "1.3.
|
|
47
|
+
"version": "1.3.7",
|
|
48
48
|
"tagVersion": 0,
|
|
49
49
|
"patch": false
|
|
50
50
|
}
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"components": [],
|
|
54
54
|
"dependencies": [
|
|
55
55
|
{
|
|
56
|
-
"ref": "pkg:npm/create-daloy@1.3.
|
|
56
|
+
"ref": "pkg:npm/create-daloy@1.3.7",
|
|
57
57
|
"dependsOn": []
|
|
58
58
|
}
|
|
59
59
|
]
|
package/sbom.spdx.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"spdxVersion": "SPDX-2.3",
|
|
3
3
|
"dataLicense": "CC0-1.0",
|
|
4
4
|
"SPDXID": "SPDXRef-DOCUMENT",
|
|
5
|
-
"name": "create-daloy-1.3.
|
|
6
|
-
"documentNamespace": "https://github.com/daloyjs/daloy/sbom/create-daloy-1.3.
|
|
5
|
+
"name": "create-daloy-1.3.7",
|
|
6
|
+
"documentNamespace": "https://github.com/daloyjs/daloy/sbom/create-daloy-1.3.7-3c483f47-57a8-5ad7-9117-f4a0de859fca",
|
|
7
7
|
"creationInfo": {
|
|
8
|
-
"created": "2026-09-
|
|
8
|
+
"created": "2026-09-26T14:10:43.428Z",
|
|
9
9
|
"creators": [
|
|
10
10
|
"Tool: daloy-generate-sbom",
|
|
11
11
|
"Organization: DaloyJS"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
{
|
|
17
17
|
"SPDXID": "SPDXRef-Package-create-daloy",
|
|
18
18
|
"name": "create-daloy",
|
|
19
|
-
"versionInfo": "1.3.
|
|
19
|
+
"versionInfo": "1.3.7",
|
|
20
20
|
"downloadLocation": "https://github.com/daloyjs/daloy",
|
|
21
21
|
"filesAnalyzed": false,
|
|
22
22
|
"licenseConcluded": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
{
|
|
28
28
|
"referenceCategory": "PACKAGE-MANAGER",
|
|
29
29
|
"referenceType": "purl",
|
|
30
|
-
"referenceLocator": "pkg:npm/create-daloy@1.3.
|
|
30
|
+
"referenceLocator": "pkg:npm/create-daloy@1.3.7"
|
|
31
31
|
}
|
|
32
32
|
]
|
|
33
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AGENTS.md
|
|
2
2
|
|
|
3
|
-
A [DaloyJS](https://daloyjs.dev) REST API for the [Bun](https://bun.sh) runtime. **Contract-first**: routes are defined with validation schemas (Zod in this template; DaloyJS also supports Standard Schema-compatible validators) and OpenAPI 3.1 is generated from them.
|
|
3
|
+
A [DaloyJS](https://daloyjs.dev) REST API for the [Bun](https://bun.sh) runtime. **Contract-first**: routes are defined with validation schemas (Zod in this template; DaloyJS also supports Standard Schema-compatible validators) and OpenAPI 3.1 is generated from them. With `docs: "auto"` in `new App({...})`, three routes are auto-mounted outside production: `GET /openapi.json`, `GET /openapi.yaml`, and `GET /docs` (Scalar UI).
|
|
4
4
|
|
|
5
5
|
- Package manager / runtime: Bun.
|
|
6
6
|
|
|
@@ -22,12 +22,12 @@ curl http://localhost:3000/books/1
|
|
|
22
22
|
|
|
23
23
|
## API documentation
|
|
24
24
|
|
|
25
|
-
- API docs (Scalar): <http://localhost:3000/docs>
|
|
25
|
+
- API docs (Scalar, development only): <http://localhost:3000/docs>
|
|
26
26
|
- OpenAPI 3.1 JSON: <http://localhost:3000/openapi.json>
|
|
27
27
|
- OpenAPI 3.1 YAML: <http://localhost:3000/openapi.yaml>
|
|
28
28
|
|
|
29
29
|
The spec is generated live from your routes, so it stays in sync with what is actually deployed.
|
|
30
|
-
To brand Scalar, change `docs:
|
|
30
|
+
To brand Scalar, change `docs: "auto"` in `src/build-app.ts` to `docs: { scalar: { theme, customCss } }`.
|
|
31
31
|
|
|
32
32
|
<!-- daloy-minimal:strip-end docs -->
|
|
33
33
|
|
|
@@ -99,7 +99,7 @@ stay in sync.
|
|
|
99
99
|
|
|
100
100
|
## OpenAPI & docs routes
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
With `docs: "auto"` on `new App({...})` (the default in this template),
|
|
103
103
|
three routes are auto-mounted off the spec generated from your route
|
|
104
104
|
definitions:
|
|
105
105
|
|
|
@@ -109,8 +109,8 @@ definitions:
|
|
|
109
109
|
- `GET /docs` — Scalar API reference UI that loads the spec.
|
|
110
110
|
|
|
111
111
|
Customize via `docs: { openapiPath, openapiYamlPath, path, ui }`. Set
|
|
112
|
-
`openapiYamlPath: false` to disable just the YAML route, `docs:
|
|
113
|
-
mount
|
|
112
|
+
`openapiYamlPath: false` to disable just the YAML route, `docs: true` to
|
|
113
|
+
also mount them in production, or `docs: false` to disable all three.
|
|
114
114
|
For hand-rolled mounting, `openapiToYAML` is exported from
|
|
115
115
|
`@daloyjs/core/openapi`.
|
|
116
116
|
|
|
@@ -26,7 +26,7 @@ export function buildApp(): App {
|
|
|
26
26
|
? { behindProxy: { hops: Number(process.env.TRUST_PROXY_HOPS) } }
|
|
27
27
|
: {}),
|
|
28
28
|
// daloy-minimal:strip-start docs
|
|
29
|
-
// Auto-mounted docs (
|
|
29
|
+
// Auto-mounted docs, outside production only (`docs: "auto"`):
|
|
30
30
|
// GET /openapi.json — OpenAPI 3.1 spec (JSON)
|
|
31
31
|
// GET /openapi.yaml — OpenAPI 3.1 spec (YAML, served inline as text/yaml)
|
|
32
32
|
// GET /docs — Scalar API reference UI that loads the spec
|
|
@@ -43,7 +43,7 @@ export function buildApp(): App {
|
|
|
43
43
|
// to pin an absolute base URL (e.g. for client codegen).
|
|
44
44
|
...(process.env.PUBLIC_URL ? { servers: [{ url: process.env.PUBLIC_URL }] } : {}),
|
|
45
45
|
},
|
|
46
|
-
docs:
|
|
46
|
+
docs: "auto",
|
|
47
47
|
// daloy-minimal:strip-end docs
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AGENTS.md
|
|
2
2
|
|
|
3
|
-
A [DaloyJS](https://daloyjs.dev) REST API deployed to **Cloudflare Workers**. **Contract-first**: routes are defined with validation schemas (Zod in this template; DaloyJS also supports Standard Schema-compatible validators) and OpenAPI 3.1 is generated from them. `docs:
|
|
3
|
+
A [DaloyJS](https://daloyjs.dev) REST API deployed to **Cloudflare Workers**. **Contract-first**: routes are defined with validation schemas (Zod in this template; DaloyJS also supports Standard Schema-compatible validators) and OpenAPI 3.1 is generated from them. `docs: "auto"` is set, and since `production: true` the spec routes (`/openapi.json`, `/openapi.yaml`, `/docs`) stay off; set `docs: true` to publish them. Drop `docs` and `openapi` for the smallest bundle.
|
|
4
4
|
|
|
5
5
|
- Package manager: pnpm (use `pnpm` unless the project's `package.json` was rewritten for npm/yarn/bun).
|
|
6
6
|
- Runtime: Cloudflare Workers (Web Standard `Request`/`Response`).
|
|
@@ -93,8 +93,9 @@ check, run `pnpm contract`.
|
|
|
93
93
|
|
|
94
94
|
## OpenAPI & docs routes
|
|
95
95
|
|
|
96
|
-
This Worker starter sets `docs:
|
|
97
|
-
|
|
96
|
+
This Worker starter sets `docs: "auto"` in `new App({...})`. Because it also
|
|
97
|
+
sets `production: true`, the three routes below stay off in the deployed
|
|
98
|
+
Worker; set `docs: true` to publish them (or while developing).
|
|
98
99
|
DaloyJS is dependency-free and the Scalar UI loads from a CDN, so the bundle
|
|
99
100
|
cost is negligible; drop `docs` (and the `openapi` block) if you need the
|
|
100
101
|
smallest possible Worker. The routes:
|
|
@@ -105,7 +106,7 @@ smallest possible Worker. The routes:
|
|
|
105
106
|
- `GET /docs` — Scalar API reference UI that loads the spec.
|
|
106
107
|
|
|
107
108
|
On Workers the Scalar UI adds the most weight; consider
|
|
108
|
-
`docs: { ui: "swagger" }
|
|
109
|
+
`docs: { ui: "swagger" }`, or pass
|
|
109
110
|
`docs: { openapiYamlPath: false }` to drop the YAML route only.
|
|
110
111
|
For hand-rolled mounting, `openapiToYAML` is exported from
|
|
111
112
|
`@daloyjs/core/openapi`.
|
|
@@ -13,14 +13,16 @@ const app = new App({
|
|
|
13
13
|
// additional proxy in front of the Worker.
|
|
14
14
|
behindProxy: { hops: 1 },
|
|
15
15
|
// daloy-minimal:strip-start docs
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
16
|
+
// `docs: "auto"` mounts GET /openapi.json, /openapi.yaml and /docs (Scalar
|
|
17
|
+
// UI) only outside production. With `production: true` above they stay off,
|
|
18
|
+
// so a deployed Worker does not publish its schema; set `docs: true` to
|
|
19
|
+
// publish them (or while developing). The Scalar UI loads from a CDN, so
|
|
20
|
+
// either way the bundle cost is negligible. Drop `docs` (and this `openapi`
|
|
21
|
+
// block) for the smallest possible bundle.
|
|
20
22
|
openapi: {
|
|
21
23
|
info: { title: "My Daloy Cloudflare API", version: "0.0.1" },
|
|
22
24
|
},
|
|
23
|
-
docs:
|
|
25
|
+
docs: "auto",
|
|
24
26
|
// daloy-minimal:strip-end docs
|
|
25
27
|
});
|
|
26
28
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AGENTS.md
|
|
2
2
|
|
|
3
|
-
A [DaloyJS](https://daloyjs.dev) REST API for the [Deno](https://deno.com) runtime. **Contract-first**: routes are defined with validation schemas (Zod in this template; DaloyJS also supports Standard Schema-compatible validators) and OpenAPI 3.1 is generated from them.
|
|
3
|
+
A [DaloyJS](https://daloyjs.dev) REST API for the [Deno](https://deno.com) runtime. **Contract-first**: routes are defined with validation schemas (Zod in this template; DaloyJS also supports Standard Schema-compatible validators) and OpenAPI 3.1 is generated from them. With `docs: "auto"` in `new App({...})`, three routes are auto-mounted outside production: `GET /openapi.json`, `GET /openapi.yaml`, and `GET /docs` (Scalar UI).
|
|
4
4
|
|
|
5
5
|
- Runtime: Deno (no Node package manager). DaloyJS loads from `jsr:` and third-party packages such as Zod load from `npm:` in `deno.json`.
|
|
6
6
|
|
|
@@ -21,12 +21,12 @@ curl http://localhost:3000/books/1
|
|
|
21
21
|
|
|
22
22
|
## API documentation
|
|
23
23
|
|
|
24
|
-
- API docs (Scalar): <http://localhost:3000/docs>
|
|
24
|
+
- API docs (Scalar, development only): <http://localhost:3000/docs>
|
|
25
25
|
- OpenAPI 3.1 JSON: <http://localhost:3000/openapi.json>
|
|
26
26
|
- OpenAPI 3.1 YAML: <http://localhost:3000/openapi.yaml>
|
|
27
27
|
|
|
28
28
|
The spec is generated live from your routes, so it stays in sync with what is actually deployed.
|
|
29
|
-
To brand Scalar, change `docs:
|
|
29
|
+
To brand Scalar, change `docs: "auto"` in `src/build-app.ts` to `docs: { scalar: { theme, customCss } }`.
|
|
30
30
|
|
|
31
31
|
<!-- daloy-minimal:strip-end docs -->
|
|
32
32
|
|
|
@@ -100,7 +100,7 @@ focused contract check, run `deno task contract`.
|
|
|
100
100
|
|
|
101
101
|
## OpenAPI & docs routes
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
With `docs: "auto"` on `new App({...})` (the default in this template),
|
|
104
104
|
three routes are auto-mounted off the spec generated from your route
|
|
105
105
|
definitions:
|
|
106
106
|
|
|
@@ -110,8 +110,8 @@ definitions:
|
|
|
110
110
|
- `GET /docs` — Scalar API reference UI that loads the spec.
|
|
111
111
|
|
|
112
112
|
Customize via `docs: { openapiPath, openapiYamlPath, path, ui }`. Set
|
|
113
|
-
`openapiYamlPath: false` to disable just the YAML route, `docs:
|
|
114
|
-
mount
|
|
113
|
+
`openapiYamlPath: false` to disable just the YAML route, `docs: true` to
|
|
114
|
+
also mount them in production, or `docs: false` to disable all three.
|
|
115
115
|
For hand-rolled mounting, `openapiToYAML` is exported from
|
|
116
116
|
`@daloyjs/core/openapi`.
|
|
117
117
|
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"hooks:install": "git config core.hooksPath .githooks"
|
|
11
11
|
},
|
|
12
12
|
"imports": {
|
|
13
|
-
"@daloyjs/core": "jsr:@daloyjs/daloy@^1.3.
|
|
14
|
-
"@daloyjs/core/banner": "jsr:@daloyjs/daloy@^1.3.
|
|
15
|
-
"@daloyjs/core/contract": "jsr:@daloyjs/daloy@^1.3.
|
|
16
|
-
"@daloyjs/core/deno": "jsr:@daloyjs/daloy@^1.3.
|
|
17
|
-
"@daloyjs/core/openapi": "jsr:@daloyjs/daloy@^1.3.
|
|
13
|
+
"@daloyjs/core": "jsr:@daloyjs/daloy@^1.3.7",
|
|
14
|
+
"@daloyjs/core/banner": "jsr:@daloyjs/daloy@^1.3.7/banner",
|
|
15
|
+
"@daloyjs/core/contract": "jsr:@daloyjs/daloy@^1.3.7/contract",
|
|
16
|
+
"@daloyjs/core/deno": "jsr:@daloyjs/daloy@^1.3.7/deno",
|
|
17
|
+
"@daloyjs/core/openapi": "jsr:@daloyjs/daloy@^1.3.7/openapi",
|
|
18
18
|
"zod": "npm:zod@^4.4.3"
|
|
19
19
|
},
|
|
20
20
|
"compilerOptions": {
|
|
@@ -27,7 +27,7 @@ export function buildApp(): App {
|
|
|
27
27
|
? { behindProxy: { hops: Number(Deno.env.get("TRUST_PROXY_HOPS")) } }
|
|
28
28
|
: {}),
|
|
29
29
|
// daloy-minimal:strip-start docs
|
|
30
|
-
// Auto-mounted docs (
|
|
30
|
+
// Auto-mounted docs, outside production only (`docs: "auto"`):
|
|
31
31
|
// GET /openapi.json — OpenAPI 3.1 spec (JSON)
|
|
32
32
|
// GET /openapi.yaml — OpenAPI 3.1 spec (YAML, served inline as text/yaml)
|
|
33
33
|
// GET /docs — Scalar API reference UI that loads the spec
|
|
@@ -44,7 +44,7 @@ export function buildApp(): App {
|
|
|
44
44
|
// deployed. Set PUBLIC_URL to pin an absolute base URL (e.g. for codegen).
|
|
45
45
|
...(Deno.env.get("PUBLIC_URL") ? { servers: [{ url: Deno.env.get("PUBLIC_URL")! }] } : {}),
|
|
46
46
|
},
|
|
47
|
-
docs:
|
|
47
|
+
docs: "auto",
|
|
48
48
|
// daloy-minimal:strip-end docs
|
|
49
49
|
});
|
|
50
50
|
|
|
@@ -4,7 +4,7 @@ A [DaloyJS](https://daloyjs.dev) Node.js REST API. **Contract-first**:
|
|
|
4
4
|
routes are defined with validation schemas (Zod in this template; DaloyJS also
|
|
5
5
|
supports Standard Schema-compatible validators) and OpenAPI 3.1 is generated
|
|
6
6
|
from them.
|
|
7
|
-
|
|
7
|
+
With `docs: "auto"` in `new App({...})`, three routes are auto-mounted outside production:
|
|
8
8
|
`GET /openapi.json`, `GET /openapi.yaml`, and `GET /docs` (Scalar UI).
|
|
9
9
|
|
|
10
10
|
- Package manager: pnpm (use `pnpm` unless the project's `package.json` was rewritten for npm/yarn/bun).
|
|
@@ -22,12 +22,12 @@ curl http://localhost:3000/books/1
|
|
|
22
22
|
|
|
23
23
|
## API documentation
|
|
24
24
|
|
|
25
|
-
- API docs (Scalar): <http://localhost:3000/docs>
|
|
25
|
+
- API docs (Scalar, development only): <http://localhost:3000/docs>
|
|
26
26
|
- OpenAPI 3.1 JSON: <http://localhost:3000/openapi.json>
|
|
27
27
|
- OpenAPI 3.1 YAML: <http://localhost:3000/openapi.yaml>
|
|
28
28
|
|
|
29
29
|
The spec is generated live from your routes, so it stays in sync with what is actually deployed.
|
|
30
|
-
To brand Scalar, change `docs:
|
|
30
|
+
To brand Scalar, change `docs: "auto"` in `src/build-app.ts` to `docs: { scalar: { theme, customCss } }`.
|
|
31
31
|
|
|
32
32
|
<!-- daloy-minimal:strip-end docs -->
|
|
33
33
|
|
|
@@ -104,7 +104,7 @@ check, run `pnpm contract`. If a change touches route shapes, also run
|
|
|
104
104
|
|
|
105
105
|
## OpenAPI & docs routes
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
With `docs: "auto"` on `new App({...})` (the default in this template),
|
|
108
108
|
three routes are auto-mounted off the spec generated from your route
|
|
109
109
|
definitions:
|
|
110
110
|
|
|
@@ -114,8 +114,8 @@ definitions:
|
|
|
114
114
|
- `GET /docs` — Scalar API reference UI that loads the spec.
|
|
115
115
|
|
|
116
116
|
Customize via `docs: { openapiPath, openapiYamlPath, path, ui }`. Set
|
|
117
|
-
`openapiYamlPath: false` to disable just the YAML route, `docs:
|
|
118
|
-
mount
|
|
117
|
+
`openapiYamlPath: false` to disable just the YAML route, `docs: true` to
|
|
118
|
+
also mount them in production, or `docs: false` to disable all three.
|
|
119
119
|
|
|
120
120
|
For hand-rolled mounting (when `docs: false`), the YAML serializer is
|
|
121
121
|
exported from the openapi subpath:
|
|
@@ -28,12 +28,13 @@ export function buildApp(): App {
|
|
|
28
28
|
? { behindProxy: { hops: Number(process.env.TRUST_PROXY_HOPS) } }
|
|
29
29
|
: {}),
|
|
30
30
|
// daloy-minimal:strip-start docs
|
|
31
|
-
// Auto-mounted docs (
|
|
31
|
+
// Auto-mounted docs, outside production only (`docs: "auto"`):
|
|
32
32
|
// GET /openapi.json — OpenAPI 3.1 spec (JSON)
|
|
33
33
|
// GET /openapi.yaml — OpenAPI 3.1 spec (YAML, served inline as text/yaml)
|
|
34
34
|
// GET /docs — Scalar API reference UI that loads the spec
|
|
35
|
-
// `docs:
|
|
36
|
-
//
|
|
35
|
+
// `docs: "auto"` skips them when the App is in production, so a deployed
|
|
36
|
+
// API does not publish its schema. Use `docs: true` to mount them in
|
|
37
|
+
// production as well, or `docs: false` to disable entirely.
|
|
37
38
|
// Customize paths via `docs: { openapiPath, openapiYamlPath, path, ui }`,
|
|
38
39
|
// or pass `openapiYamlPath: false` to disable just the YAML route.
|
|
39
40
|
// `info.title` / `info.version` default to the top-level `title` /
|
|
@@ -48,7 +49,7 @@ export function buildApp(): App {
|
|
|
48
49
|
// to pin an absolute base URL (e.g. for client codegen).
|
|
49
50
|
...(process.env.PUBLIC_URL ? { servers: [{ url: process.env.PUBLIC_URL }] } : {}),
|
|
50
51
|
},
|
|
51
|
-
docs:
|
|
52
|
+
docs: "auto",
|
|
52
53
|
// daloy-minimal:strip-end docs
|
|
53
54
|
});
|
|
54
55
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AGENTS.md
|
|
2
2
|
|
|
3
|
-
A [DaloyJS](https://daloyjs.dev) REST API deployed to **Vercel** on the **Node.js runtime**. **Contract-first**: routes use validation schemas (Zod here; DaloyJS also supports Standard Schema-compatible validators) and generate OpenAPI 3.1. `docs:
|
|
3
|
+
A [DaloyJS](https://daloyjs.dev) REST API deployed to **Vercel** on the **Node.js runtime**. **Contract-first**: routes use validation schemas (Zod here; DaloyJS also supports Standard Schema-compatible validators) and generate OpenAPI 3.1. `docs: "auto"` auto-mounts `GET /openapi.json`, `GET /openapi.yaml`, and `GET /docs` (Scalar UI) outside production.
|
|
4
4
|
|
|
5
5
|
- Package manager: pnpm (use `pnpm` unless the project's `package.json` was rewritten for npm/yarn/bun).
|
|
6
6
|
- Runtime: Vercel Node.js Functions on Fluid Compute (Web Standard `Request`/`Response`).
|
|
@@ -22,12 +22,12 @@ curl http://localhost:3000/books/1
|
|
|
22
22
|
|
|
23
23
|
## API documentation
|
|
24
24
|
|
|
25
|
-
- API docs (Scalar): <http://localhost:3000/docs>
|
|
25
|
+
- API docs (Scalar, development only): <http://localhost:3000/docs>
|
|
26
26
|
- OpenAPI 3.1 JSON: <http://localhost:3000/openapi.json>
|
|
27
27
|
- OpenAPI 3.1 YAML: <http://localhost:3000/openapi.yaml>
|
|
28
28
|
|
|
29
29
|
After deploying, the same routes serve `/docs`, `/openapi.json`, and `/openapi.yaml` from your Vercel deployment URL.
|
|
30
|
-
To brand Scalar, change `docs:
|
|
30
|
+
To brand Scalar, change `docs: "auto"` in `api/index.ts` to `docs: { scalar: { theme, customCss } }`.
|
|
31
31
|
|
|
32
32
|
<!-- daloy-minimal:strip-end docs -->
|
|
33
33
|
|
|
@@ -100,7 +100,7 @@ check, run `pnpm contract`.
|
|
|
100
100
|
|
|
101
101
|
## OpenAPI & docs routes
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
With `docs: "auto"` on `new App({...})` (the default in this template),
|
|
104
104
|
three routes are auto-mounted off the spec generated from your route
|
|
105
105
|
definitions:
|
|
106
106
|
|
|
@@ -110,8 +110,8 @@ definitions:
|
|
|
110
110
|
- `GET /docs` — Scalar API reference UI that loads the spec.
|
|
111
111
|
|
|
112
112
|
Customize via `docs: { openapiPath, openapiYamlPath, path, ui }`. Set
|
|
113
|
-
`openapiYamlPath: false` to disable just the YAML route, `docs:
|
|
114
|
-
mount
|
|
113
|
+
`openapiYamlPath: false` to disable just the YAML route, `docs: true` to
|
|
114
|
+
also mount them in production, or `docs: false` to disable all three.
|
|
115
115
|
On Vercel the YAML serializer is pure-string (no extra deps) and adds
|
|
116
116
|
<1KB to the bundle. For hand-rolled mounting, `openapiToYAML` is exported
|
|
117
117
|
from `@daloyjs/core/openapi`.
|
|
@@ -31,14 +31,14 @@ export const app = new App({
|
|
|
31
31
|
// (e.g. set it to 2 behind Cloudflare -> Vercel).
|
|
32
32
|
behindProxy: { hops: Number(process.env.TRUST_PROXY_HOPS ?? "1") },
|
|
33
33
|
// daloy-minimal:strip-start docs
|
|
34
|
-
// Auto-mounted docs (
|
|
34
|
+
// Auto-mounted docs, outside production only (`docs: "auto"`):
|
|
35
35
|
// GET /openapi.json — OpenAPI 3.1 spec (JSON)
|
|
36
36
|
// GET /openapi.yaml — OpenAPI 3.1 spec (YAML, served inline as text/yaml)
|
|
37
37
|
// GET /docs — Scalar API reference UI that loads the spec
|
|
38
38
|
openapi: {
|
|
39
39
|
info: { title: "My Daloy Vercel API", version: "0.0.1" },
|
|
40
40
|
},
|
|
41
|
-
docs:
|
|
41
|
+
docs: "auto",
|
|
42
42
|
// daloy-minimal:strip-end docs
|
|
43
43
|
});
|
|
44
44
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@AGENTS.md
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@AGENTS.md
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@AGENTS.md
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@AGENTS.md
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@AGENTS.md
|