How geekyharsh05/redditz works
Project type and purpose
• This is a full‑stack social‑media web application (“Redditz”) built with Next.js App Router, React/TypeScript, Tailwind CSS, Prisma (PostgreSQL), Kinde Authentication, and UploadThing for file uploads.
• The front‑end provides pages for posts, communities (routes under /app/post and /app/r), user settings, and global UI components. The back‑end is implemented as Next.js server components, API routes, and server actions that talk to the database and third‑party services.
Main components
a. Client Browser (React/Next.js UI)
• Pages and client components (app/page.tsx, app/post/[id]/page.tsx, components/ui/*, custom components under app/components/)
• Theme and Auth providers (app/providers/theme-provider.tsx, app/providers/auth-provider.tsx)
b. Next.js Server Layer
• Server‑side rendering & API Routes (app/api/*, route.ts)
• Server Actions (app/actions/*.ts)
• Utilities (utils/*, lib/utils.ts)
c. Database
• Prisma Client calling PostgreSQL (lib/db.ts, prisma/schema.prisma)
d. External Services
• Authentication Service (Kinde Auth via app/api/auth/[kindeAuth]/route.ts)
• File Upload Service (UploadThing via app/api/uploadthing/*.ts)
e. Static Assets & CDN
• Public folder (public/), global CSS (app/globals.css, Tailwind config)
Relationships and data flow
• User → Browser UI → Next.js Router (App Router) → Server Components or API Routes
• Server Actions & API Routes → Prisma (lib/db.ts) → PostgreSQL
• File Upload Requests → UploadThing service → storage backend
• Auth flows → Kinde Auth endpoints → Next.js session state
• Theme toggles and user settings stored client‑side (Context) or persisted via server actions
Architectural patterns and design principles
• App Router: file‑based routing under app/ with server vs client components distinction
• Server Actions: colocated action files (app/actions) that run on the server and mutate data
• Atomic Design: reusable UI primitives in components/ui and project‑specific compositions in app/components
• Separation of Concerns: UI vs data access (lib/db.ts), business logic in actions vs presentation
• Third‑party integrations: externalize auth and file storage to managed services
Essential architectural elements
• Separate UI layer from business logic and data persistence
• How server actions replace traditional REST endpoints for mutations
• Integration points with Kinde Auth and UploadThing
• File‑based routing and component hierarchy of the Next.js App Router