Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/nexus-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: nexus CI

on:
pull_request:
paths:
- "packages/nexus/**"
- ".github/workflows/nexus-ci.yml"

jobs:
gbg-nexus:
name: "@gbg/nexus"
runs-on: ubuntu-latest
env:
NPM_CONFIG_WORKSPACES: "false"
NPM_CONFIG_LEGACY_PEER_DEPS: "true"
defaults:
run:
working-directory: packages/nexus
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: packages/nexus/package-lock.json

- name: Install
run: npm install

- name: Typecheck
run: npm run typecheck

- name: Test
run: npm test
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"packages/*",
"!packages/codemode-pi",
"!packages/pi-workflows",
"!packages/cluster"
"!packages/cluster",
"!packages/nexus"
]
}
8 changes: 6 additions & 2 deletions packages/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ One NATS: Cosmo router EDFS and `@tmnl/msh` share the existing helm NATS at
This package is types + CRD Manifests, not a second Pepr module and not a
reconcile controller.

## Hold deploy
## Ship

Do not run `alchemy deploy` from this land.
Ship when CI is green on the lab branch. User corrects after the fact.

Stop is only: paid cloud, deploy that leaves this machine, a second NATS, a
second catalog source of truth, a second API group. Wallet still stops paid
cloud and alchemy deploy that leaves this machine.

```text
npm install
Expand Down
4 changes: 4 additions & 0 deletions packages/cluster/test/readme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ describe('cluster README identity', () => {
expect(readme).toContain('Catalog stays Postgres off-cluster');
expect(readme).toContain('packages/tmnl/nix/modules/nats/values.yaml');
expect(readme).toContain('@tmnl/msh');
expect(readme).toContain('Ship when CI is green on the lab branch');
expect(readme).not.toContain('Hold deploy');
expect(readme).not.toContain('from this land');
expect(readme).not.toContain('I am not');
expect(readme).not.toContain(
'CosmoRouter and CosmoSubgraph stay GraphQL specializations in `packages/tmnl`',
);
Expand Down
4 changes: 4 additions & 0 deletions packages/nexus/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
*.log
router.json
1 change: 1 addition & 0 deletions packages/nexus/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
69 changes: 69 additions & 0 deletions packages/nexus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# @gbg/nexus

Cosmo/WunderGraph federated GraphQL **router home**. Complete package, not a stub.
Not tmnl. Not plexus. tmnl consumes this package.

Leftover Pepr (`cosmo-operator`, CosmoRouter / CosmoSubgraph CRDs) stays in
`packages/tmnl/src/infra/graph`. This package does not copy those sources.
Cluster is `@gbg/cluster`. Cosmo home is `@gbg/nexus`. k3d hosts applets.

Catalog stays Postgres off-cluster; there is no catalog pod.

## Compose (the can-do path)

Official local composition. No control plane. No Helm umbrella, studio,
ClickHouse, Keycloak, or CDN.

```text
wgc router compose -i graph.yaml -o router.json
```

Same command as `npm run compose`. Output filename is `router.json`
everywhere (local file, leftover CRD mount `/config/router.json`, Cosmo
router `execution_config.file.path`).

| File | Role |
|------|------|
| `graph.yaml` | wgc compose input (`version: 1`, `subgraphs[]`) |
| `fixtures/fixture-demo.graphql` | Federation v2 fixture SDL. Not a catalog / specimen / procurement well. |
| `config.yaml` | Router runtime: `execution_config.file` + `events.providers.nats` |
| `router.json` | Execution config `wgc` emits (generated; not committed) |

Router image: `ghcr.io/wundergraph/cosmo/router`. Default listen: `3002`.

Pinned CLI: `wgc@0.130.1` (tmnl already depends on `wgc`; current npm is
`0.130.1`).

## One NATS

Cosmo router EDFS and `@tmnl/msh` share the existing helm NATS at
`packages/tmnl/nix/modules/nats/values.yaml` (release `nats`, namespace
`nats`, client URL `nats://nats.nats.svc.cluster.local:4222`). No second
broker. No paid Synadia Cloud.

## tmnl consumes

Import `@gbg/nexus` for compose helpers and types (`@gbg/nexus` is mapped in
`packages/tmnl/tsconfig.json` and `tsconfig.base.json`). Leftover Pepr stays
in `packages/tmnl/src/infra/graph`. Cluster-create in
`packages/tmnl/nix/modules/k8s.nix` is a helper path, not this home.

This package is excluded from the root bun/npm workspace (`!packages/nexus`)
so `wgc@0.130.1` keeps its own lock, same pattern as `@gbg/cluster`.

## Ship

Ship when CI is green on the lab branch. User corrects after the fact.

Stop is only: paid cloud, deploy that leaves this machine, a second NATS, a
second catalog source of truth, a second API group. Wallet still stops paid
cloud and alchemy deploy that leaves this machine.

```text
npm install
npm run typecheck
npm test
```

CI sets `NPM_CONFIG_WORKSPACES=false` so those three commands install
`wgc@0.130.1` into `packages/nexus`.
23 changes: 23 additions & 0 deletions packages/nexus/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Cosmo router runtime config (local compose path).
# Official: https://cosmo-docs.wundergraph.com/tutorial/mastering-local-development-for-graphql-federation
# Router image: ghcr.io/wundergraph/cosmo/router
# Default listen: 3002. Leftover tmnl CRDs mount execution config at /config/router.json.
#
# One NATS: Cosmo router EDFS and @tmnl/msh share the existing helm NATS at
# packages/tmnl/nix/modules/nats/values.yaml (release `nats`, namespace `nats`).
# No second broker. No Synadia Cloud.
version: "1"

dev_mode: true
listen_addr: "0.0.0.0:3002"

execution_config:
file:
path: router.json
watch: true

events:
providers:
nats:
- id: default
url: "nats://nats.nats.svc.cluster.local:4222"
18 changes: 18 additions & 0 deletions packages/nexus/fixtures/fixture-demo.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Federation v2 fixture / demo subgraph for local Cosmo compose.
# Not a catalog, specimen, procurement, GPS, or taxon well.
# Empty lab wells stay empty; this SDL exists so `wgc router compose` is real.

extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.5"
import: ["@key", "@shareable"]
)

type Query {
fixtureHealth: String!
}

type FixtureDemo @key(fields: "id") {
id: ID!
label: String!
}
13 changes: 13 additions & 0 deletions packages/nexus/graph.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Cosmo local compose input.
# Official: https://cosmo-docs.wundergraph.com/cli/router/compose
# `wgc router compose -i graph.yaml -o router.json`
#
# File SDL takes precedence over introspection. The subgraph below is a
# fixture/demo so compose is real. It is not a catalog, specimen, procurement,
# GPS, or taxon well.
version: 1
subgraphs:
- name: fixture-demo
routing_url: http://localhost:4001/graphql
schema:
file: ./fixtures/fixture-demo.graphql
Loading
Loading