A full-stack chat application that leverages AI (Google Gemini) to provide intelligent conversations with document analysis capabilities. Built with modern web technologies for scalability and performance.
- Project Links
- Project Structure
- Tech Stack
- Features
- Setup Instructions
- Environment Variables
- Deployment Notes
- Trade-offs & Known Limitations
| Resource | URL |
|---|---|
| GitHub Repository | https://github.com/javeed141/Document |
| Live Frontend (Vercel) | https://document-mi49.onrender.com |
| Live Backend API (Render) | https://document-gold.vercel.app/ |
DOCUMENTAI/
βββ backend/
β βββ index.js # Main server file
β βββ package.json # Backend dependencies
β βββ .env # Environment variables (not in Git)
β βββ .env.example # Example environment file
β βββ readme.md # Backend-specific documentation
β β
β βββ middleware/
β β βββ authMiddleware.js # JWT authentication middleware
β β
β βββ models/
β β βββ Chat.js # Chat schema & model
β β βββ Message.js # Message schema & model
β β βββ Users.js # User schema & model
β β
β βββ routes/
β β βββ auth.js # Authentication endpoints
β β βββ chats.js # Chat & message endpoints
β β
β βββ services/
β βββ ai_service.js # Google Gemini AI integration
β
βββ fronted/
β βββ index.html # HTML entry point
β βββ package.json # Frontend dependencies
β βββ vite.config.ts # Vite configuration
β βββ tsconfig.json # TypeScript configuration
β βββ eslint.config.js # ESLint configuration
β βββ vercel.json # Vercel deployment config
β βββ components.json # UI components config
β βββ .env.example # Example environment file
β βββ .env.local # Local environment variables (not in Git)
β β
β βββ public/ # Static assets
β β
β βββ src/
β βββ main.tsx # React entry point
β βββ App.tsx # Main App component
β βββ App.css # Global styles
β βββ index.css # Base styles
β β
β βββ api/
β β βββ api.tsx # Axios instance & API config
β β
β βββ assets/ # Images, fonts, media
β β
β βββ components/
β β βββ ChatSidebar.tsx # Chat list sidebar
β β βββ ChatSidebar.css # Sidebar styles
β β βββ EmptyState.tsx # Empty state component
β β βββ LoadingState.tsx # Loading skeleton
β β βββ MessageBubble.tsx # Individual message bubble
β β βββ MessageInput.tsx # Message input box
β β βββ MessageList.tsx # Message list container
β β β
β β βββ auth/
β β β βββ Home.tsx # Landing/home page
β β β βββ login.tsx # Login page
β β β βββ register.tsx # Registration page
β β β
β β βββ roles/ # Role-based components (future)
β β β
β β βββ ui/ # Reusable UI components
β β βββ avatar.tsx
β β βββ button.tsx
β β βββ card.tsx
β β βββ dialog.tsx
β β βββ dropdown-menu.tsx
β β βββ input.tsx
β β βββ label.tsx
β β βββ skeleton.tsx
β β βββ sonner.tsx
β β βββ spinner.tsx
β β βββ textarea.tsx
β β
β βββ context/
β β βββ ThemeContext.tsx # Dark/light theme context
β β
β βββ lib/
β β βββ utils.ts # Utility functions
β β
β βββ pages/
β βββ ChatPage.tsx # Main chat page
β βββ NotFound.tsx # 404 page
β
βββ .git/ # Git repository
βββ .gitignore # Git ignore rules
βββ README.md # This file
βββ REQUIREMENTS_ASSESSMENT.md # Requirements check document
| Directory | Purpose |
|---|---|
backend/ |
Express.js REST API with MongoDB integration |
fronted/ |
React + TypeScript frontend application |
backend/models/ |
Mongoose schemas for database entities |
backend/routes/ |
API route handlers |
backend/services/ |
Business logic (AI integration) |
fronted/src/components/ |
Reusable React components |
fronted/src/pages/ |
Page-level components |
fronted/src/context/ |
React Context for state management |
- React 19.2 - UI library for building interactive interfaces
- TypeScript 5.9 - Type-safe JavaScript for better development experience
- Vite 7.2 - Next-generation frontend build tool (fast dev server & optimized builds)
- React Router v7 - Client-side routing
- Tailwind CSS 4.1 - Utility-first CSS framework
- Radix UI - Headless UI components
- Lucide React - Icon library
- Axios - HTTP client for API communication
- Sonner - Toast notifications
- Next Themes - Dark mode support
- Node.js with Express 5.2 - REST API framework
- MongoDB 9.1 - Document database with Mongoose ORM
- Google Generative AI (Gemini 2.5 Flash) - AI model for generating responses
- JWT (jsonwebtoken 9.0) - Authentication & authorization
- Bcrypt 6.0 - Password hashing
- CORS - Cross-origin resource sharing for frontend communication
- dotenv - Environment variable management
- Vercel - Frontend hosting & deployment
- Render - Backend API hosting
- MongoDB Atlas - Cloud database hosting
- User Authentication - Secure login/register with JWT and password hashing
- Real-time Chat - Send and receive messages with AI assistance
- AI-Powered Responses - Google Gemini integration for intelligent conversations
- User Management - MongoDB-based user profiles and session management
- Dark Mode Support - Theme switching capability
- Responsive Design - Mobile-friendly UI with Tailwind CSS
- Error Handling - Comprehensive error management with toast notifications
- Node.js (v16 or higher)
- npm or yarn package manager
- MongoDB Atlas account (for cloud database) or local MongoDB instance
- Google Generative AI API key (from Google AI Studio)
- Git
git clone [YOUR_GITHUB_REPOSITORY_URL]
cd DOCUMENTAI-
Navigate to backend directory
cd backend -
Install dependencies
npm install
-
Create
.envfile (see Environment Variables section) -
Start the server
npm start
Server will run on
http://localhost:5000For development with auto-reload:
npx nodemon index.js
-
Navigate to frontend directory
cd fronted -
Install dependencies
npm install
-
Create
.env.localfile (see Environment Variables section) -
Start the development server
npm run dev
Frontend will run on
http://localhost:5173 -
Build for production
npm run build
-
Preview production build
npm run preview
# Server Configuration
PORT=5000
# Database
MONGODB_URI=mongodb+srv://[username]:[password]@[cluster].mongodb.net/[database]?retryWrites=true&w=majority
# AI Model
GEMINI_API_KEY=your_google_generative_ai_key_here
# Frontend URL (for CORS)
FRONTEND_URL=http://localhost:5173
# JWT (Optional - add if implementing JWT)
JWT_SECRET=your_jwt_secret_key_here# API Configuration
VITE_API_URL=http://localhost:5000/apiPOST /api/auth/register- Register new userPOST /api/auth/login- User loginPOST /api/auth/logout- User logout
GET /api/chats- Get all chats for userPOST /api/chats- Create new chatGET /api/chats/:id- Get specific chatPOST /api/chats/:id/messages- Send message (triggers AI response)DELETE /api/chats/:id- Delete chat
GET /health- API health status
Update these variables in your deployment platform's dashboard:
Vercel (Frontend)
VITE_API_URL- Your Render API URL
Render (Backend)
MONGODB_URI- MongoDB Atlas connection stringGEMINI_API_KEY- Google Generative AI keyFRONTEND_URL- Your Vercel frontend URLJWT_SECRET- Secure random string for JWT signingNODE_ENV- Set toproduction