A modern full-stack AI workspace built for intelligent conversations, persistent chat history, authentication, subscriptions, and AI-powered assistance.
๐ Live Application โข โ๏ธ Backend API
Nexora AI is a full-stack AI chatbot and workspace application designed with a modern SaaS architecture.
It combines:
- โก Next.js frontend
- ๐ง Gemini-powered AI
- ๐ JWT authentication
- ๐พ MongoDB persistence
- ๐ฌ Persistent conversations
- ๐ณ Free and Pro subscription system
- ๐ฐ Manual payment verification
- ๐ฑ Responsive AI workspace
- ๐ File selection interface
- ๐ก๏ธ Server-side authorization and validation
The architecture is designed to provide a strong foundation for future AI capabilities such as streaming responses, document intelligence, RAG, web search, voice interaction, AI tools, agents, and multimodal workflows.
| Service | Platform | Status |
|---|---|---|
| Frontend | Vercel | ๐ข Live |
| Backend | Render | ๐ข Live |
| Database | MongoDB | ๐ข Connected |
| AI | Google Gemini | ๐ข Integrated |
Frontend: https://ai-chatbot-application-teal.vercel.app/
Backend: https://ai-chatbot-application-nam9.onrender.com
- Gemini-powered conversational AI
- Multi-turn conversation context
- Persistent conversations
- New conversation creation
- Existing conversation retrieval
- Conversation deletion
- Loading and error states
- Authentication-aware chat requests
- AI response handling
- User registration
- User login
- JWT-based authentication
- Protected API routes
- Authenticated user retrieval
- JWT validation middleware
- Invalid/expired token handling
Users can:
- Create a new chat
- Continue previous conversations
- View conversation history
- Open individual conversations
- Delete conversations
- Persist messages between sessions
Every conversation is associated with its authenticated user.
Nexora AI currently uses a two-tier subscription model.
- 15 successful AI messages
- Core AI chatbot access
- Conversation persistence
- Upgrade option after reaching the limit
- Rs. 999
- 30-day subscription
- Unlimited AI messages while active
- No Free-plan message counting
Expired Pro subscriptions automatically return to the Free plan.
Nexora AI includes a manual payment verification workflow for the current MVP.
- Easypaisa
- Payoneer
User
โ
โผ
Select Pro Plan
โ
โผ
Create Payment
โ
โผ
Payment stored as Pending
โ
โผ
User completes payment externally
โ
โผ
Transaction ID submitted
โ
โผ
Admin reviews payment
โ
โผ
Admin enters received amount
โ
โโโ < Rs. 999 โโโบ Reject
โ
โโโ >= Rs. 999 โโบ Verify
โ
โผ
Pro Activated
โ
โผ
30-day access
The minimum payment requirement is validated on both the frontend and backend.
Note: The current MVP uses manual payment verification. It does not claim automatic verification from Easypaisa or Payoneer.
โโโโโโโโโโโโโโโโโโโโโโโโ
โ User โ
โ Browser / Mobile โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Next.js Frontend โ
โ โ
โ Authentication โ
โ Chat Workspace โ
โ Conversations โ
โ Profile / Pricing โ
โ Upgrade / Payments โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
REST API
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Express Backend โ
โ โ
โ Authentication โ
โ Chat Controller โ
โ Payment Controller โ
โ Middleware โ
โโโโโโโโโโโฌโโโโโโโโฌโโโโโโโโโ
โ โ
โโโโโโโโโโโโ โโโโโโโโโโโโ
โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ MongoDB โ โ Gemini API โ
โ โ โ โ
โ Users โ โ AI Responses โ
โ Conversations โ โ Chat Context โ
โ Payments โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
The frontend is built with Next.js, React, TypeScript, Tailwind CSS, and Framer Motion.
frontend/
โ
โโโ app/
โ โโโ admin/
โ โ โโโ payments/
โ โ โโโ page.tsx
โ โ
โ โโโ chat/
โ โ โโโ page.tsx
โ โ
โ โโโ login/
โ โ โโโ page.tsx
โ โ
โ โโโ register/
โ โ โโโ page.tsx
โ โ
โ โโโ pricing/
โ โ โโโ page.tsx
โ โ
โ โโโ profile/
โ โ โโโ page.tsx
โ โ
โ โโโ upgrade/
โ โโโ page.tsx
โ
โโโ components/
โ โโโ ChatSidebar.tsx
โ โโโ ChatHeader.tsx
โ โโโ WelcomeScreen.tsx
โ โโโ MessageList.tsx
โ โโโ ChatComposer.tsx
โ
โโโ lib/
โโโ api/
โโโ auth.ts
โโโ chat.ts
The frontend handles:
- UI rendering
- Local UI state
- Authentication state
- API requests
- Conversation display
- Active conversation management
- Loading states
- API error handling
- Subscription information
- Payment submission interface
- Responsive layouts
Critical authorization and subscription decisions remain on the backend.
The main chat page acts as the orchestration layer for the AI workspace.
ChatPage
โ
โโโ ChatSidebar
โ โโโ New Chat
โ โโโ Conversation History
โ โโโ Delete Conversation
โ
โโโ ChatHeader
โ
โโโ WelcomeScreen
โ โโโ Suggested Prompts
โ
โโโ MessageList
โ โโโ User / Assistant Messages
โ
โโโ ChatComposer
โโโ Text Input
โโโ File Picker
โโโ AI Controls
โโโ Send
The ChatPage manages:
- Current user
- Conversations
- Active conversation
- Messages
- Input
- Loading state
- Free-plan limit state
- Mobile sidebar state
User enters message
โ
โผ
ChatComposer
โ
โผ
ChatPage.handleSend()
โ
โผ
sendChatMessage()
โ
โผ
POST /api/chat
โ
โผ
JWT Authentication
โ
โผ
Chat Controller
โ
โโโ Validate User
โโโ Check Subscription
โโโ Check Free Limit
โโโ Build Context
โ
โผ
Gemini Service
โ
โผ
Gemini Model
โ
โผ
AI Response
โ
โผ
Save to MongoDB
โ
โผ
Response to Client
โ
โผ
Update MessageList
The AI provider is isolated behind a service layer, making it easier to change or expand AI providers later.
backend/
โ
โโโ config/
โ โโโ db.js
โ
โโโ controllers/
โ โโโ auth.controller.js
โ โโโ chat.controller.js
โ โโโ payment.controller.js
โ
โโโ middleware/
โ โโโ auth.middleware.js
โ โโโ error.middleware.js
โ
โโโ models/
โ โโโ User.js
โ โโโ Conversation.js
โ โโโ Payment.js
โ
โโโ routes/
โ โโโ auth.routes.js
โ โโโ chat.routes.js
โ โโโ payment.routes.js
โ
โโโ services/
โ โโโ gemini.service.js
โ
โโโ server.js
โโโ .env
โโโ .gitignore
โโโ package.json
The API is organized into three main route groups:
/api/auth
/api/chat
/api/payment
Protected endpoints use authentication middleware.
The middleware:
- Reads the
Authorizationheader - Extracts the Bearer token
- Verifies the JWT
- Extracts the authenticated user ID
- Attaches user information to
req.user
A centralized error handler provides consistent API error responses and keeps controllers cleaner.
Responsible for:
- Registration
- Login
- Current user retrieval
- Subscription expiration handling
- User plan information
Responsible for:
- Sending AI messages
- Creating conversations
- Retrieving conversations
- Listing conversations
- Deleting conversations
- Free-plan limits
- Pro subscription access
Responsible for:
- Payment creation
- Transaction submission
- Pending payment retrieval
- Manual verification
- Pro activation
- Payment history
Gemini integration is isolated inside:
services/gemini.service.js
The service:
- Receives conversation messages
- Builds Gemini conversation context
- Sends the latest message
- Returns the generated response
This keeps the controllers independent from the AI provider and makes future provider changes easier.
MongoDB is used as the primary database through Mongoose.
MongoDB
โ
โโโ users
โโโ conversations
โโโ payments
Stores:
- Name
- Password hash
- Subscription plan
- Message usage
- Subscription status
- Subscription start date
- Subscription end date
- Timestamps
Important fields:
plan
messageCount
subscriptionStatus
subscriptionStart
subscriptionEnd
Each conversation belongs to one authenticated user.
Conversation
โ
โโโ user
โโโ title
โโโ messages[]
โ โโโ role
โ โโโ content
โ โโโ timestamps
โ
โโโ timestamps
Message roles:
user
assistant
Stores:
- User
- Plan
- Expected amount
- Actual received amount
- Currency
- Payment provider
- Transaction/reference ID
- Payment status
- Payment timestamp
- Created/updated timestamps
Payment states:
pending
paid
failed
cancelled
messageCount < 15
โ
โผ
Allowed
โ
โผ
Successful AI Response
โ
โผ
messageCount + 1
When the limit is reached:
messageCount >= 15
โ
โผ
Chat Locked
โ
โผ
Upgrade to Pro
Active Pro Subscription
โ
โผ
Unlimited AI Messages
Pro Subscription
โ
โผ
End Date < Current Time
โ
โผ
Downgrade to Free
โ
โผ
Free Plan Rules Apply
POST /api/auth/register
POST /api/auth/login
GET /api/auth/mePOST /api/chat
GET /api/chat
GET /api/chat/:conversationId
DELETE /api/chat/:conversationIdPOST /api/payment/create
POST /api/payment/submit-transaction
GET /api/payment/history
GET /api/payment/admin/pending
POST /api/payment/verifyNexora AI applies multiple server-side security controls.
Protected API endpoints require a valid Bearer token.
User-specific conversations and payment records are scoped to the authenticated account.
Subscription access is decided by the backend rather than trusting the frontend.
The backend validates the actual received amount before activating Pro.
receivedAmount < Rs.999
โ
โผ
Reject
Sensitive values are stored outside the source code:
- Gemini API key
- MongoDB connection string
- JWT secret
- Admin payment secret
Nexora AI follows a premium dark-first SaaS design direction.
- ๐ Dark workspace
- โจ Glass-inspired surfaces
- ๐ฒ Subtle borders
- โก Cyan / blue / violet accents
- ๐ Controlled gradients
- ๐ Clean spacing
- ๐งญ Compact navigation
- ๐ฑ Responsive layouts
- ๐ฏ Focused AI workspace experience
Core background:
#070A0F
Primary surfaces:
#0D1117
#111827
The interface focuses on usability without unnecessary visual complexity.
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Header โ
โ Sidebar โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ โ
โ Conversationsโ Messages โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ Composer โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The sidebar becomes a drawer and the workspace adapts to the available screen width.
The composer and controls are optimized for smaller screens while preserving the core chat experience.
The chat composer currently includes a frontend file picker.
Supported formats include:
PDF
TXT
DOC
DOCX
CSV
JSON
JS
JSX
TS
TSX
HTML
CSS
PY
MD
Current flow:
Paperclip
โ
โผ
File Input
โ
โผ
Selected File
โ
โผ
File Preview
โ
โผ
Remove / Replace
The file picker works on the frontend, but the selected file is not yet processed by Gemini.
This architecture leaves the application ready for future document-processing and RAG capabilities.
| Category | Technologies |
|---|---|
| Frontend | Next.js, React, TypeScript |
| Styling | Tailwind CSS |
| Animation | Framer Motion |
| Icons | Lucide React |
| Backend | Node.js, Express.js |
| Database | MongoDB, Mongoose |
| Authentication | JWT |
| AI | Google Gemini API |
| Payments | Easypaisa, Payoneer |
| Deployment | Vercel, Render |
Nexora AI combines multiple independent systems into one SaaS architecture:
Authentication
โ
โโโ JWT
โ
โผ
User Management
โ
โโโ Free Plan
โโโ Pro Plan
โโโ Subscription Expiration
โ
โผ
Chat System
โ
โโโ Conversations
โโโ Messages
โโโ Gemini Context
โ
โผ
Payment System
โ
โโโ Payment Creation
โโโ Transaction Submission
โโโ Admin Verification
โโโ Subscription Activation
โ
โผ
Persistent Database
โ
โโโ Users
โโโ Conversations
โโโ Payments
Client
โ
โผ
API
โ
โผ
AI Service
โ
โผ
Streaming Response
โ
โผ
Live UI Updates
File Upload
โ
โผ
File Validation
โ
โผ
Text Extraction
โ
โผ
Chunking
โ
โผ
Embeddings
โ
โผ
Vector Database
โ
โผ
RAG
โ
โผ
Gemini
Future capabilities may include:
- Web search
- Deep research
- Code generation
- Code analysis
- Image generation
- Document analysis
- Voice interaction
- AI agents
Nexora AI
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโ
โผ โผ โผ
Chat Engine Tool Engine Agent Engine
โ โ โ
โผ โผ โผ
Gemini Web Search RAG
Code Tools Memory
Files Planning
APIs Execution
Create:
backend/.env
PORT=5000
GEMINI_API_KEY=YOUR_GEMINI_API_KEY
MONGODB_URI=YOUR_MONGODB_CONNECTION_STRING
JWT_SECRET=YOUR_LONG_RANDOM_SECRET
ADMIN_PAYMENT_SECRET=YOUR_ADMIN_PAYMENT_SECRETCreate:
frontend/.env.local
NEXT_PUBLIC_API_URL=http://localhost:5000For production, set:
NEXT_PUBLIC_API_URL=https://ai-chatbot-application-nam9.onrender.comNever commit API keys, database credentials, JWT secrets, or admin secrets to GitHub.
git clone https://github.com/Abdullah-Asim-dev/AI-Chatbot-Application.git
cd "AI-chatbot Application"cd backend
npm installCreate:
backend/.env
Add the required environment variables.
Start the backend:
npm run devBackend:
http://localhost:5000
Open another terminal:
cd frontend
npm installCreate:
frontend/.env.local
Add:
NEXT_PUBLIC_API_URL=http://localhost:5000Start the frontend:
npm run devFrontend:
http://localhost:3000
Deployed with:
Vercel
https://ai-chatbot-application-teal.vercel.app/
Deployed with:
Render
https://ai-chatbot-application-nam9.onrender.com
โโโโโโโโโโโโโโโโโโโโโโโ
โ Vercel โ
โ Next.js Frontend โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โ HTTPS
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Render โ
โ Node + Express API โ
โโโโโโโโโฌโโโโโโโโฌโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ MongoDB โ โ Gemini API โ
โโโโโโโโโโโโ โโโโโโโโโโโโโโโ
Before operating Nexora AI as a large public SaaS platform, the following areas should be strengthened.
Replace the MVP manual verification workflow with official payment-provider integrations where available.
Replace the static admin payment secret with role-based admin authentication.
Add:
- Rate limiting
- Request validation
- Security headers
- Abuse prevention
- Request logging
- Production CORS configuration
Add:
- Streaming
- Retry handling
- Provider fallback
- Usage tracking
- Token/cost monitoring
- AI request limits
Add:
- Secure uploads
- File-size limits
- MIME validation
- Malware scanning
- Text extraction
- File storage
- Document indexing
- RAG pipeline
Frontend, routes, controllers, services, middleware, and database models have separate responsibilities.
Authentication, subscription status, message limits, and payment validation are enforced server-side.
Gemini integration is isolated inside a service layer.
Users, conversations, and payments are persisted in MongoDB.
The architecture is designed so future AI tools and services can be added without rebuilding the entire application.
- Next.js AI workspace
- Responsive chat interface
- User registration
- User login
- JWT authentication
- MongoDB integration
- Gemini AI integration
- Persistent conversations
- Conversation history
- Conversation deletion
- Free 15-message limit
- Pro subscription logic
- Subscription expiration handling
- Easypaisa payment workflow
- Payoneer payment workflow
- Transaction ID submission
- Admin payment dashboard
- Server-side Rs.999 payment validation
- Payment history
- Responsive mobile sidebar
- File picker UI
- Production frontend deployment
- Production backend deployment
- AI streaming
- Markdown rendering
- Code syntax highlighting
- Code copy actions
- File-to-AI processing
- Document analysis
- RAG
- Web search
- Deep research
- Voice interaction
- Image generation
- AI agents
- Projects / workspaces
- Production payment APIs
- Role-based admin system
Nexora AI is designed as a foundation for a broader AI SaaS ecosystem rather than a simple chatbot.
The architecture separates:
UI
โ
โโโ Application State
โ
โโโ REST API
โ
โโโ Authentication
โ
โโโ Business Logic
โ
โโโ AI Service
โ
โโโ Subscription System
โ
โโโ Payment System
โ
โโโ Database
This makes the project easier to maintain, extend, debug, and evolve as new AI capabilities are introduced.
This project is currently intended as a personal/professional portfolio and SaaS development project.
Add an appropriate open-source license if the repository is later intended for public distribution under specific licensing terms.
Abdullah Asim
Full-Stack Developer
GitHub
โข
LinkedIn
โญ If you find Nexora AI interesting, consider giving the repository a star.