How sithilsemitha/deathbed-backend works
DeathBed is a backend for reflecting on decisions to help prevent regret. Users authenticate, classify and save decisions, track regret, find similar stories, compare outcomes, and keep journal entries that can be exported as PDFs. The routes own these operations and access Supabase; authentication validates bearer tokens through the admin client. Classification calls an external ML service, while story search and seeding use Gemini embeddings and Chroma. README content was empty, so capabilities and relationships here are based on the sampled route source; the SQLite file’s role is not established.
Main entry points: app.js Express server · users.js Account and profile · supabaseAdmin.js Supabase admin client · decisions.js Decision workflows
Components 15
API entry
- Express server
app.js - Status endpoint
routes/index.js
Identity
- Account and profile
routes/users.js - Bearer auth
middleware/auth.js
Decision reflection
- Decision workflows
routes/decisions.js - Matches and comparison
routes/users.js
Journaling
- Journal entries and PDF
routes/journals.js
Story similarity
- Similar stories
routes/search.js
Data and services
- Supabase admin client
config/supabaseAdmin.js - Supabase auth client
config/supabaseAuth.js - Supabase
- ML classifier
- Gemini embeddings
- Chroma stories
Other components
- API client
Connections 25
- API client → Express server: sends requests
app.js - Express server → Status endpoint: mounts route
app.js - Express server → Account and profile: mounts route
app.js - Express server → Decision workflows: mounts route
app.js - Express server → Journal entries and PDF: mounts route
app.js - Express server → Similar stories: mounts route
app.js - API client → Account and profile: uses account APIs
- API client → Decision workflows: uses decision APIs
- API client → Journal entries and PDF: uses journal APIs
- API client → Similar stories: uses search APIs
- Account and profile → Supabase auth client: signs up and in
routes/users.js - Account and profile → Supabase admin client: reads and updates
routes/users.js - Decision workflows → Bearer auth: requires auth
routes/decisions.js - Journal entries and PDF → Bearer auth: requires auth
routes/journals.js - Similar stories → Bearer auth: requires auth
routes/search.js - Account and profile → Bearer auth: requires auth
routes/users.js - Bearer auth → Supabase admin client: validates token
middleware/auth.js - Supabase admin client → Supabase: connects
- Supabase auth client → Supabase: connects
- Decision workflows → Supabase admin client: stores and queries
routes/decisions.js - Account and profile → Supabase admin client: queries decision data
routes/users.js - Journal entries and PDF → Supabase admin client: stores and reads
routes/journals.js - Decision workflows → ML classifier: classifies text
routes/decisions.js - Similar stories → Gemini embeddings: embeds text
routes/search.js - Similar stories → Chroma stories: queries and seeds
routes/search.js