@emseepea/create-database-schema-server 0.0.8 → 0.0.11

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
@@ -77,17 +77,21 @@ Stop the server with Control-C. Remove the local database and volume when you
77
77
  no longer need them:
78
78
 
79
79
  ```sh
80
- docker compose down --volumes
80
+ npm run db:reset
81
81
  ```
82
82
 
83
+ `npm run db:reset` deletes the local PostgreSQL volume and its data. You cannot
84
+ undo this action. Docker Compose starts PostgreSQL for local development only.
85
+ It is not a production deployment recipe.
86
+
83
87
  ## Change the Database Contract
84
88
 
85
89
  Edit `schema.sql`, recreate the development database, then regenerate the
86
90
  checked-in files:
87
91
 
88
92
  ```sh
89
- docker compose down --volumes
90
- docker compose up --detach --wait database
93
+ npm run db:reset
94
+ npm run db:start
91
95
  npm run generate
92
96
  ```
93
97
 
@@ -99,6 +103,23 @@ reads and writes while insulating tools from storage tables. The
99
103
  `summarize-pea-catalog` procedure is included only for databases where an
100
104
  existing operation must remain procedural.
101
105
 
106
+ ## Build a production container
107
+
108
+ Run `npm install` first so the project has a lockfile. Then run:
109
+
110
+ ```sh
111
+ npm run container:build
112
+ ```
113
+
114
+ The image is for a production deployment behind a trusted proxy. It starts with
115
+ the fail-closed production profile and needs a runtime-mounted deployment
116
+ configuration file. Keep secrets, including `DATABASE_URL`, in your platform's
117
+ runtime secret store, not in the Dockerfile, build arguments, or deployment
118
+ configuration file.
119
+
120
+ For the production proxy, runtime configuration, and hardening requirements, see
121
+ the [container guide](https://emseepea.github.io/emseepea/examples/#build-a-production-container).
122
+
102
123
  ## Tools
103
124
 
104
125
  - `list-pea-varieties` reads a bounded, fixed projection from the catalogue view.
@@ -0,0 +1,17 @@
1
+ .env
2
+ .env.*
3
+ .git
4
+ .github
5
+ .npmrc
6
+ artifacts
7
+ coverage
8
+ dist
9
+ docs
10
+ eval
11
+ initializer-dist
12
+ node_modules
13
+ release-artifacts
14
+ test
15
+ test-support
16
+ *.log
17
+ *.tsbuildinfo
@@ -0,0 +1,19 @@
1
+ FROM docker.io/library/node:24.21.0-trixie-slim@sha256:db3ae80f5d8df06e04dabdf7b44cbf008d32de168205fa0294444aabbc08c590 AS build
2
+ WORKDIR /app
3
+ COPY . .
4
+ RUN test "$(node --version)" = "v24.21.0" \
5
+ && test -f package-lock.json \
6
+ && npm ci --ignore-scripts \
7
+ && npm run build \
8
+ && npm prune --omit=dev --ignore-scripts
9
+
10
+ FROM gcr.io/distroless/nodejs24-debian13:nonroot@sha256:7781e8b4fccf59240bd539af6738cccf8dad4be303165c3a1fa065c48699b937
11
+ WORKDIR /app
12
+ ENV EMSEEPEA_DEPLOYMENT_MODE=production-behind-proxy
13
+ COPY --from=build --chown=65532:65532 /app/package.json ./package.json
14
+ COPY --from=build --chown=65532:65532 /app/node_modules ./node_modules
15
+ COPY --from=build --chown=65532:65532 /app/dist ./dist
16
+ USER 65532:65532
17
+ EXPOSE 3000
18
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD ["/nodejs/bin/node", "-e", "const port=process.env.PORT||'3000';fetch(`http://127.0.0.1:${port}/healthz`).then((r)=>process.exit(r.ok?0:1),()=>process.exit(1));"]
19
+ CMD ["dist/server.js"]
@@ -47,17 +47,21 @@ Stop the server with Control-C. Remove the local database and volume when you
47
47
  no longer need them:
48
48
 
49
49
  ```sh
50
- docker compose down --volumes
50
+ npm run db:reset
51
51
  ```
52
52
 
53
+ `npm run db:reset` deletes the local PostgreSQL volume and its data. You cannot
54
+ undo this action. Docker Compose starts PostgreSQL for local development only.
55
+ It is not a production deployment recipe.
56
+
53
57
  ## Change the Database Contract
54
58
 
55
59
  Edit `schema.sql`, recreate the development database, then regenerate the
56
60
  checked-in files:
57
61
 
58
62
  ```sh
59
- docker compose down --volumes
60
- docker compose up --detach --wait database
63
+ npm run db:reset
64
+ npm run db:start
61
65
  npm run generate
62
66
  ```
63
67
 
@@ -69,6 +73,23 @@ reads and writes while insulating tools from storage tables. The
69
73
  `summarize-pea-catalog` procedure is included only for databases where an
70
74
  existing operation must remain procedural.
71
75
 
76
+ ## Build a production container
77
+
78
+ Run `npm install` first so the project has a lockfile. Then run:
79
+
80
+ ```sh
81
+ npm run container:build
82
+ ```
83
+
84
+ The image is for a production deployment behind a trusted proxy. It starts with
85
+ the fail-closed production profile and needs a runtime-mounted deployment
86
+ configuration file. Keep secrets, including `DATABASE_URL`, in your platform's
87
+ runtime secret store, not in the Dockerfile, build arguments, or deployment
88
+ configuration file.
89
+
90
+ For the production proxy, runtime configuration, and hardening requirements, see
91
+ the [container guide](https://emseepea.github.io/emseepea/examples/#build-a-production-container).
92
+
72
93
  ## Tools
73
94
 
74
95
  - `list-pea-varieties` reads a bounded, fixed projection from the catalogue view.
@@ -9,18 +9,21 @@
9
9
  "generate": "kanel --config kanel.config.cjs",
10
10
  "generate:check": "node test/with-postgres.mjs node scripts/check-generated.mjs",
11
11
  "start": "node dist/server.js",
12
- "dev": "docker compose up --detach --wait database && npm run generate && npm run build && npm start",
12
+ "dev": "npm run db:start && npm run generate && npm run build && npm start",
13
+ "db:start": "docker compose up --detach --wait database",
14
+ "db:reset": "docker compose down --volumes",
13
15
  "test": "npm run build && npm run test:built",
14
16
  "test:built": "node test/with-postgres.mjs node --test test/*.test.mjs",
15
17
  "test:llm": "npm run build && npm run test:llm:built",
16
18
  "test:llm:built": "node test/with-postgres.mjs emseepea-test eval",
17
- "lint": "oxlint src test eval scripts kanel.config.cjs"
19
+ "lint": "oxlint src test eval scripts kanel.config.cjs",
20
+ "container:build": "docker build --tag emseepea-server:local ."
18
21
  },
19
22
  "devDependencies": {
20
- "@emseepea/feedback": "0.2.4",
23
+ "@emseepea/feedback": "0.2.7",
21
24
  "kanel": "4.0.4",
22
25
  "kanel-zod": "4.0.1",
23
- "@emseepea/testing": "0.9.7",
26
+ "@emseepea/testing": "0.9.11",
24
27
  "@modelcontextprotocol/client": "2.0.0",
25
28
  "@types/node": "24.13.3",
26
29
  "@types/pg": "8.23.1",
@@ -32,7 +35,7 @@
32
35
  },
33
36
  "private": true,
34
37
  "dependencies": {
35
- "@emseepea/server": "0.9.0",
38
+ "@emseepea/server": "0.10.1",
36
39
  "pg": "8.23.0",
37
40
  "zod": "4.4.3"
38
41
  }
@@ -1,8 +1,8 @@
1
- import { serveEmseepea } from "@emseepea/server";
1
+ import { loadDeploymentProfile, serveEmseepea } from "@emseepea/server";
2
2
  import { createDatabaseSchemaExample } from "./app.js";
3
3
 
4
4
  const databaseUrl = process.env.DATABASE_URL ?? "postgres://emseepea:emseepea@127.0.0.1:5432/emseepea";
5
- const { app } = await createDatabaseSchemaExample({ databaseUrl });
5
+ const { app } = await createDatabaseSchemaExample({ databaseUrl, deployment: loadDeploymentProfile() });
6
6
  const running = await serveEmseepea(app, {
7
7
  port: Number.parseInt(process.env.PORT ?? "3000", 10),
8
8
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emseepea/create-database-schema-server",
3
- "version": "0.0.8",
3
+ "version": "0.0.11",
4
4
  "description": "Create an Em See Pea server with internal validation generated from a PostgreSQL schema.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -12,7 +12,9 @@
12
12
  "generate": "kanel --config kanel.config.cjs",
13
13
  "generate:check": "node test/with-postgres.mjs node scripts/check-generated.mjs",
14
14
  "start": "node dist/server.js",
15
- "dev": "docker compose up --detach --wait database && npm run generate && npm run build && npm start",
15
+ "dev": "npm run db:start && npm run generate && npm run build && npm start",
16
+ "db:start": "docker compose up --detach --wait database",
17
+ "db:reset": "docker compose down --volumes",
16
18
  "test": "npm run build && npm run test:built",
17
19
  "test:built": "node test/with-postgres.mjs node --test test/*.test.mjs",
18
20
  "test:llm": "npm run build && npm run test:llm:built",
@@ -21,13 +23,13 @@
21
23
  "prepack": "npm run build:initializer"
22
24
  },
23
25
  "devDependencies": {
24
- "@emseepea/feedback": "0.2.4",
25
- "@emseepea/server": "0.9.0",
26
+ "@emseepea/feedback": "0.2.7",
27
+ "@emseepea/server": "0.10.1",
26
28
  "pg": "8.23.0",
27
29
  "zod": "4.4.3",
28
30
  "kanel": "4.0.4",
29
31
  "kanel-zod": "4.0.1",
30
- "@emseepea/testing": "0.9.7",
32
+ "@emseepea/testing": "0.9.11",
31
33
  "@modelcontextprotocol/client": "2.0.0",
32
34
  "@types/node": "24.13.3",
33
35
  "@types/pg": "8.23.1",