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
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# LaunchQL Agent Navigation Guide
1
+
# Constructive Agent Navigation Guide
2
2
3
-
This guide helps AI agents quickly navigate and understand the LaunchQL codebase without having to read everything. LaunchQL is a comprehensive full-stack framework for building secure, role-aware GraphQL APIs backed by PostgreSQL databases.
3
+
This guide helps AI agents quickly navigate and understand the Constructive codebase without having to read everything. Constructive is a comprehensive full-stack framework for building secure, role-aware GraphQL APIs backed by PostgreSQL databases.
4
4
5
5
## 🎯 Quick Start for Agents
6
6
@@ -12,17 +12,17 @@ This guide helps AI agents quickly navigate and understand the LaunchQL codebase
12
12
5.**`packages/types`** - TypeScript type definitions
13
13
14
14
**Key Classes to Understand:**
15
-
-**`LaunchQLPackage`** (`packages/core/src/core/class/launchql.ts`) - Workspace and module management
This guide covers a local development workflow for the jobs stack:
4
4
5
-
- Postgres + `launchql-ext-jobs`
5
+
- Postgres + `launchql-database-jobs`
6
6
- LaunchQL API server
7
7
-`simple-email` function
8
+
-`send-email-link` function
8
9
-`knative-job-service`
9
10
10
11
It assumes:
@@ -58,17 +59,17 @@ Make sure `pgpm` is installed and up to date.
58
59
59
60
From the `constructive-db/` directory (with `pgenv` applied):
60
61
61
-
1.Bootstrap admin users:
62
+
1.Create the `launchql` database (if it does not already exist):
62
63
63
64
```sh
64
-
pgpm admin-users bootstrap --yes
65
-
pgpm admin-users add --test --yes
65
+
createdb launchql
66
66
```
67
67
68
-
2.Create the `launchql` database (if it does not already exist):
68
+
2.Bootstrap admin users:
69
69
70
70
```sh
71
-
createdb launchql
71
+
pgpm admin-users bootstrap --yes
72
+
pgpm admin-users add --test --yes
72
73
```
73
74
74
75
3. Deploy the main app and jobs packages into `launchql`:
@@ -102,19 +103,111 @@ This starts:
102
103
103
104
-`launchql-server` – GraphQL API server
104
105
-`simple-email` – Knative-style HTTP function
106
+
-`send-email-link` – Knative-style HTTP function
105
107
-`knative-job-service` – jobs runtime (callback server + worker + scheduler)
106
108
107
109
---
108
110
109
-
## 5. Enqueue a test job (simple-email)
111
+
### Switching dry run vs real Mailgun sending
112
+
113
+
By default, `docker-compose.jobs.yml` runs both email functions in dry-run mode (no real email is sent), and it uses placeholder Mailgun credentials unless you provide `MAILGUN_API_KEY` / `MAILGUN_KEY`.
114
+
115
+
Quick start commands:
116
+
117
+
Dry run:
118
+
119
+
```sh
120
+
docker compose -f docker-compose.jobs.yml up -d --build --force-recreate
To use a real Mailgun key without editing `docker-compose.jobs.yml`, set these env vars before starting the stack (or put them in a local `.env` file in the `constructive/` directory). Don't commit your `.env`.
130
+
131
+
```sh
132
+
export MAILGUN_API_KEY="your-mailgun-key"
133
+
export MAILGUN_KEY="your-mailgun-key"
134
+
```
135
+
136
+
If you're not using `mg.constructive.io`, also override `MAILGUN_DOMAIN`, `MAILGUN_FROM`, and `MAILGUN_REPLY` (for example in the override file below) to match your Mailgun setup.
137
+
138
+
To actually send email (instead of dry-run), set these env vars (or put them in your local `.env`):
139
+
140
+
```sh
141
+
export SIMPLE_EMAIL_DRY_RUN=false
142
+
export SEND_EMAIL_LINK_DRY_RUN=false
143
+
```
144
+
145
+
Then recreate the stack so the new env is applied:
146
+
147
+
```sh
148
+
docker compose -f docker-compose.jobs.yml up -d --build --force-recreate
149
+
```
150
+
151
+
If you prefer not to export env vars, create a local override file (don't commit it) at `docker-compose.jobs.override.yml`:
152
+
153
+
```yml
154
+
services:
155
+
simple-email:
156
+
environment:
157
+
SIMPLE_EMAIL_DRY_RUN: "false"
158
+
159
+
send-email-link:
160
+
environment:
161
+
SEND_EMAIL_LINK_DRY_RUN: "false"
162
+
```
163
+
164
+
Start the stack with both files:
165
+
166
+
```sh
167
+
docker compose -f docker-compose.jobs.yml -f docker-compose.jobs.override.yml up -d --build --force-recreate
168
+
```
169
+
170
+
To switch back to dry-run, set `SIMPLE_EMAIL_DRY_RUN=true` and `SEND_EMAIL_LINK_DRY_RUN=true` (or delete the override file) and recreate again.
171
+
172
+
---
173
+
174
+
## 5. Ensure GraphQL host routing works for `send-email-link`
175
+
176
+
LaunchQL selects the API by the HTTP `Host` header using rows in `meta_public.domains`.
177
+
178
+
For local development, `app-svc-local` seeds `admin.localhost` as the admin API domain. `docker-compose.jobs.yml` adds a Docker network alias so other containers can resolve `admin.localhost` to the `launchql-server` container, and `send-email-link` uses:
Quick check from your host (should return JSON, not HTML):
183
+
184
+
```sh
185
+
curl -s -H 'Host: admin.localhost' \
186
+
-H 'Content-Type: application/json' \
187
+
-X POST http://localhost:3000/graphql \
188
+
--data '{"query":"query { __typename }"}'
189
+
```
190
+
191
+
If your GraphQL server requires auth, set `GRAPHQL_AUTH_TOKEN` before starting the jobs stack (it is passed through to the `send-email-link` container).
192
+
193
+
---
194
+
195
+
## 6. Enqueue a test job (simple-email)
110
196
111
197
With the jobs stack running, you can enqueue a test job from your host into the Postgres container:
112
198
199
+
First, grab a real `database_id` (required by `send-email-link`, optional for `simple-email`):
200
+
201
+
```sh
202
+
DBID="$(docker exec -i postgres psql -U postgres -d launchql -Atc 'SELECT id FROM collections_public.database ORDER BY created_at LIMIT 1;')"
203
+
echo"$DBID"
204
+
```
205
+
113
206
```sh
114
207
docker exec -it postgres \
115
208
psql -U postgres -d launchql -c "
116
209
SELECT app_jobs.add_job(
117
-
'00000000-0000-0000-0000-000000000001'::uuid,
210
+
'$DBID'::uuid,
118
211
'simple-email',
119
212
json_build_object(
120
213
'to', 'user@example.com',
@@ -129,7 +222,39 @@ You should then see the job picked up by `knative-job-service` and the email pay
129
222
130
223
---
131
224
132
-
## 6. Inspect logs and iterate
225
+
## 7. Enqueue a test job (`send-email-link`)
226
+
227
+
`send-email-link` queries GraphQL for site/database metadata, so it requires:
228
+
229
+
- The app/meta packages deployed in step 3 (`app-svc-local`, `db-meta`)
230
+
- A real `database_id` (use `$DBID` above)
231
+
- A GraphQL hostname that matches a seeded domain route (step 5)
232
+
233
+
With `SEND_EMAIL_LINK_DRY_RUN=true` (default in `docker-compose.jobs.yml`), enqueue a job:
Copy file name to clipboardExpand all lines: FOOTER.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,18 +47,18 @@ Common issues and solutions for pgpm, PostgreSQL, and testing.
47
47
48
48
### 🔁 Streaming & Uploads
49
49
50
+
*[etag-hash](https://github.com/constructive-io/constructive/tree/main/packages/etag-hash): **🏷️ S3-compatible ETags** created by streaming and hashing file uploads in chunks.
51
+
*[etag-stream](https://github.com/constructive-io/constructive/tree/main/packages/etag-stream): **🔄 ETag computation** via Node stream transformer during upload or transfer.
52
+
*[uuid-hash](https://github.com/constructive-io/constructive/tree/main/packages/uuid-hash): **🆔 Deterministic UUIDs** generated from hashed content, great for deduplication and asset referencing.
53
+
*[uuid-stream](https://github.com/constructive-io/constructive/tree/main/packages/uuid-stream): **🌊 Streaming UUID generation** based on piped file content—ideal for upload pipelines.
50
54
*[launchql/s3-streamer](https://github.com/constructive-io/constructive/tree/main/packages/s3-streamer): **📤 Direct S3 streaming** for large files with support for metadata injection and content validation.
51
-
*[launchql/etag-hash](https://github.com/constructive-io/constructive/tree/main/packages/etag-hash): **🏷️ S3-compatible ETags** created by streaming and hashing file uploads in chunks.
52
-
*[launchql/etag-stream](https://github.com/constructive-io/constructive/tree/main/packages/etag-stream): **🔄 ETag computation** via Node stream transformer during upload or transfer.
53
-
*[launchql/uuid-hash](https://github.com/constructive-io/constructive/tree/main/packages/uuid-hash): **🆔 Deterministic UUIDs** generated from hashed content, great for deduplication and asset referencing.
54
-
*[launchql/uuid-stream](https://github.com/constructive-io/constructive/tree/main/packages/uuid-stream): **🌊 Streaming UUID generation** based on piped file content—ideal for upload pipelines.
55
55
*[launchql/upload-names](https://github.com/constructive-io/constructive/tree/main/packages/upload-names): **📂 Collision-resistant filenames** utility for structured and unique file names for uploads.
56
56
57
57
### 🧰 CLI & Codegen
58
58
59
59
*[pgpm](https://github.com/constructive-io/constructive/tree/main/packages/pgpm): **🖥️ PostgreSQL Package Manager** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
60
60
*[@launchql/cli](https://github.com/constructive-io/constructive/tree/main/packages/cli): **🖥️ Command-line toolkit** for managing LaunchQL projects—supports database scaffolding, migrations, seeding, code generation, and automation.
61
-
*[constructive-io/constructive-gen](https://github.com/constructive-io/constructive/tree/main/packages/launchql-gen): **✨ Auto-generated GraphQL** mutations and queries dynamically built from introspected schema data.
61
+
*[launchql-gen](https://github.com/constructive-io/constructive/tree/main/packages/launchql-gen): **✨ Auto-generated GraphQL** mutations and queries dynamically built from introspected schema data.
62
62
*[@launchql/query-builder](https://github.com/constructive-io/constructive/tree/main/packages/query-builder): **🏗️ SQL constructor** providing a robust TypeScript-based query builder for dynamic generation of `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and stored procedure calls—supports advanced SQL features like `JOIN`, `GROUP BY`, and schema-qualified queries.
63
63
*[@launchql/query](https://github.com/constructive-io/constructive/tree/main/packages/query): **🧩 Fluent GraphQL builder** for PostGraphile schemas. ⚡ Schema-aware via introspection, 🧩 composable and ergonomic for building deeply nested queries.
0 commit comments