|
| 1 | +# Constructive Monorepo Setup |
| 2 | + |
| 3 | +Set up the Constructive monorepo for local development and testing. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Node.js 20+ |
| 8 | +- pnpm 9+ |
| 9 | +- Docker (for PostgreSQL) |
| 10 | +- pgpm CLI (`npm install -g pgpm`) |
| 11 | + |
| 12 | +## Quick Start |
| 13 | + |
| 14 | +```bash |
| 15 | +# 1. Install dependencies |
| 16 | +pnpm install |
| 17 | + |
| 18 | +# 2. Start PostgreSQL via pgpm Docker |
| 19 | +pgpm docker start --image docker.io/constructiveio/postgres-plus:18 --recreate |
| 20 | + |
| 21 | +# 3. Load environment variables |
| 22 | +eval "$(pgpm env)" |
| 23 | + |
| 24 | +# 4. Bootstrap admin users for testing |
| 25 | +pgpm admin-users bootstrap --yes |
| 26 | +pgpm admin-users add --test --yes |
| 27 | + |
| 28 | +# 5. Build the monorepo |
| 29 | +pnpm build |
| 30 | + |
| 31 | +# 6. Run tests in a specific package |
| 32 | +cd packages/<yourmodule> |
| 33 | +pnpm test |
| 34 | +``` |
| 35 | + |
| 36 | +## Docker Image |
| 37 | + |
| 38 | +Use `docker.io/constructiveio/postgres-plus:18` which includes PostgreSQL with PostGIS, pgvector, pg_textsearch, pg_trgm, btree_gin, and uuid-ossp extensions. |
| 39 | + |
| 40 | +For detailed Docker and pgpm usage, see the [pgpm skill](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/pgpm) in the public skills repo. |
| 41 | + |
| 42 | +## Monorepo Navigation |
| 43 | + |
| 44 | +See [AGENTS.md](../../AGENTS.md) at the repo root for the full navigation guide covering: |
| 45 | +- Package layout (`packages/*`, `pgpm/*`, `graphql/*`, `postgres/*`, `graphile/*`) |
| 46 | +- Entry points (PGPM CLI, Constructive CLI, GraphQL Server) |
| 47 | +- Environment configuration patterns |
| 48 | +- Testing framework selection guide |
| 49 | + |
| 50 | +## Code Generation (SDK) |
| 51 | + |
| 52 | +To regenerate the GraphQL SDK after schema changes: |
| 53 | + |
| 54 | +```bash |
| 55 | +# Generate types, hooks, ORM, and CLI from a running GraphQL endpoint |
| 56 | +cnc codegen |
| 57 | +``` |
| 58 | + |
| 59 | +Skills are auto-generated to `.agents/skills/` when `docs.skills: true` is set in the codegen config. |
| 60 | + |
| 61 | +For detailed codegen configuration, see the [constructive-graphql skill](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-graphql) — specifically the [codegen.md reference](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-graphql/references/codegen.md). |
| 62 | + |
| 63 | +## Graphile Plugin Development |
| 64 | + |
| 65 | +Graphile plugins live under `graphile/*`. For PostGIS plugin development and testing, see the [constructive-graphql skill](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-graphql) — specifically the [search-postgis.md reference](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-graphql/references/search-postgis.md). |
| 66 | + |
| 67 | +## Testing |
| 68 | + |
| 69 | +See [AGENTS.md](../../AGENTS.md) for the testing framework selection guide. For comprehensive database testing patterns, see the [constructive-testing skill](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-testing). |
| 70 | + |
| 71 | +## Related Skills |
| 72 | + |
| 73 | +- [pgpm](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/pgpm) — Docker, migrations, deploy/verify/revert |
| 74 | +- [constructive-graphql](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-graphql) — Codegen, search, PostGIS |
| 75 | +- [constructive-testing](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-testing) — pgsql-test, drizzle-orm-test |
| 76 | +- [constructive-tooling](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-tooling) — pnpm workspace, makage builds |
| 77 | +- [constructive-setup](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-setup) — Full setup guide (public skills repo) |
0 commit comments