How lbragg98/edhapp works
Command Tower is a Commander-focused Magic companion: users browse cards, manage a personal collection, build and review decks, and can scan cards into their library. The main flows pass through Next.js pages and API routes into domain services and persistence; deck services also provide validation, analytics, intelligence, playtesting, and upgrades. The tree documents additional tracker, pricing, printable playtest, and background-job capabilities. Some connections are based on README or source-index references; unsampled implementations are represented conservatively.
Main entry points: deck-service.ts Deck service · prisma-library-repository.ts Collection repository · page.tsx Deck workspace · prisma-deck-repository.ts Deck repository
Components 27
User experience
- Card browser
src/app/cards/page.tsx - Card search API
src/app/api/cards/route.ts - Collection workspace
src/app/(protected)/library/page.tsx - Collection API
src/app/api/library/route.ts - Deck workspace
src/app/(protected)/decks/page.tsx - Deck API
src/app/api/decks/route.ts - Scanner workspace
src/app/(protected)/scanner/page.tsx - Scan API
src/app/api/scanner/scan/route.ts - Scan confirmation
src/app/api/scanner/confirm/route.ts - Life tracker
src/app/tracker/page.tsx
Cards and collection
- Card catalog
src/modules/catalog/application/search-cards.ts - Scryfall catalog
src/modules/catalog/infrastructure/scryfall/scryfall-card-catalog-repository.ts - Collection services
src/modules/library/application/library-services.ts - Collection repository
src/modules/library/infrastructure/prisma-library-repository.ts
Deckbuilding
- Deck service
src/modules/deck/application/deck-service.ts - Deck analysis
src/modules/deck/domain/analyze-deck-composition.ts - Commander validation
src/modules/deck/domain/validate-commander-deck.ts - Deck repository
src/modules/deck/infrastructure/prisma-deck-repository.ts
Card scanning
- Scan pipeline
src/modules/scanner/application/scanner-pipeline-service.ts - OCR providers
src/modules/scanner/ocr/providers.ts - Candidate matching
src/modules/scanner/recognition/resolve-card-candidate.ts
Supporting capabilities
- Postgres
- Price snapshots
src/modules/pricing/infrastructure/prisma-price-snapshot.ts - Playtest PDF
src/modules/playtest-pdf/application/generate-deck-playtest-pdf.ts - Refresh job worker
src/server/jobs/infrastructure/run-job-worker.ts - Scryfall
Other components
- Player
Connections 27
- Player → Card browser: browses
- Card browser → Card search API: searches
- Card search API → Card catalog: queries
src/app/api/cards/route.ts - Card catalog → Scryfall catalog: uses
- Player → Collection workspace: manages collection
- Collection workspace → Collection API: updates
- Collection API → Collection services: calls
src/app/api/library/route.ts - Collection repository → Scryfall: fetches card data
src/modules/library/infrastructure/prisma-library-repository.ts - Collection repository → Postgres: reads and writes
src/modules/library/infrastructure/prisma-library-repository.ts - Player → Deck workspace: builds decks
- Deck workspace → Deck API: edits
- Deck API → Deck service: calls
src/app/api/decks/route.ts - Deck service → Deck repository: persists decks
src/modules/deck/application/deck-service.ts - Deck service → Deck analysis: analyzes composition
src/modules/deck/application/deck-service.ts - Deck service → Commander validation: validates
src/modules/deck/application/deck-service.ts - Deck repository → Postgres: reads and writes
src/modules/deck/infrastructure/prisma-deck-repository.ts - Player → Scanner workspace: scans cards
- Scanner workspace → Scan API: submits scan
- Scan API → Scan pipeline: runs scan
- Scan pipeline → OCR providers: recognizes text
- Scan pipeline → Candidate matching: resolves candidate
src/modules/scanner/application/scanner-pipeline-service.ts - Scan confirmation → Collection services: imports holding
src/app/api/scanner/confirm/route.ts - Player → Life tracker: tracks game
- Deck workspace → Playtest PDF: exports playtest
- Refresh job worker → Postgres: loads jobs
src/server/jobs/infrastructure/run-job-worker.ts - Collection repository → Price snapshots: parses prices
src/modules/library/infrastructure/prisma-library-repository.ts - Deck repository → Price snapshots: parses prices
src/modules/deck/infrastructure/prisma-deck-repository.ts