DocsGraphQL
GraphQL API
Full GraphQL support with queries, mutations, and real-time subscriptions. Schema automatically generated from your PostgreSQL database.
Endpoints
POST /api/graphqlExecute GraphQL queries and mutations
GET /api/graphqlGraphQL Playground (interactive IDE)
WS /api/graphql/wsWebSocket endpoint for real-time subscriptions
Queries
GraphQL
# Basic query
query {
users {
id
name
email
}
}
# With filtering and pagination
query {
users(
filter: { status: { eq: "active" } }
limit: 10
offset: 0
orderBy: { createdAt: DESC }
) {
id
name
email
createdAt
}
}
# Nested relationships
query {
orders {
id
total
customer {
name
email
}
items {
quantity
product {
name
price
}
}
}
}Mutations
GraphQL
# Insert single record
mutation {
insertUserOne(objects: {
name: "Alice",
email: "alice@example.com"
}) {
id
name
email
}
}
# Insert multiple records
mutation {
insertUsers(objects: [
{ name: "Alice", email: "alice@example.com" },
{ name: "Bob", email: "bob@example.com" }
]) {
id
name
}
}
# Update with where clause
mutation {
updateUsers(
where: { email: { eq: "alice@example.com" } }
set: { name: "Alice Smith" }
) {
id
name
}
}
# Delete with where clause
mutation {
deleteUsers(where: { id: { eq: "uuid-here" } }) {
id
email
}
}Subscriptions
Real-time updates via WebSocket. Connect to ws://localhost:3000/api/graphql/ws using the graphql-transport-ws protocol.
GraphQL
# Subscribe to table changes
subscription {
users {
id
name
email
}
}
# Subscribe to team changes
subscription {
teams {
id
name
slug
}
}
# Subscribe to projects
subscription {
projects {
id
name
status
}
}Subscriptions are powered by PostgreSQL LISTEN/NOTIFY. Changes trigger automatically when data is inserted, updated, or deleted.
Filter Operators
| Operator | Description |
|---|---|
| eq | Equals |
| neq | Not equals |
| gt / gte | Greater than / or equal |
| lt / lte | Less than / or equal |
| like / ilike | Pattern match (case sensitive/insensitive) |
| in | In list of values |
| isNull | Is null check |
Example Request
cURL
curl -X POST http://localhost:3000/api/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGci..." \
-d '{
"query": "{ users { id name email } }"
}'