How amerdoahmed/threads works
This is a Next.js social-thread application: authenticated users complete onboarding, browse a paginated thread feed, create threads and replies, and explore profiles, creators, activity, and communities. Server actions own the data operations and persist users, threads, and communities through Mongoose. Profile editing also supports image upload. The sampled source shows the feed and action-to-model relationships; some route and integration details are represented only by the source index, so unsampled links are omitted where their caller is unclear.
Main entry points: user.actions.ts User operations · thread.actions.ts Thread operations · community.actions.ts Community operations · page.tsx Thread detail
Components 27
User experience
- Thread feed
app/(root)/page.tsx - Activity
app/(root)/activity/page.tsx - Communities
app/(root)/communities/page.tsx - Creator search
app/(root)/search/page.tsx - User profile
app/(root)/profile/[id]/page.tsx - Thread detail
app/(root)/thread/[id]/page.tsx - Thread card
components/cards/ThreadCard.tsx - Search input
components/shared/Searchbar.tsx - Pagination
components/shared/Pagination.tsx - Profile header
components/shared/ProfileHeader.tsx - Profile threads
components/shared/ThreadsTab.tsx
Profiles and authoring
- Onboarding
app/(auth)/onboarding/page.tsx - Profile editor
components/forms/AccountProfile.tsx - Thread composer page
app/(root)/create-thread/page.tsx - Thread composer
components/forms/PostThread.tsx - Reply form
components/forms/Comment.tsx
Domain operations
- User operations
lib/actions/user.actions.ts - Thread operations
lib/actions/thread.actions.ts - Community operations
lib/actions/community.actions.ts
Persistence and integrations
- User model
lib/models/user.model.ts - Thread model
lib/models/thread.model.ts - Community model
lib/models/community.model.ts - MongoDB connection
lib/mongoose.ts - Upload helper
lib/uploadthings.ts - Upload endpoint
app/api/uploadthing/core.ts - Clerk webhook
app/api/webhook/clerk/route.ts
Other components
- User
Connections 40
- User → Thread feed: opens feed
app/(root)/page.tsx - Thread feed → User operations: fetches user
app/(root)/page.tsx - Thread feed → Thread operations: fetches threads
app/(root)/page.tsx - Thread feed → Thread card: renders
app/(root)/page.tsx - User → Onboarding: sets up profile
app/(auth)/onboarding/page.tsx - Onboarding → Profile editor: renders
app/(auth)/onboarding/page.tsx - Profile editor → User operations: updates profile
components/forms/AccountProfile.tsx - Profile editor → Upload helper: uploads image
components/forms/AccountProfile.tsx - Upload helper → Upload endpoint: uses upload service
lib/uploadthings.ts - User → Thread composer page: starts thread
app/(root)/create-thread/page.tsx - Thread composer page → Thread composer: renders
app/(root)/create-thread/page.tsx - Thread composer → Thread operations: creates thread
components/forms/PostThread.tsx - Thread detail → Thread operations: loads thread
app/(root)/thread/[id]/page.tsx - Thread detail → User operations: loads user
app/(root)/thread/[id]/page.tsx - Thread detail → Thread card: renders thread
app/(root)/thread/[id]/page.tsx - Thread detail → Reply form: renders reply form
app/(root)/thread/[id]/page.tsx - Reply form → Thread operations: adds reply
components/forms/Comment.tsx - Activity → User operations: fetches activity
app/(root)/activity/page.tsx - Creator search → User operations: searches users
app/(root)/search/page.tsx - Creator search → Search input: renders
app/(root)/search/page.tsx - Creator search → Pagination: renders
app/(root)/search/page.tsx - User profile → User operations: loads profile
app/(root)/profile/[id]/page.tsx - User profile → Profile header: renders
app/(root)/profile/[id]/page.tsx - User profile → Profile threads: renders
app/(root)/profile/[id]/page.tsx - Profile threads → User operations: loads user threads
components/shared/ThreadsTab.tsx - Profile threads → Thread card: renders
components/shared/ThreadsTab.tsx - User operations → MongoDB connection: connects to
lib/actions/user.actions.ts - User operations → User model: queries
lib/actions/user.actions.ts - User operations → Community model: populates
lib/actions/user.actions.ts - User operations → Thread model: queries
lib/actions/user.actions.ts - Thread operations → MongoDB connection: connects to
lib/actions/thread.actions.ts - Thread operations → Thread model: queries
lib/actions/thread.actions.ts - Thread operations → User model: updates and populates
lib/actions/thread.actions.ts - Thread operations → Community model: queries and updates
lib/actions/thread.actions.ts - Community operations → MongoDB connection: connects to
lib/actions/community.actions.ts - Community operations → Community model: queries and updates
lib/actions/community.actions.ts - Community operations → Thread model: queries and deletes
lib/actions/community.actions.ts - Community operations → User model: queries and updates
lib/actions/community.actions.ts - Clerk webhook → Community operations: invokes
app/api/webhook/clerk/route.ts - Communities → Community operations: uses community data