How raghavtandonn/margin works
MARGIN is a private-first reading log: readers build and curate a library, record reading and reviews, and explore it through visual shelves, seasons, and recommendations. The main request path enters Express, passes through authentication/security middleware, and reaches feature routes backed by SQLite. Browser imports preview and confirm books before adding them; the README also documents supplementary notes, dates, and quotes. The tree and excerpts establish the major subsystems, but do not expose all route-to-library calls, so uncertain internal links are omitted.
Main entry points: pages.js Page routes · index.js SQLite database · server.js Express server · auth.js Authentication routes
Components 23
Web entry
- Express server
server.js - Page routes
routes/pages.js - API routes
routes/api.js
Identity and privacy
- Authentication routes
routes/auth.js - Settings routes
routes/settings.js - Sessions and passkeys
lib/auth/sessions.js - WebAuthn
lib/auth/webauthn.js
Reading library
- Library and shelves
lib/library.js - Library import
lib/import.js - Import supplements
lib/supplement.js - Works and editions
lib/works.js - Reading records
lib/reviews.js - Private notes
lib/notes.js
Community
- Community routes
routes/community.js - Clubs routes
routes/clubs.js
Visuals and discovery
- Season catalogues
routes/seasons.js - Lookbook
routes/lookbook.js - Colour system
lib/colour.js - Recommendations
lib/reco.js - Embedding store
lib/embeddings.js
Other components
- Reader
- SQLite database
db/index.js - Open Library
Connections 27
- Reader → Express server: sends requests
- Express server → Page routes: dispatches pages
- Express server → API routes: dispatches API
- Express server → Authentication routes: dispatches auth
- Express server → Settings routes: dispatches settings
- Page routes → Library and shelves: reads shelves
- Page routes → Works and editions: loads works
- Page routes → Reading records: loads reviews
- Page routes → Private notes: reads notes
- Authentication routes → Sessions and passkeys: creates sessions
- WebAuthn → SQLite database: stores credentials
- Authentication routes → WebAuthn: verifies passkeys
- Settings routes → Library import: handles imports
- Library import → Works and editions: matches works
- Settings routes → Import supplements: previews supplements
- Community routes → Reading records: serves reviews
- Clubs routes → SQLite database: reads and writes
- Season catalogues → SQLite database: reads catalogues
- Lookbook → Colour system: uses colour
- Page routes → Recommendations: shows suggestions
- Recommendations → Embedding store: reads vectors
- Embedding store → SQLite database: stores vectors
- Works and editions → SQLite database: reads and writes
- Library and shelves → SQLite database: reads and writes
- Reading records → SQLite database: reads and writes
- Private notes → SQLite database: reads and writes
- Page routes → Open Library: looks up editions