An intelligent chatbot platform for pest control services featuring lead qualification, knowledge base retrieval, and comprehensive admin dashboard. Built with Next.js and Google Genkit for powerful AI conversations.
- Features
- Demo
- Architecture
- Tech Stack
- Getting Started
- Project Structure
- AI Flows
- Admin Dashboard
- Available Scripts
- Deployment
- Contributing
- License
- Contact
|
|
Customers interact with an intelligent AI assistant that can:
- Answer pest control questions from the knowledge base
- Qualify leads through conversational forms
- Provide service information and pricing
- Schedule appointments and consultations
Business owners get access to:
- Overview Page: Key metrics and recent activity
- Conversations: All customer chat histories
- Leads: Qualified prospects with contact information
- Orders: Service requests and their status
- Knowledge Base: Content management for FAQ
graph TB
A[Customer Chat UI] -->|User Message| B[Next.js API Routes]
B -->|AI Request| C[Genkit AI Flows]
C -->|Query| D[Knowledge Base - Markdown]
C -->|Generate| E[Google Gemini AI]
E -->|Response| B
B -->|Display| A
F[Admin Dashboard] -->|Manage| G[Mock Data Store]
C -->|Store| G
Frontend (Next.js + React)
- Server-side rendering for optimal performance
- Beautiful UI with shadcn/ui components
- Responsive design for all devices
- Real-time chat interface
AI Layer (Genkit)
- Conversation flow management
- Knowledge base retrieval with embeddings
- Lead qualification logic
- Integration with Google Gemini
Backend (Next.js API Routes)
- RESTful API endpoints
- Server actions for mutations
- Mock data storage (easily replaceable with DB)
Before you begin, ensure you have the following installed:
- Clone the repository
git clone https://github.com/mu7ammad-3li/OmniAssistant.git
cd OmniAssistant- Install dependencies
npm install- Create environment file
Create a .env.local file in the root directory:
# Google AI (Gemini) Configuration
GOOGLE_GENAI_API_KEY=your-google-ai-api-key-here
# Application Configuration
NEXT_PUBLIC_APP_NAME=OmniAssistant
NEXT_PUBLIC_APP_URL=http://localhost:9002
# Optional: Development Settings
NODE_ENV=developmentGetting Google AI API Key:
-
Visit Google AI Studio
-
Sign in with your Google account
-
Click "Get API Key"
-
Create a new API key
-
Copy the key to your
.env.localfile -
Run the development server
Option 1: Next.js only
npm run devOption 2: Next.js + Genkit Dev UI
In separate terminals:
# Terminal 1: Next.js dev server
npm run dev
# Terminal 2: Genkit development UI (for AI flow testing)
npm run genkit:devThe application will be running at:
- Next.js App: http://localhost:9002
- Genkit Dev UI: http://localhost:4000 (if running genkit:dev)
- Build for production
npm run build
npm run startOmniAssistant/
βββ π src/ # Source code
β βββ π app/ # Next.js app directory
β β βββ π admin/ # Admin dashboard
β β β βββ π conversations/ # Conversation management
β β β βββ π leads/ # Lead management
β β β βββ π orders/ # Order management
β β β βββ π kb/ # Knowledge base editor
β β β βββ layout.tsx # Admin layout
β β β βββ page.tsx # Dashboard overview
β β βββ π api/ # API routes
β β β βββ π genkit/ # Genkit API endpoints
β β βββ π chat/ # Customer chat interface
β β β βββ page.tsx # Chat page
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home page
β β βββ globals.css # Global styles
β βββ π ai/ # Genkit AI flows
β β βββ conversation-flow.ts # Main conversation AI
β β βββ lead-qualification.ts # Lead capture flow
β β βββ knowledge-retrieval.ts # KB search flow
β β βββ dev.ts # Genkit dev server
β β βββ index.ts # AI exports
β βββ π components/ # React components
β β βββ π ui/ # shadcn/ui components
β β β βββ button.tsx
β β β βββ card.tsx
β β β βββ dialog.tsx
β β β βββ ...
β β βββ π chat/ # Chat components
β β β βββ ChatMessage.tsx
β β β βββ ChatInput.tsx
β β β βββ ChatInterface.tsx
β β βββ π admin/ # Admin components
β β β βββ Sidebar.tsx
β β β βββ StatCard.tsx
β β β βββ DataTable.tsx
β β βββ π forms/ # Form components
β β βββ LeadQualificationForm.tsx
β βββ π hooks/ # Custom React hooks
β β βββ useChat.ts
β β βββ useConversations.ts
β βββ π kb/ # Knowledge base (Markdown)
β β βββ pest-identification.md
β β βββ treatment-methods.md
β β βββ prevention-tips.md
β β βββ pricing-info.md
β βββ π lib/ # Utilities
β β βββ mock-data.ts # Mock data store
β β βββ utils.ts # Helper functions
β βββ π types/ # TypeScript types
β βββ conversation.ts
β βββ lead.ts
β βββ order.ts
βββ π public/ # Static assets
βββ .env.local # Environment variables (create this)
βββ .env.example # Environment template
βββ .gitignore # Git ignore rules
βββ next.config.js # Next.js configuration
βββ package.json # Dependencies and scripts
βββ tailwind.config.ts # Tailwind configuration
βββ tsconfig.json # TypeScript configuration
βββ README.md # This file
OmniAssistant uses Google Genkit to power three main AI flows:
Handles general customer conversations:
- Understands pest control questions
- Retrieves relevant information from knowledge base
- Maintains conversation context
- Provides helpful, natural responses
Intelligently qualifies potential customers:
- Asks relevant qualifying questions
- Captures contact information
- Assesses urgency and service needs
- Stores lead data for follow-up
Searches the knowledge base:
- Converts Markdown files to embeddings
- Performs semantic search
- Returns relevant content chunks
- Integrates with conversation flow
Use the Genkit Dev UI to test AI flows in isolation:
npm run genkit:devVisit http://localhost:4000 to interact with individual flows.
The admin dashboard provides complete business management:
- Total Conversations: Count of customer chats
- Active Leads: Qualified prospects
- Pending Orders: Service requests awaiting action
- Recent Activity: Latest conversations and leads
- View all customer conversations
- Search and filter by customer or date
- See full conversation history
- Mark conversations as resolved
- Manage qualified leads
- Contact information and needs
- Lead source and qualification status
- Export leads as CSV
- Track service orders
- Update order status
- View customer details
- Manage fulfillment
- Edit Markdown knowledge base files
- Add new FAQ entries
- Organize content by category
- Preview changes
# Development server (Next.js only)
npm run dev
# Genkit AI flow development UI
npm run genkit:dev
# Genkit with auto-reload (watch mode)
npm run genkit:watch
# Build for production
npm run build
# Start production server
npm run start
# Lint code
npm run lint
# Type check
npm run typecheck- Install Vercel CLI
npm install -g vercel- Set environment variables in Vercel dashboard
GOOGLE_GENAI_API_KEY=your-api-key
- Deploy
vercelNetlify:
npm run build
# Deploy the .next folderDocker:
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
CMD ["npm", "start"]The project currently uses mock data for demonstration. To integrate with a real database:
- Choose a database (PostgreSQL, MongoDB, Firebase, etc.)
- Install database client
npm install prisma @prisma/client # Example for Prisma- Replace mock functions in
src/lib/mock-data.ts - Update API routes to use real database queries
- Add authentication for admin dashboard
Contributions are what make the open-source community amazing! Any contributions you make are greatly appreciated.
- Fork the Project
- Create your 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
Distributed under the MIT License. See LICENSE for more information.
Muhammad Ali
- GitHub: @mu7ammad-3li
- Email: muhammad.3lii2@gmail.com
- LinkedIn: linkedin.com/in/muhammad-3lii
Project Link: https://github.com/mu7ammad-3li/OmniAssistant
- Next.js - React framework
- Google Genkit - AI orchestration framework
- Google Gemini - Large language model
- shadcn/ui - UI components
- Tailwind CSS - Styling
- Radix UI - Headless UI components