This repository is a teaching showcase for a modern GraphQL-to-SQL stack using Apollo Server, Express, Prisma, TypeScript, SQLite, and a second upstream data source.
src/server.ts: process bootstrap, environment loading, shutdown wiringsrc/app.ts: Express and Apollo assemblysrc/config: environment parsing and loggingsrc/graphql: SDL files, typed context, and resolverssrc/services: domain services and upstream API clientsrc/data: Prisma client factory and repositoriesprisma: Prisma schema, migrations, and seed script
npm run dev: local development servernpm run build: Prisma generate, GraphQL codegen, and TypeScript buildnpm run typecheck: strict TypeScript verificationnpm run lint: Biome checksnpm run format: Biome formatternpm run test: Prisma generate, GraphQL codegen, and Vitest suitenpm run db:migrate: apply the committed migration setnpm run db:seed: seed the SQLite database
src/generated/prisma/**is generated bynpm run db:generateand should not be edited by hand.src/graphql/__generated__/resolvers-types.tsis generated bynpm run codegenand should not be edited by hand.- If a schema, context, or Prisma model changes, regenerate the relevant output and include the generated diff in the same change.
- For new Prisma schema changes, create a development migration with
npx prisma migrate dev --name <change>on Node 22, then commit the resulting migration files.
- Keep GraphQL SDL in
.graphqlfiles and keep resolver functions thin. - Put persistence details in repositories and business behavior in services.
- Prefer adding or updating tests alongside code changes.
- Do not couple tests to Apollo internals when the HTTP boundary can be exercised instead.
- Keep README examples aligned with the current schema and scripts.
- Build, typecheck, lint, and tests all pass.
- Prisma and GraphQL generated files are up to date.
- Environment variable changes are reflected in
.env.exampleand README. - Public GraphQL examples in README match the current schema.