How gianse/cifras-capela works
Minha Biblioteca de Cifras is an installable, offline-capable songbook for a music team. A user signs in, browses or searches the library, opens a song, and reads it with transposition, capo, and presentation controls; administrators can edit or import songs and save them to the shared library. Separate workflows manage playlists, sharing, and PDF export. The frontend service/repository layer selects the Worker API and local cache, while the Worker routes API requests to authentication, song, playlist, user, and YouTube handlers. Major capabilities are represented from the README; several page and handler internals were not sampled, so their detailed wiring is omitted.
Main entry points: index.ts API router · song-service.ts Song service · HomePage.tsx Library browsing · SongPage.tsx Song reader
Components 30
App and Access
- App routes
frontend/src/App.tsx - Session access
frontend/src/hooks/useAuth.ts - Offline PWA
frontend/src/main.tsx
Library and Songs
- Library browsing
frontend/src/pages/HomePage.tsx - Library state
frontend/src/hooks/useLibrary.ts - Song search
frontend/src/lib/search/search-engine.ts - Song reader
frontend/src/pages/SongPage.tsx - Load song
frontend/src/hooks/useSong.ts - ChordPro parser
frontend/src/lib/parser/index.ts - Reader controls
frontend/src/components/song/ReaderControls.tsx - Transpose chords
frontend/src/hooks/useTranspose.ts - Song service
frontend/src/services/song-service.ts - Worker repository
frontend/src/services/worker-repository.ts - Local song cache
frontend/src/services/worker-repository.ts
Editing and Import
- Song editor
frontend/src/pages/EditorPage.tsx - Song import
frontend/src/pages/ImportPage.tsx - Format importers
frontend/src/lib/import/index.ts - PDF export
frontend/src/lib/export/pdf.ts
Playlists
- Playlist pages
frontend/src/pages/PlaylistsPage.tsx - Setlist reader
frontend/src/pages/PlaylistPage.tsx - Playlist storage
frontend/src/lib/storage/playlists.ts
Worker Backend
- API router
worker/src/index.ts - Song API
worker/src/api/songs.ts - Playlist API
worker/src/api/playlists.ts - Authentication API
worker/src/api/auth.ts - User API
worker/src/api/users.ts - YouTube search API
worker/src/api/youtube.ts
Other components
- Music team
- Cloudflare D1
- YouTube Data API
Connections 34
- Music team → App routes: opens
- App routes → Session access: checks session
- App routes → Library browsing: routes to
- Library browsing → Library state: loads library
- Library state → Song service: requests index
- Library browsing → Song search: searches songs
- Library browsing → Song reader: opens song
- Song reader → Load song: loads content
- Load song → Song service: requests source
- Song service → Worker repository: delegates access
- Worker repository → API router: requests songs
- Worker repository → Local song cache: reads and writes
- Song service → ChordPro parser: parses source
- Song reader → Reader controls: shows controls
- Reader controls → Transpose chords: sets key
- Song editor → Song service: saves song
- Song import → Format importers: imports source
- Song import → Song editor: reviews import
- Song editor → PDF export: exports PDF
- Playlist pages → Playlist storage: manages playlists
- Setlist reader → Playlist storage: loads setlist
- Setlist reader → PDF export: exports setlist
- Setlist reader → Song reader: navigates songs
- API router → Authentication API: dispatches auth
- API router → Song API: dispatches songs
- API router → Playlist API: dispatches playlists
- API router → User API: dispatches users
- API router → YouTube search API: dispatches search
- Authentication API → Cloudflare D1: checks accounts
- Song API → Cloudflare D1: reads and writes
- Playlist API → Cloudflare D1: reads and writes
- User API → Cloudflare D1: manages accounts
- YouTube search API → YouTube Data API: searches videos
- Offline PWA → Music team: enables offline use