A full-stack healthcare application featuring Auth0 authentication, MongoDB database, and an interactive 3D body map chatbot interface.
- Auth0 Authentication: Secure user login and registration
- Profile Management: Complete user profiles with health information
- 3D Interactive Body Map: Click body parts to indicate pain levels
- AI Health Chatbot: Real-time health assistance and guidance
- Responsive Design: Works on desktop and mobile devices
Dialogue-Med/
βββ backend/ # Node.js/Express API
β βββ models/ # MongoDB schemas (User)
β βββ routes/ # API routes (userRoutes)
β βββ db.js # MongoDB connection
β βββ index.js # Server entry point
β βββ .env # Environment variables (not in git)
β
βββ frontend/
βββ dialogue_med_app/ # Next.js 16 frontend
βββ app/
β βββ components/
β β βββ ChatbotInterface.tsx # 3D chatbot UI
β β βββ SignupForm.tsx # Profile completion form
β βββ api/auth/[auth0]/ # Auth0 route handler
β βββ profile/complete/ # Profile completion page
β βββ layout.tsx # Root layout with UserProvider
β βββ page.tsx # Main entry (login/chatbot)
βββ lib/
β βββ api.ts # Backend API helpers
β βββ auth0.ts # Auth0 client config
βββ .env.local # Environment variables (not in git)
- Runtime: Node.js with ES Modules
- Framework: Express.js 5.2.1
- Database: MongoDB Atlas with Mongoose 9.1.5
- Authentication: Auth0 (header-based)
- CORS: Custom middleware for frontend-backend communication
- Framework: Next.js 16.1.4 (App Router)
- React: 19.2.3
- TypeScript: 5
- Auth: @auth0/nextjs-auth0 v4.14.0
- 3D Graphics: @react-three/fiber, @react-three/drei, three.js
- Styling: Tailwind CSS 4
- Node.js 18+
- npm or yarn
- MongoDB Atlas account
- Auth0 account
git clone <your-repo-url>
cd Dialogue-Medcd backend
npm installCreate .env file in the backend directory:
MONGO_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/?appName=Dialogue-Med
PORT=3001
NODE_ENV=development
FRONTEND_ORIGIN=http://localhost:3000cd frontend/dialogue_med_app
npm installCreate .env.local file in the frontend/dialogue_med_app directory:
AUTH0_DOMAIN=your-domain.auth0.com
AUTH0_CLIENT_ID=your-client-id
AUTH0_CLIENT_SECRET=your-client-secret
AUTH0_SECRET=your-32-char-secret-key
AUTH0_BASE_URL=http://localhost:3000
NEXT_PUBLIC_API_URL=http://localhost:3001/api- Create an Auth0 application (Regular Web Application)
- Set Allowed Callback URLs:
http://localhost:3000/api/auth/callback - Set Allowed Logout URLs:
http://localhost:3000 - Copy your Domain, Client ID, and Client Secret to
.env.local - Generate AUTH0_SECRET:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
cd backend
npm start
# Server runs on http://localhost:3001You should see:
π Server running on port 3001
β
MongoDB connected successfully
cd frontend/dialogue_med_app
npm run dev
# App runs on http://localhost:3000Visit http://localhost:3000 in your browser.
- Landing Page: User sees login screen with app features
- Auth0 Login: Click "Sign In to Continue" β Auth0 login
- Profile Check: System checks if profile is complete
- Profile Completion (new users): Fill in required fields:
- Full Name
- Phone Number
- Date of Birth
- Address
- Emergency Contact
- Chatbot Interface: Access 3D body map and health chat
| Method | Endpoint | Headers | Description |
|---|---|---|---|
| GET | /api/me |
x-auth0-id, x-user-email |
Get/create user profile |
| POST | /api/me |
x-auth0-id, x-user-email |
Update user profile |
| GET | /api/user/:auth0Id |
None | Get user by Auth0 ID |
Get User Profile
curl -H "x-auth0-id: auth0|123456" \
-H "x-user-email: user@example.com" \
http://localhost:3001/api/meUpdate Profile
curl -X POST \
-H "Content-Type: application/json" \
-H "x-auth0-id: auth0|123456" \
-H "x-user-email: user@example.com" \
-d '{
"name": "John Doe",
"phoneNumber": "(555) 123-4567",
"dateOfBirth": "1990-01-15",
"address": "123 Main St, City, State 12345",
"emergencyContact": "Jane Doe - (555) 987-6543"
}' \
http://localhost:3001/api/me{
auth0Id: String (unique, required),
email: String,
name: String,
phoneNumber: String,
dateOfBirth: String,
address: String,
emergencyContact: String,
profileComplete: Boolean (default: false),
createdAt: Date (default: Date.now),
location: String,
healthProfile: Object
}- 3D body model using Three.js Xbot model
- Interactive body part selection
- Pain intensity sliders (0-10 scale)
- Real-time chat interface
- Dark/Light mode toggle
- Profile completion form
- Form validation
- API integration
- Success/error handling
- Auto-redirect to chatbot
- Auth0 Authentication: Industry-standard OAuth 2.0
- CORS Protection: Configurable allowed origins
- Environment Variables: Sensitive data in .env files
- MongoDB Encryption: Atlas provides encryption at rest
- Custom Headers: x-auth0-id for API authentication
# Check MongoDB connection string
# Verify .env file exists with MONGO_URI
# Ensure port 3001 is not in use
lsof -ti:3001 | xargs kill -9# Verify all AUTH0_* variables in .env.local
# Check Auth0 dashboard callback URLs
# Regenerate AUTH0_SECRET if needed# Verify FRONTEND_ORIGIN in backend/.env
# Check NEXT_PUBLIC_API_URL in frontend/.env.local
# Ensure both servers are running- ES Modules: Backend uses
"type": "module"in package.json - Turbopack: Frontend uses Next.js 16 with Turbopack for faster builds
- 3D Model: Uses free Xbot.glb from threejs.org examples
- API Base URL: Configurable via NEXT_PUBLIC_API_URL
- Set environment variables in platform dashboard
- Update FRONTEND_ORIGIN to production URL
- Deploy from main branch
- Set all AUTH0_* environment variables
- Set NEXT_PUBLIC_API_URL to backend URL
- Update Auth0 callback URLs to production domain
- Deploy from main branch
This project is private and proprietary.
- Bill Nguyen - Full Stack Developer
For issues or questions, please open a GitHub issue or contact the development team.
Built with β€οΈ using Next.js, Express, and MongoDB