feat: #1 scaffold Crate — monorepo, GraphQL API, Postgres, React client, tests, docs #31
+10,955
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Brings up the whole Crate stack so the group can split the remaining work across M2–M4 without stepping on each other.
Community album catalog: search albums/artists, filter by genre and decade, sort the whole result set (including by community rating), page through large results, open an album, and persist ratings, reviews and a personal wantlist ("crate").
Why these choices
Written up properly in
docs/architecture.md(10 ADRs). The short version:tsvector+ GIN) and realORDER BY/WHEREcover both. A BaaS also violates "egendefinert GraphQL backend" and "database set up directly on the VM"OFFSETalbum → artist/tracks/genres/reviewsis a constant number of querieslocalStorage)Layout
Testing
24 Vitest tests green (
server11,client13): SQL builders (including a regression test for a parameter-binding bug), cursor round-trip,useDebounce, simulated-user identity, and component/interaction/a11y assertions (labels,aria-pressed, radio-group star rating, Enter + button submit).Playwright E2E + axe-core scaffolded in
e2e/covering the full journey.Live smoke suite run against the VM (documented in
docs/AI-USAGE.md) - this caught three real bugs the unit tests missed, because unit tests only inspect SQL fragments and never execute them against Postgres:GenreFacet.genreserialised asgenreId/genreNamewhile the SDL declaresgenre: Genre!= ANY(${jsArray}::int[])- drizzle expands a JS array into N scalar parameters, so the cast received a bare integer and the query abortedalbum(id:)selected no review aggregate, soreviewCount: Int!resolved tonullAll three fixed and covered.
Verified live on
it2810-19.idi.ntnu.noGET /project2/POST /graphql(Apache proxy →:3001)ABBEY→ Abbey Road)hasNextPage, stable cursorsRATING_DESCoverAVG(review.rating)in SQLupsertReview/toggleCrateround-trip (persistence)album → artist/tracks/genres/reviewsin one requestInfrastructure
apt, no Docker), rolet19, databasecrate, localhost onlycrate-apion port 3001ProxyPass /graphql→127.0.0.1:3001docs/VM-setup.md/var/www/html/project2+systemctl restart crate-api+ smoke checkAlso in this PR
AGENTS.mdso agents and new members know the architecture rulesdocs/AI-USAGE.md- AI usage log as the course requiresCloses
Closes #1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11, #12, #13, #14, #15, #16, #19, #27.
Partially addresses #17 (a11y), #18 (bærekraft), #20 (Playwright) - the code is in but the manual pass / live run / measured numbers are still open.
Follow-ups (already in the milestones)
#21 integration tests that execute SQL · #22 EXPLAIN ANALYZE at 100k+ · #23 GraphQL codegen · #24 cover images · #25 search history · #26 country facet · #28 README polish · #29 UI sketch · #30 manual a11y/usability check
How to review
Or just open the live prototype: http://it2810-19.idi.ntnu.no/project2
Worth a close look:
server/src/search/search.ts(WHERE / ORDER BY / cursor builders) andserver/src/loaders/index.ts(N+1 defence) - those are where the graded requirements live.AI-assisted: see
docs/AI-USAGE.md. Every change here is going through peer review perCODEOWNERS.