batjko/gql2sql
batjko/gql2sql has 32 GitHub stars and 5 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-10 00:03 UTC. Last push 2026-11-02.
GraphQL to SQL service example
Measured star growth
- in 24h
- 0
- in 7 days
- Update delayed
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalGQL 2 SQL
gql2sql is a teaching-focused example of how to build a modern GraphQL API on top of SQL without stopping at the database. The app exposes books from SQLite through Prisma, combines that with poetry data from a public API, and keeps the codebase structured the way current TypeScript projects are usually built.
What this repo demonstrates
- Apollo Server 5 mounted on Express 5
- Prisma ORM 7 with SQLite and driver adapters
- strict TypeScript with generated GraphQL resolver types
- Biome for formatting and linting
- GraphQL SDL in
.graphqlfiles instead of inline strings - HTTP-level integration tests with Vitest and Supertest
- agent-friendly repository conventions via
AGENTS.md
Requirements
- Node 22 or newer
- npm 10 or newer
Architecture

The request flow is intentionally simple and explicit:
- Express receives HTTP requests and Apollo handles GraphQL execution at
/graphql. - SDL files in
src/graphql/schemadefine the public contract. - Typed resolvers translate GraphQL operations into service calls.
- Services coordinate domain rules and delegate persistence to repositories.
- Prisma talks to SQLite for books, while a dedicated poetry client fetches a second upstream data source.
This separation keeps the repo readable for learners and gives coding agents a clear place to make targeted changes.
Project layout
src/server.ts: startup, env loading, graceful shutdownsrc/app.ts: Express and Apollo compositionsrc/config: environment parsing and loggingsrc/graphql: SDL files, generated resolver types, and resolverssrc/services: domain services and the poetry API clientsrc/data: Prisma client factory and repositoriesprisma: schema, migrations, and seed script

Quickstart
Install dependencies:
npm installCopy the example environment file:
cp .env.example .envGenerate the Prisma client, apply the committed migration, and seed the database:
npm run db:generate npm run db:migrate npm run db:seedStart the development server:
npm run devOpen
http://localhost:3000/graphql.
Apollo Sandbox is enabled in development, so you can browse the schema and execute operations directly in the browser.
Example operations
Query all books:
query GetBooks {
books {
id
title
author
createdAt
}
}
Query one book by id:
query GetBook($id: ID!) {
book(id: $id) {
id
title
author
}
}
Create a book with a modern input object:
mutation AddBook($input: AddBookInput!) {
addBook(input: $input) {
id
title
author
}
}
Variables:
{
"input": {
"title": "Kindred",
"author": "Octavia E. Butler"
}
}
Query poems from the external provider:
query GetPoetry {
poem {
title
content
lineCount
poet {
name
}
}
poems {
title
poet {
name
}
}
}
Scripts
npm run dev: watch mode withtsxnpm run build: generate Prisma client, run GraphQL codegen, and compile TypeScriptnpm run typecheck: strict TypeScript verificationnpm run lint: Biome checksnpm run format: Biome formattingnpm run test: Vitest suitenpm run db:generate: Prisma client generationnpm run db:migrate: apply the committed migration setnpm run db:reset: reset the local databasenpm run db:seed: seed the databasenpm run db:studio: open Prisma Studio
QA workflow
Run the same checks expected in CI:
npm run lint
npm run typecheck
npm run test
For a clean local reset:
npm run db:reset
npm run db:seed
Notes for contributors and agents
- Keep schema changes in
.graphqlfiles and regenerate types withnpm run codegen. - Keep persistence logic out of resolvers.
- If the Prisma schema changes, rerun
npm run db:generateand update migrations. - To author a brand-new Prisma migration locally, use
npx prisma migrate dev --name <change>on Node 22 and commit the generated SQL. - See
AGENTS.mdfor repository-specific coding guidance.
Explore related projects
Asabeneh/30-Days-Of-Python
The 30 Days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than 100 days. Follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,486 starsgrafana/grafana
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
77,790 starsredis/redis
For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.
77,332 starsapache/superset
Apache Superset is a Data Visualization and Data Exploration Platform
75,455 stars