Champagne

GraphQL API

Query persisted Person records without authentication.

The single API endpoint is /api/graphql. It accepts queries over GET or POST. GraphiQL is available at that endpoint in development, not production.

Example

query People {
  people {
    id
    name
    email
  }
}

The query returns up to 100 records from demo.person, ordered by name and ID. Compose seeds three fictional examples, including:

{
  "id": "00000000-0000-4000-8000-000000000001",
  "name": "Alex Morgan",
  "email": "alex@example.com"
}

The GraphQL response wraps the records in {"data":{"people":[...]}}.

Set APP_URL to the URL printed by make dev or make worktree-up:

curl "$APP_URL/api/graphql" \
  -H 'Content-Type: application/json' \
  --data '{"query":"query People { people { id name email } }"}'

Extend the contract

  1. Edit backend/src/graphql/schema.ts and web/src/graphql/operations.graphql.
  2. Run make codegen to generate resolver and operation types.
  3. Update the resolver and native Drizzle query.
  4. Update the frontend and tests, then run make check and make test.

Do not edit generated files by hand. CI checks for code generation drift.

This demo has no authentication. Never store private people data in this example. Add authentication, authorization, validation, and suitable query limits before introducing private data or expensive operations. There are no mutations yet.

On this page