Skip to content

Commit edf6a73

Browse files
author
Patrick
committed
2026-ify this whole thing
1 parent cd55d59 commit edf6a73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+9143
-3654
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DATABASE_URL="file:./prisma/dev.db"
2+
PORT=3000
3+
POETRY_API_BASE_URL="https://poetrydb.org"
4+
REQUEST_TIMEOUT_MS=5000
5+
NODE_ENV=development

.github/workflows/codeql-analysis.yml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,13 @@
99
# the `language` matrix defined below to confirm you have the correct set of
1010
# supported CodeQL languages.
1111
#
12-
name: "CodeQL"
12+
name: CodeQL
1313

1414
on:
1515
push:
16-
branches: [ master ]
16+
branches: [master]
1717
pull_request:
18-
# The branches below must be a subset of the branches above
19-
branches: [ master ]
20-
# schedule:
21-
# - cron: '39 6 * * 5'
18+
branches: [master]
2219

2320
jobs:
2421
analyze:
@@ -32,24 +29,28 @@ jobs:
3229
strategy:
3330
fail-fast: false
3431
matrix:
35-
language: [ 'javascript' ]
36-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37-
# Learn more:
38-
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
32+
language: ['javascript-typescript']
3933

4034
steps:
41-
- name: Checkout repository
42-
uses: actions/checkout@v4
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
4337

44-
# Initializes the CodeQL tools for scanning.
45-
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v3
47-
with:
48-
languages: ${{ matrix.language }}
38+
- name: Initialize CodeQL
39+
uses: github/codeql-action/init@v3
40+
with:
41+
languages: ${{ matrix.language }}
4942

50-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51-
- name: Autobuild
52-
uses: github/codeql-action/autobuild@v3
43+
- name: Use Node.js 22
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: 22.x
47+
cache: npm
5348

54-
- name: Perform CodeQL Analysis
55-
uses: github/codeql-action/analyze@v3
49+
- name: Install dependencies
50+
run: npm ci
51+
52+
- name: Build project
53+
run: npm run build
54+
55+
- name: Perform CodeQL Analysis
56+
uses: github/codeql-action/analyze@v3

.github/workflows/node.js.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
1+
name: CI
32

4-
name: Run tests
5-
6-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
77

88
jobs:
99
test:
@@ -12,15 +12,30 @@ jobs:
1212
strategy:
1313
matrix:
1414
node-version: [22.x]
15-
# Node 20+ required by Apollo Server 5 and Prisma 7
1615

1716
steps:
1817
- uses: actions/checkout@v4
18+
1919
- name: Use Node.js ${{ matrix.node-version }}
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version: ${{ matrix.node-version }}
23-
cache: 'npm'
24-
- run: npm ci
25-
- run: npx prisma generate
26-
- run: npm test
23+
cache: npm
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Generate Prisma client
29+
run: npm run db:generate
30+
31+
- name: Generate GraphQL types
32+
run: npm run codegen
33+
34+
- name: Lint
35+
run: npm run lint
36+
37+
- name: Typecheck
38+
run: npm run typecheck
39+
40+
- name: Test
41+
run: npm run test

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
node_modules
2+
dist
3+
coverage
4+
.env
5+
.DS_Store
6+
plans
7+
prisma/*.db
8+
prisma/*.db-journal
9+
src/generated/prisma

.prettierrc

Lines changed: 0 additions & 8 deletions
This file was deleted.

AGENTS.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# AGENTS.md
2+
3+
## Purpose
4+
5+
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.
6+
7+
## Repo Map
8+
9+
- `src/server.ts`: process bootstrap, environment loading, shutdown wiring
10+
- `src/app.ts`: Express and Apollo assembly
11+
- `src/config`: environment parsing and logging
12+
- `src/graphql`: SDL files, typed context, and resolvers
13+
- `src/services`: domain services and upstream API client
14+
- `src/data`: Prisma client factory and repositories
15+
- `prisma`: Prisma schema, migrations, and seed script
16+
17+
## Required Commands
18+
19+
- `npm run dev`: local development server
20+
- `npm run build`: Prisma generate, GraphQL codegen, and TypeScript build
21+
- `npm run typecheck`: strict TypeScript verification
22+
- `npm run lint`: Biome checks
23+
- `npm run format`: Biome formatter
24+
- `npm run test`: Prisma generate, GraphQL codegen, and Vitest suite
25+
- `npm run db:migrate`: apply the committed migration set
26+
- `npm run db:seed`: seed the SQLite database
27+
28+
## Generated Files Policy
29+
30+
- `src/generated/prisma/**` is generated by `npm run db:generate` and should not be edited by hand.
31+
- `src/graphql/__generated__/resolvers-types.ts` is generated by `npm run codegen` and should not be edited by hand.
32+
- If a schema, context, or Prisma model changes, regenerate the relevant output and include the generated diff in the same change.
33+
- 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.
34+
35+
## Workflow Guardrails
36+
37+
- Keep GraphQL SDL in `.graphql` files and keep resolver functions thin.
38+
- Put persistence details in repositories and business behavior in services.
39+
- Prefer adding or updating tests alongside code changes.
40+
- Do not couple tests to Apollo internals when the HTTP boundary can be exercised instead.
41+
- Keep README examples aligned with the current schema and scripts.
42+
43+
## Review Checklist
44+
45+
- Build, typecheck, lint, and tests all pass.
46+
- Prisma and GraphQL generated files are up to date.
47+
- Environment variable changes are reflected in `.env.example` and README.
48+
- Public GraphQL examples in README match the current schema.

0 commit comments

Comments
 (0)