Quick Start Run the smallest useful GraphJin query against a discovered schema. start guide start/quick-start start/quick-start.md

Quick Start

Run the smallest useful GraphJin query against a discovered schema.

Minimal config

Point GraphJin at your database in config/dev.yml. New source-aware projects should use sources::

YAML
sources:
  - name: app
    kind: database
    type: postgres
    default: true
    connection_string: ${DATABASE_URL}
    schema: public

Then start the service:

Shell
graphjin serve

Open the Web UI

Open http://localhost:8080/ after the service starts. The Runtime view is a quick visual check that GraphJin discovered the configured sources and is serving the built-in system roots.

GraphJin Web UI Runtime view showing ready sources, table count, catalog readiness, and security posture.
The Web UI is served by GraphJin itself and reads from the same runtime, catalog, and security GraphQL roots.

Use the Workbench at http://localhost:8080/workbench to try queries interactively. It sends requests to the same /api/v1/graphql endpoint that applications and command-line smoke tests use.

GraphJin Web UI Workbench running a products query and showing JSON results.
Workbench is useful for exploring the schema and result shape before you copy the same query into an API call.

First query

GraphJin discovers tables and relationships, then compiles GraphQL into database work.

GraphQL
query {
  products(limit: 3, order_by: { id: asc }) {
    id
    name
    owner {
      id
      fullName: full_name
    }
  }
}

The response shape follows the GraphQL selection. There are no user-written resolvers for database fields.

Verified by Example_query tests/query_test.go:18

Call the endpoint

Keep a raw endpoint call in your smoke test even if you used the Workbench. This verifies the HTTP API path your application or integration will call.

Shell
curl http://localhost:8080/api/v1/graphql \
  -H 'content-type: application/json' \
  -d '{"query":"query { products(limit: 3, order_by: { id: asc }) { id name } }"}'

Pass variables as JSON. Keep filters inside the GraphQL query shape and pass leaf values through variables:

GraphQL
query Products($maxPrice: Float!) {
  products(where: { price: { lteq: $maxPrice } }, order_by: { price: asc }) {
    id
    name
    price
  }
}
JSON
{ "maxPrice": 25 }

Next steps

Docs