batjko/gql2sql
batjko/gql2sql has 32 GitHub stars and 5 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-13 23:07 UTC. Last push 2026-11-02.
Progression mesurée des étoiles
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
À propos
GraphQL to SQL service example
DonnéesREADME.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.
Explorer des projets similaires
Asabeneh/30-Days-Of-Python
Le défi de programmation 30 Days of Python est un guide pas à pas pour apprendre le langage de programmation Python en 30 jours. Ce défi peut prendre plus de 100 jours. Avancez à votre rythme. Ces vidéos peuvent aussi vous aider : https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,704 étoilesgrafana/grafana
Plateforme ouverte et composable d’observabilité et de visualisation de données. Visualise les métriques, les journaux et les traces issus de plusieurs sources, comme Prometheus, Loki, Elasticsearch, InfluxDB, Postgres et bien d’autres.
77,891 étoilesredis/redis
Pour les développeurs qui créent des applications en temps réel pilotées par les données, Redis est le cache, le serveur de structures de données et le moteur de requêtes documentaires et vectorielles préféré, le plus rapide et le plus riche en fonctionnalités.
77,491 étoilesapache/superset
Apache Superset est une plateforme de visualisation et d'exploration de données.
75,519 étoiles