How piyush-eon/doctors-appointment-platform works
Project Type and Purpose
• This is a full-stack doctors-appointment platform built with Next.js (App Router), Tailwind CSS, Shadcn UI, Prisma ORM, and Neon (PostgreSQL). It includes server-side actions (the “actions” folder) for business logic (appointments, credits, payouts, onboarding, etc.) and integrates Vonage for video calls.
File Structure
• Top-level folders:
• app/ – Next.js App Router pages and layouts, divided into (auth) and (main) routes
• actions/ – Server actions handling CRUD and business operations
• components/ & components/ui/ – Reusable UI primitives (Shadcn UI wrappers)
• lib/ – Utilities, Prisma client setup (lib/prisma.js), schema, auth helpers
• prisma/ – Database schema and migration history
• hooks/ – Custom React hooks (e.g., use-fetch)
• public/ – Static assets
• Configs: next.config.mjs, postcss.config.mjs, eslint.config.mjs, jsconfig.json
• Middleware: middleware.js handles auth redirects or guarding routes.
README and Dependencies
• Confirms the stack: Next.js, Neon (Postgres), Tailwind, Shadcn UI, Vonage for video calls
Main Components
a. Client Browser
• Renders React components, calls server via Server Actions or fetch hooks
b. Next.js Server
• App Router (app/…) reacts to route requests, serves Server Components & SSR pages
• API Endpoints / Server Actions (actions/*.js) for login, signup, appointments, credits, payouts, doctor onboarding
• Middleware for auth gating
c. Database (Neon/PostgreSQL)
• Managed via Prisma ORM (prisma/schema.prisma & lib/prisma.js)
d. External Services
• Vonage Video API for telehealth sessions
• (Optional) Payment provider if used for credits/payouts
e. File-based UI Library
• Shadcn UI primitives under components/ui
Relationships and Interactions
• Browser → Next.js App Router
• Auth pages under /app/(auth)
• Main app under /app/(main) with sub-routes (admin, doctor, doctors, onboarding, pricing, video-call)
• Next.js Server → Database
• All actions/*.js modules import Prisma client to read/write appointments, users, credits, payouts
• Next.js Server → Vonage
• Video-call route invokes Vonage SDK via server action to generate tokens, sessions
• UI Components ← App Router
• Page.jsx files compose components from components/ and components/ui/
Important Architectural Patterns
• Next.js App Router with nested layouts (e.g., app/(main)/layout.jsx)
• Server Actions for form submissions and data mutations (instead of traditional REST)
• Prisma ORM for type-safe DB access
• Component-driven UI with Shadcn primitives
• Middleware for route protection