A Project for CSE327 - Software Engineering | North South University
DermaDoc is an AI-powered skin health assistant that helps users analyze skin conditions, get personalized recommendations, and chat with an AI dermatologist. The application uses deep learning models for skin lesion classification and Google Gemini AI for intelligent conversations about skin health.
- AI-Powered Skin Analysis: Upload skin images and get instant predictions for 7 different skin conditions
- Intelligent Chatbot: Chat with DermaDoc, a specialized AI assistant for dermatology questions
- Personalized Recommendations: Get tailored advice based on your skin analysis results
- User Dashboard: Track your skin check history and results
- Secure Authentication: JWT-based authentication with password hashing
- Real-time Processing: Background task processing for image classification
- Architecture
- Tech Stack
- Prerequisites
- Quick Start
- Demo
- Project Structure
- Development
- Deployment
- Contributing
- License
DermaDoc follows a full-stack architecture with clear separation between frontend and backend:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β React Frontendβ βββββββΆβ FastAPI Backendβ βββββββΆβ MongoDB β
β (Port 5173) β β (Port 8000) β β (Port 27017) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β Google Gemini β
β API β
βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β PyTorch Model β
β (EfficientNet) β
βββββββββββββββββββ
- Frontend: React SPA with Vite, Tailwind CSS, and shadcn/ui components
- Backend: FastAPI REST API with async MongoDB operations
- Database: MongoDB for user data and skin check results
- AI Services:
- Google Gemini 2.5 Flash Lite for chatbot
- PyTorch EfficientNet-B4 for skin lesion classification
- React 18 - UI library
- Vite - Build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - High-quality component library
- TanStack Query - Data fetching and state management
- React Router - Client-side routing
- Lucide React - Icon library
- Sonner - Toast notifications
- FastAPI - Modern Python web framework
- MongoDB - NoSQL database
- Motor - Async MongoDB driver
- PyTorch - Deep learning framework
- Google Generative AI - Gemini API integration
- JWT - Authentication tokens
- bcrypt - Password hashing
- uv - Fast Python package manager
Before you begin, ensure you have the following installed:
- Node.js 18+ and pnpm (or npm/yarn)
- Python 3.11+
- MongoDB 6.0+ (running locally or remote)
- uv package manager (for Python)
- Google Gemini API Key (for chatbot functionality)
git clone <repository-url>
cd DermaDoc# Navigate to backend directory
cd backend
# Install uv (if not already installed)
# Windows (PowerShell):
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
uv sync
# Create .env file
cp .env.example .env
# Edit .env with your configuration (see Backend README for details)
# Start MongoDB (if running locally)
# Windows: mongod
# macOS: brew services start mongodb-community
# Linux: sudo systemctl start mongod
# Run the backend server
uv run uvicorn main:app --reload --host 0.0.0.0 --port 8000The backend will be available at http://localhost:8000
# Navigate to frontend directory (from project root)
cd frontend
# Install dependencies
pnpm install
# Start the development server
pnpm devThe frontend will be available at http://localhost:5173
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
dermascan.demo.mp4
DermaDoc/
βββ frontend/ # React frontend application
β βββ src/
β β βββ components/ # React components
β β β βββ ui/ # shadcn/ui components
β β β βββ Chatbot.jsx # AI chatbot component
β β β βββ Header.jsx
β β β βββ ...
β β βββ pages/ # Page components
β β β βββ Home.jsx
β β β βββ Dashboard.jsx
β β β βββ SkinCheck.jsx
β β β βββ Results.jsx
β β β βββ ...
β β βββ contexts/ # React contexts
β β β βββ AuthContext.jsx
β β β βββ ChatbotContext.jsx
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utility functions
β β β βββ api.js # API client
β β β βββ utils.js
β β βββ main.jsx # Entry point
β βββ public/ # Static assets
β β βββ logo.png
β βββ package.json
β βββ vite.config.js
β
βββ backend/ # FastAPI backend application
β βββ app/
β β βββ core/ # Core configuration
β β β βββ config.py # Settings and environment variables
β β β βββ database.py # MongoDB connection
β β β βββ security.py # JWT and password hashing
β β β βββ storage.py # File storage utilities
β β βββ models/ # Pydantic models
β β β βββ user.py
β β β βββ chat.py
β β β βββ skin_check.py
β β βββ routers/ # API route handlers
β β β βββ auth.py # Authentication endpoints
β β β βββ chat.py # Chatbot endpoints (streaming)
β β β βββ chat_sync.py # Chatbot endpoints (sync)
β β β βββ skin_check.py # Skin check endpoints
β β βββ services/ # Business logic
β β βββ classifier.py # Skin lesion classification
β β βββ background_tasks.py # Async task processing
β βββ CNN models/ # Trained PyTorch models
β β βββ efficientnetb4_classifier.pth
β βββ storage/ # User-uploaded files
β β βββ user_images/
β β βββ skin_check_images/
β βββ main.py # FastAPI application entry point
β βββ pyproject.toml # Python dependencies
β βββ README.md # Backend-specific documentation
β
βββ README.md # This file
cd frontend
# Start development server with hot reload
pnpm dev
# Build for production
pnpm build
# Preview production build
pnpm preview
# Install new dependencies
pnpm add <package-name>
# Install dev dependencies
pnpm add -D <package-name>cd backend
# Run with auto-reload
uv run uvicorn main:app --reload
# Run with specific host and port
uv run uvicorn main:app --reload --host 0.0.0.0 --port 8000
# Add new dependencies
uv add <package-name>
# Add dev dependencies
uv add --dev <package-name>See backend/README.md for detailed environment variable configuration.
- Build the production bundle:
cd frontend
pnpm build- The
dist/folder contains the production-ready files - Deploy to your preferred hosting service (Vercel, Netlify, etc.)
- Ensure all environment variables are set in production
- Use a production ASGI server:
uv run uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4- Or use Gunicorn with Uvicorn workers:
uv run gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker- Set up MongoDB (local or cloud like MongoDB Atlas)
- Configure CORS origins for your frontend domain
- Backend README - Detailed backend documentation, API endpoints, and database schemas
- API Documentation - Interactive Swagger UI (when backend is running)
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Frontend: Follow React best practices, use ESLint/Prettier
- Backend: Follow PEP 8, use type hints, document functions
This project is part of CSE327 - Software Engineering course at North South University.
CSE327 Team 2
For detailed API documentation and backend setup instructions, see backend/README.md.
