You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,7 +129,7 @@ pnpm build # Recompile
129
129
130
130
## Key Details
131
131
132
-
-Functions run on `PORT=8080` (Knative default)
132
+
-Each function declares its port in `handler.json` (`simple-email` 8081, `send-email-link` 8082, `knative-job-example` 8083, `python-example` 8084); the job service uses 8080
133
133
- Email functions support dry-run via `SIMPLE_EMAIL_DRY_RUN` / `SEND_EMAIL_LINK_DRY_RUN`
134
134
-`loadFunctionApp()` in job/service resolves modules by name (e.g. `@constructive-io/simple-email-fn`)
135
135
- GraphQL clients require `GRAPHQL_URL` env var and `X-Database-Id` header
- generated/my-function/k8s/local-deployment.yaml # <- add this
333
-
```
334
-
335
-
And add a port-forward entry:
336
-
```yaml
337
-
portForward:
338
-
- resourceType: service
339
-
resourceName: my-function
340
-
namespace: constructive-functions
341
-
port: 80
342
-
localPort: 8083# pick an unused port
343
-
```
344
-
345
-
4. **Register in job-service** — edit `k8s/overlays/local-simple/job-service.yaml`, add to `JOBS_SUPPORTED` and `INTERNAL_GATEWAY_DEVELOPMENT_MAP`.
346
-
347
-
5. **Test:**
348
-
349
-
```bash
350
-
make skaffold-dev # deploy
351
-
pnpm test:e2e # run e2e tests
352
-
```
305
+
The canonical, end-to-end workflow lives in [docs/skills/adding-functions.md](./docs/skills/adding-functions.md). Quick summary:
306
+
307
+
1. Create `functions/<name>/handler.json` and `functions/<name>/handler.ts`.
308
+
2. Register the function with the job service in `job/service/src/types.ts` (`FunctionName` union) and `job/service/src/index.ts` (`functionRegistry` entry).
309
+
3. Run `pnpm generate && pnpm install && pnpm build`.
310
+
311
+
`pnpm generate` automatically updates `skaffold.yaml` (per-function profile + port-forwards), `k8s/overlays/local-simple/job-service.yaml` (`JOBS_SUPPORTED` and `INTERNAL_GATEWAY_DEVELOPMENT_MAP`), and `generated/functions-manifest.json`. No manual edits to those files are needed.
312
+
313
+
Then test with `make skaffold-dev` and `pnpm test:e2e`. See the skill doc for the unit-test, e2e-test, and CI checklist.
Functions playground for Constructive — isolated workspace for building, testing, and deploying Knative-style HTTP functions.
3
+
Functions playground for Constructive — a workspace for building, testing, and deploying serverless HTTP functions backed by a Postgres-backed job queue.
4
+
5
+
Functions are authored in `functions/<name>/` (a `handler.ts` plus a `handler.json` manifest), generated into runnable workspace packages by `pnpm generate`, and dispatched by the job service in `job/service/`. Templates live in `templates/` (`node-graphql` and `python` are supported today).
4
6
5
7
This repo is also the source of the **Portable Functions Toolkit**: a set of `@constructive-io/fn-*` npm packages that any external repo can `pnpm add` to get the same code-gen + Docker + k8s pipeline against its own `functions/` directory. See [docs/portable-functions-toolkit.md](docs/portable-functions-toolkit.md) for the full toolkit guide.
6
8
@@ -20,121 +22,103 @@ pnpm fn dev # run functions as local Node proce
20
22
## Quick start (this repo, dogfood)
21
23
22
24
```bash
23
-
# Install dependencies
24
-
pnpm install
25
-
26
-
# Build all functions
27
-
pnpm build
25
+
pnpm generate # generate workspace packages from handler.json manifests
-`SEND_EMAIL_LINK_DRY_RUN` — If `true`, logs email payload without sending
58
-
-`DEFAULT_DATABASE_ID` — Default database UUID
59
-
-`GRAPHQL_URL` — GraphQL API endpoint
60
-
-`META_GRAPHQL_URL` — Meta GraphQL API endpoint (optional)
61
-
-`GRAPHQL_AUTH_TOKEN` — Optional Bearer token for GraphQL requests
62
-
-`LOCAL_APP_PORT` — Local port for dashboard links (e.g., `3000`)
63
-
-`MAILGUN_*` — Same Mailgun config as `simple-email`
52
+
### `send-email-link`
64
53
65
-
## Development
54
+
Sends invite, password reset, and verification emails (rendered via MJML).
66
55
67
-
This repo includes full Kubernetes manifests for deploying functions to any cluster.
56
+
-`SEND_EMAIL_LINK_DRY_RUN` — if `true`, logs the payload instead of sending
57
+
-`DEFAULT_DATABASE_ID` — default database UUID
58
+
-`GRAPHQL_URL`, `META_GRAPHQL_URL` — GraphQL API endpoints
59
+
-`GRAPHQL_AUTH_TOKEN` — optional Bearer token for GraphQL requests
60
+
-`LOCAL_APP_PORT` — local port for dashboard links (e.g. `3000`)
61
+
-`MAILGUN_*` — same Mailgun config as `simple-email`
68
62
69
-
### Local Kubernetes (kind/minikube)
63
+
### `knative-job-example` / `python-example`
70
64
71
-
```bash
72
-
cd k8s
65
+
Reference implementations for the `node-graphql` and `python` templates.
73
66
74
-
# Install Knative Serving + Kourier only (no CNPG)
75
-
make operators-knative-only
67
+
## Development
76
68
77
-
# Apply local overlay (single Postgres, single MinIO, functions)
78
-
make kustomize-local
69
+
The full local-dev guide lives in [DEVELOPMENT.md](./DEVELOPMENT.md). Two paths:
79
70
80
-
# Port-forward to local services
81
-
make proxy-server # GraphQL API -> localhost:8080
82
-
make proxy-explorer # GraphQL explorer UI -> localhost:8081
83
-
make proxy-web # Dashboard UI -> localhost:3000
84
-
```
71
+
-**Docker Compose + local Node** (fastest iteration) — `make dev` for infrastructure, `make dev-fn` to run functions as local Node processes.
72
+
-**Skaffold on local k8s** (production-like, with hot reload) — `make skaffold-dev` deploys the full stack to the `constructive-functions` namespace and watches handler files.
85
73
86
-
See `k8s/DEVELOPMENT_LOCAL.md` for detailed local setup.
74
+
For the Knative variant of the k8s setup, see `k8s/DEVELOPMENT_LOCAL.md`.
87
75
88
76
### CI/CD
89
77
90
-
The `CI Test K8s` workflow (`.github/workflows/test-k8s-deployment.yaml`) runs on every PR/push to `main` that touches `k8s/**`. It:
91
-
92
-
1. Spins up a `kind` cluster
93
-
2. Installs Knative via `make operators-knative-only`
94
-
3. Applies the `k8s/overlays/ci` overlay
95
-
4. Waits for workloads to be ready
78
+
The `CI Test K8s` workflow (`.github/workflows/test-k8s-deployment.yaml`) runs on PRs and pushes to `main` that touch `k8s/`, `tests/e2e/`, or `functions/`. It spins up a `kind` cluster, applies the `k8s/overlays/ci` overlay, and runs the per-function e2e tests.
0 commit comments