How poppa/mtrek works
MTrek is a collaborative music-exploration app: users create or join a Trek, explore its year-based or curated-album rounds, select and rate albums, and view rankings and round history. Server route handlers enforce the user workflow and delegate Trek operations to the domain service, which uses PostgreSQL; album search is a separate Spotify integration. The README documents both Trek types and their progression rules. Some subsystem wiring is represented only where supported by the sampled routes or README.
Main entry points: trek-service.ts Trek service · session.ts Session helpers · routes/+page.server.ts Trek home · [trekId]/+page.server.ts Trek workspace
Components 20
Web workflows
- Trek home
src/routes/+page.server.ts - Trek workspace
src/routes/treks/[trekId]/+page.server.ts - Invite and join
src/routes/join/[inviteCode]/+page.server.ts - Round history
src/routes/treks/[trekId]/rounds/[roundId]/+page.server.ts - Year exploration
src/routes/treks/[trekId]/years/[year]/+page.server.ts - Trek rankings
src/routes/treks/[trekId]/album-ranking/+page.server.ts - Year rankings
src/routes/treks/[trekId]/year-ranking/+page.server.ts - User profile
src/routes/user/[userId]/+page.server.ts - User rankings
src/routes/user/[userId]/album-ranking/+page.server.ts
Trek domain
- Trek service
src/lib/server/trek-service.ts - Ranking logic
src/lib/ranking.ts
Identity and search
- Authentication
src/auth.ts - Session helpers
src/lib/server/session.ts - Album search route
src/routes/api/spotify/search/+server.ts - Spotify client
src/lib/server/spotify.ts
Persistence
- PostgreSQL
src/lib/server/db/index.ts - Database schema
src/lib/server/db/schema.ts
Other components
- Participant
- OAuth providers
- Spotify Web API
Connections 25
- Participant → Trek home: uses
- Participant → Trek workspace: manages rounds
- Participant → Invite and join: joins Trek
- Participant → Trek rankings: views
- Participant → User profile: views
- Trek home → Session helpers: requires identity
- Trek home → Trek service: creates and lists
- Trek workspace → Session helpers: checks access
- Trek workspace → Trek service: loads and updates
- Invite and join → Trek service: looks up and joins
- Year exploration → Trek service: loads year
- Round history → Trek service: loads round
- Trek rankings → Trek service: loads albums
- Year rankings → Trek service: loads years
- User profile → Trek service: loads profile data
- User rankings → Trek service: loads user rankings
- Trek service → PostgreSQL: reads and writes
- PostgreSQL → Database schema: implements
- Trek rankings → Ranking logic: uses ranking
- Year rankings → Ranking logic: uses ranking
- Authentication → OAuth providers: authenticates with
- Session helpers → Authentication: reads session
- Album search route → Spotify client: searches albums
- Album search route → Session helpers: checks identity
- Spotify client → Spotify Web API: queries