How binary-shadowmonarch/bookapp works
Books is a web-based personal EPUB library. A reader uploads an EPUB; the frontend extracts metadata, sends the file to the protected Go API, and later loads the library and opens books in a browser reader. The backend also supports email-code registration, password and Google login, and token refresh. Reading progress and EPUB parsing are client-side; the README says progress is not persisted. The tree and excerpts establish the main wiring, but some handlers and frontend components were not sampled, so only documented links are shown.
Main entry points: handlers API handlers · service.go Auth and library service · +page.svelte Library page · main.go HTTP server
Components 24
Library UI
- Home and routes
frontend/src/routes/+page.svelte - Library page
frontend/src/routes/library/+page.svelte - EPUB upload
frontend/src/lib/EpubUpload.svelte - Parser pool
frontend/src/lib/epub-parser-pool.ts - EPUB worker
frontend/src/lib/epub-parser.worker.ts - Book cards
frontend/src/lib/BookCard.svelte - Book reader
frontend/src/lib/BookReader.svelte - Library search
frontend/src/lib/SearchBar.svelte
Accounts
- Signup request
frontend/src/routes/signup/+page.server.ts - Code verification
frontend/src/routes/signup/verify/+page.server.ts - Signup success
frontend/src/routes/signup/success/+page.server.ts - Login and OAuth UI
frontend/src/lib/Login.svelte
Backend API
- HTTP server
backend/cmd/server/main.go - API router
backend/internal/handlers/router.go - API handlers
backend/internal/handlers - Auth and library service
backend/internal/auth/service.go
Persistence and services
- PostgreSQL store
backend/internal/store/postgres.go - SeaweedFS filer
backend/internal/storage/seaweedfs_filer.go - Verification email
backend/internal/email/resend.go
Other components
- Library user
- PostgreSQL
- SeaweedFS
- Resend
- Google OAuth
Connections 31
- Library user → Home and routes: visits
- Library user → Signup request: registers
- Library user → Login and OAuth UI: signs in
- Home and routes → Library page: opens library
- Library page → EPUB upload: starts upload
- EPUB upload → Parser pool: extracts metadata
- Parser pool → EPUB worker: dispatches files
- EPUB upload → API handlers: uploads EPUB
- Library page → API handlers: fetches library
- Library page → Book cards: shows books
- Library page → Library search: filters books
- Book cards → Book reader: opens book
- Book reader → Library user: renders EPUB
- Signup request → API handlers: requests code
- Signup request → Code verification: redirects with email
- Code verification → API handlers: submits code
- Code verification → Signup success: redirects on success
- Login and OAuth UI → API handlers: submits credentials
- Login and OAuth UI → Google OAuth: starts OAuth
- HTTP server → PostgreSQL store: creates store
- HTTP server → Auth and library service: constructs service
- HTTP server → API router: starts with router
- API router → API handlers: dispatches requests
- API handlers → Auth and library service: calls operations
- Auth and library service → PostgreSQL store: reads and writes
- PostgreSQL store → PostgreSQL: queries
- Auth and library service → SeaweedFS filer: stores and retrieves files
- SeaweedFS filer → SeaweedFS: proxies file operations
- Auth and library service → Verification email: sends code
- Verification email → Resend: delivers email
- Auth and library service → Google OAuth: exchanges OAuth code