How raedinkhaled/casbahconnect-next works
Casbah Connect is a Stack Overflow–style developer Q&A platform. Visitors browse and search questions, open a question, then sign in to ask or answer, vote, save, and build a profile; passwordless email and a read-only demo identity are alternate entry modes. Server actions enforce identity and write permissions before accessing MongoDB. The README documents broader search, tag, profile, reputation, and theme capabilities; several routes and action implementations were not sampled, so those links are documented rather than inferred from imports.
Main entry points: question.action.ts Question actions · user.action.ts User actions · auth.ts Authentication · auth-user.ts Session and user guard
Components 29
Browse and discovery
- Question feed
app/(root)/(home)/page.tsx - Question detail
app/(root)/question/[id]/page.tsx - Tag browsing
app/(root)/tags/page.tsx - Community
app/(root)/community/page.tsx - Global search
components/shared/search/GlobalSearch.tsx - Search endpoint
app/api/search/route.ts
Q&A participation
- Question form
components/forms/QuestionForm.tsx - Answer form
components/forms/AnswerForm.tsx - Voting controls
components/shared/Votes.tsx
Identity and profiles
- Authentication
lib/auth.ts - Sign-in form
components/auth/SignInForm.tsx - Session and user guard
lib/auth-user.ts - Profile pages
app/(root)/profile/[id]/page.tsx - Profile editing
components/forms/ProfileForm.tsx - Demo identity
lib/demo.ts
Application services
- Question actions
lib/actions/question.action.ts - Answer actions
lib/actions/answer.action.ts - Interaction actions
lib/actions/interaction.action.ts - User actions
lib/actions/user.action.ts - Tag actions
lib/actions/tag.actions.ts - Search actions
lib/actions/general.action.ts
Persistence
- Question records
database/question.model.ts - Answer records
database/answer.model.ts - User records
database/user.model.ts - Tag records
database/tag.model.ts - Interaction records
database/interaction.model.ts
Other components
- Visitor
- MongoDB
- Email delivery
Connections 45
- Visitor → Question feed: browses
README.md - Question feed → Question actions: loads feed
app/(root)/(home)/page.tsx - Question actions → Question records: queries
lib/actions/question.action.ts - Visitor → Question detail: opens question
README.md - Question detail → Question actions: loads question
app/(root)/question/[id]/page.tsx - Visitor → Tag browsing: browses tags
README.md - Tag browsing → Tag actions: loads tags
app/(root)/tags/page.tsx - Visitor → Community: browses members
README.md - Community → User actions: loads users
app/(root)/community/page.tsx - Visitor → Global search: searches
README.md - Global search → Search endpoint: requests results
app/api/search/route.ts - Search endpoint → Search actions: dispatches search
app/api/search/route.ts - Visitor → Sign-in form: starts sign-in
README.md - Sign-in form → Authentication: authenticates
lib/auth.ts - Authentication → Email delivery: sends magic link
README.md - Authentication → User records: adapter account
lib/auth.ts - Authentication → Demo identity: issues demo identity
lib/auth.ts - Authentication → MongoDB: uses adapter
lib/auth.ts - Question detail → Answer form: renders form
app/(root)/question/[id]/page.tsx - Question form → Question actions: creates question
components/forms/QuestionForm.tsx - Question detail → Voting controls: renders controls
app/(root)/question/[id]/page.tsx - Voting controls → Question actions: votes question
components/shared/Votes.tsx - Voting controls → Answer actions: votes answer
components/shared/Votes.tsx - Voting controls → Interaction actions: records interaction
components/shared/Votes.tsx - Answer form → Answer actions: submits answer
- Question actions → Session and user guard: checks writer
lib/actions/question.action.ts - User actions → Session and user guard: checks writer
lib/actions/user.action.ts - Question actions → Question records: creates and reads
lib/actions/question.action.ts - Question actions → Answer records: uses answers
lib/actions/question.action.ts - Question actions → Interaction records: reads interactions
lib/actions/question.action.ts - Question actions → User records: updates reputation
lib/actions/question.action.ts - Question actions → Tag records: populates tags
lib/actions/question.action.ts - User actions → User records: queries profiles
lib/actions/user.action.ts - User actions → Question records: queries activity
lib/actions/user.action.ts - User actions → Answer records: queries activity
lib/actions/user.action.ts - Profile pages → User actions: loads profile
app/(root)/profile/[id]/page.tsx - Profile editing → User actions: updates profile
- User actions → Session and user guard: resolves identity
lib/actions/user.action.ts - Session and user guard → Authentication: reads session
lib/auth-user.ts - Session and user guard → User records: resolves account
lib/auth-user.ts - Session and user guard → MongoDB: connects for lookup
lib/auth-user.ts - Visitor → Question form: asks question
README.md - Visitor → Answer form: posts answer
README.md - Visitor → Voting controls: votes content
README.md - Visitor → Profile pages: views profiles
README.md