An advanced healthcare platform featuring AI-powered voice assistance and seamless appointment booking.
Features • Tech Stack • Architecture • Getting Started • API Documentation • Testing • Deployment • Security • Contributing • License
- Voice-enabled AI doctor assistant powered by Vapi.ai
- Natural language processing for medical inquiries
- 24/7 availability for patient support
- Multi-step appointment booking process
- Doctor selection with detailed profiles
- Real-time availability checking
- Automated email confirmations via Resend
- Admin panel for doctor management
- Doctor profiles with specialties and availability
- Appointment statistics and analytics
- Clerk-based authentication system
- Role-based access control (patient/admin)
- Subscription plan management
- Responsive design with Tailwind CSS
- Interactive components with Shadcn UI
- Smooth animations and transitions
- Next.js 16 - React framework with App Router
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Shadcn UI - Reusable component library
- React Hook Form - Form validation
- Zod - Schema validation
- PostgreSQL - Primary database
- Prisma - Database ORM
- Next.js API Routes - Server-side logic
- Clerk - Authentication and user management
- Role-based access control
- Resend - Email delivery service
- React Email - Email templating
- Vapi.ai - Voice AI platform
- Voice-enabled healthcare assistant
- TanStack Query - Server state management
- Caching and background data synchronization
graph TB
subgraph "Client Layer"
A[Web Browser] --> B[Next.js Frontend]
B --> C[React Components]
B --> D[Shadcn UI Components]
end
subgraph "Authentication Layer"
E[Clerk Authentication]
F[User Management]
G[Role-based Access Control]
end
subgraph "Application Layer"
H[Next.js API Routes]
I[Server Actions]
J[Middleware]
end
subgraph "Business Logic Layer"
K[Appointment Management]
L[Doctor Management]
M[User Synchronization]
N[Email Services]
end
subgraph "External Services"
O[Vapi.ai Voice AI]
P[Resend Email Service]
Q[Unsplash Images]
end
subgraph "Data Layer"
R[PostgreSQL Database]
S[Prisma ORM]
end
B --> E
E --> F
F --> G
B --> H
H --> I
I --> J
I --> K
I --> L
I --> M
I --> N
K --> O
N --> P
B --> Q
K --> S
L --> S
M --> S
S --> R
style A fill:#e1f5fe
style R fill:#f3e5f5
style O fill:#fff3e0
style P fill:#fff3e0
sequenceDiagram
participant U as User
participant F as Frontend
participant A as Auth (Clerk)
participant API as API Routes
participant DB as Database
participant AI as Vapi.ai
participant Email as Resend
U->>F: Access Application
F->>A: Authenticate User
A->>F: Return User Info
F->>API: Request Data
API->>DB: Query/Update
DB->>API: Return Data
API->>F: Send Response
F->>U: Display Results
Note over U,Email: Appointment Booking Flow
U->>F: Book Appointment
F->>API: Create Appointment
API->>DB: Save Appointment
API->>Email: Send Confirmation
Email->>U: Email Notification
Note over U,AI: Voice Assistant Flow
U->>F: Initiate Voice Chat
F->>AI: Connect to Vapi.ai
AI->>U: Voice Interaction
AI->>F: Return Response
F->>U: Display AI Response
docterlogy/
├── app/ # Next.js app router pages
│ ├── admin/ # Admin dashboard
│ ├── api/ # API routes
│ ├── appointments/ # Appointment booking flow
│ ├── dashboard/ # Patient dashboard
│ ├── pro/ # Pro plan features
│ ├── voice/ # Voice AI features
│ └── ...
├── components/ # React components
│ ├── admin/ # Admin components
│ ├── appointments/ # Appointment components
│ ├── dashboard/ # Dashboard components
│ ├── emails/ # Email templates
│ ├── landing/ # Landing page components
│ ├── ui/ # UI components
│ └── ...
├── hooks/ # Custom React hooks
├── lib/ # Business logic and utilities
│ ├── actions/ # Server actions
│ └── ...
├── prisma/ # Prisma schema and migrations
└── public/ # Static assets
The application uses PostgreSQL with the following key entities:
- User: Patient information with Clerk integration
- Doctor: Healthcare provider profiles
- Appointment: Booking details with status tracking
- Users sign up/in via Clerk
- User data synchronized with internal database
- Role-based access control determines available features
- Subscription plans unlock premium features (Voice AI)
- Doctor Selection - Browse and select healthcare providers
- Time Slot Selection - Choose available dates and times
- Confirmation - Review and confirm appointment details
- Email Notification - Automatic confirmation sent via Resend
- Node.js 18+
- PostgreSQL database
- Clerk account
- Resend account
- Vapi.ai account
Create a .env file in the root directory:
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
# Database
DATABASE_URL=your_postgresql_connection_string
# Vapi.ai Voice Assistant
NEXT_PUBLIC_VAPI_ASSISTANT_ID=your_vapi_assistant_id
NEXT_PUBLIC_VAPI_API_KEY=your_vapi_api_key
# Admin Access
ADMIN_EMAIL=your_admin_email
# Email Service
RESEND_API_KEY=your_resend_api_key
# Application
NEXT_PUBLIC_APP_URL=http://localhost:3000- Clone the repository:
git clone https://github.com/your-username/docterlogy.git
cd docterlogy- Install dependencies:
pnpm install- Set up the database:
pnpm prisma generate
pnpm prisma migrate dev- Start the development server:
pnpm dev- Open http://localhost:3000 in your browser.
pnpm dev- Start development serverpnpm build- Build for productionpnpm start- Start production serverpnpm lint- Check code with Biomepnpm format- Format code with Biome
- Push code to GitHub
- Connect repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy!
# Build the image
docker build -t docterlogy .
# Run the container
docker run -p 3000:3000 docterlogy- Ensure DATABASE_URL points to production database
- Update NEXT_PUBLIC_APP_URL to your domain
- Configure webhook URLs in Clerk dashboard
We welcome contributions to Docterlogy! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow the existing code style
- Use Biome for formatting (
pnpm format) - Write descriptive commit messages
- Include tests for new functionality
- Use the GitHub issue tracker
- Provide detailed reproduction steps
- Include screenshots when applicable
This project is licensed under the MIT License - see the LICENSE file for details.
For support, email support@docterlogy.com or join our Discord community.
Built with ❤️ for better healthcare accessibility
