Skip to content

About

Nexora AI is a full-stack AI workspace built with Next.js, Node.js, Express, MongoDB, JWT authentication, and Gemini AI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– Nexora AI

A modern full-stack AI workspace built for intelligent conversations, persistent chat history, authentication, subscriptions, and AI-powered assistance.

Next.js React Node.js Express.js MongoDB Gemini AI

๐ŸŒ Live Application โ€ข โš™๏ธ Backend API


๐Ÿ“Œ Overview

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.


๐ŸŒ Live Deployment

Service Platform Status
Frontend Vercel ๐ŸŸข Live
Backend Render ๐ŸŸข Live
Database MongoDB ๐ŸŸข Connected
AI Google Gemini ๐ŸŸข Integrated

๐Ÿ”— Links

Frontend: https://ai-chatbot-application-teal.vercel.app/

Backend: https://ai-chatbot-application-nam9.onrender.com


โœจ Key Features

๐Ÿง  AI Chat

  • 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

๐Ÿ” Authentication

  • User registration
  • User login
  • JWT-based authentication
  • Protected API routes
  • Authenticated user retrieval
  • JWT validation middleware
  • Invalid/expired token handling

๐Ÿ’ฌ Conversation Management

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.


๐Ÿ’Ž Free & Pro Plans

Nexora AI currently uses a two-tier subscription model.

๐Ÿ†“ Free

  • 15 successful AI messages
  • Core AI chatbot access
  • Conversation persistence
  • Upgrade option after reaching the limit

๐Ÿš€ Pro

  • Rs. 999
  • 30-day subscription
  • Unlimited AI messages while active
  • No Free-plan message counting

Expired Pro subscriptions automatically return to the Free plan.


๐Ÿ’ณ Payment System

Nexora AI includes a manual payment verification workflow for the current MVP.

Supported Providers

  • Easypaisa
  • Payoneer

Payment Flow

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.


๐Ÿ—๏ธ System Architecture

                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚        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        โ”‚           โ”‚                 โ”‚
           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽจ Frontend Architecture

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

Frontend Responsibilities

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.


๐Ÿ’ฌ Chat Workspace

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

๐Ÿ”„ Chat Request Lifecycle

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 Architecture

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

๐Ÿงฉ Backend Layers

๐Ÿ›ฃ๏ธ Routes

The API is organized into three main route groups:

/api/auth
/api/chat
/api/payment

Protected endpoints use authentication middleware.


๐Ÿ›ก๏ธ Middleware

Authentication Middleware

The middleware:

  1. Reads the Authorization header
  2. Extracts the Bearer token
  3. Verifies the JWT
  4. Extracts the authenticated user ID
  5. Attaches user information to req.user

Error Middleware

A centralized error handler provides consistent API error responses and keeps controllers cleaner.


๐ŸŽฏ Controllers

Auth Controller

Responsible for:

  • Registration
  • Login
  • Current user retrieval
  • Subscription expiration handling
  • User plan information

Chat Controller

Responsible for:

  • Sending AI messages
  • Creating conversations
  • Retrieving conversations
  • Listing conversations
  • Deleting conversations
  • Free-plan limits
  • Pro subscription access

Payment Controller

Responsible for:

  • Payment creation
  • Transaction submission
  • Pending payment retrieval
  • Manual verification
  • Pro activation
  • Payment history

๐Ÿง  AI Service Layer

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.


๐Ÿ—„๏ธ Database Architecture

MongoDB is used as the primary database through Mongoose.

MongoDB
โ”‚
โ”œโ”€โ”€ users
โ”œโ”€โ”€ conversations
โ””โ”€โ”€ payments

๐Ÿ‘ค User Model

Stores:

  • Name
  • Email
  • Password hash
  • Subscription plan
  • Message usage
  • Subscription status
  • Subscription start date
  • Subscription end date
  • Timestamps

Important fields:

plan
messageCount
subscriptionStatus
subscriptionStart
subscriptionEnd

๐Ÿ’ฌ Conversation Model

Each conversation belongs to one authenticated user.

Conversation
โ”‚
โ”œโ”€โ”€ user
โ”œโ”€โ”€ title
โ”œโ”€โ”€ messages[]
โ”‚     โ”œโ”€โ”€ role
โ”‚     โ”œโ”€โ”€ content
โ”‚     โ””โ”€โ”€ timestamps
โ”‚
โ””โ”€โ”€ timestamps

Message roles:

user
assistant

๐Ÿ’ฐ Payment Model

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

๐Ÿ“Š Subscription Logic

๐Ÿ†“ Free User

messageCount < 15
        โ”‚
        โ–ผ
     Allowed
        โ”‚
        โ–ผ
Successful AI Response
        โ”‚
        โ–ผ
messageCount + 1

When the limit is reached:

messageCount >= 15
        โ”‚
        โ–ผ
     Chat Locked
        โ”‚
        โ–ผ
   Upgrade to Pro

๐Ÿš€ Pro User

Active Pro Subscription
          โ”‚
          โ–ผ
  Unlimited AI Messages

โฐ Expired Pro

Pro Subscription
       โ”‚
       โ–ผ
End Date < Current Time
       โ”‚
       โ–ผ
Downgrade to Free
       โ”‚
       โ–ผ
Free Plan Rules Apply

๐Ÿ”Œ API Structure

Authentication

POST /api/auth/register
POST /api/auth/login
GET  /api/auth/me

Chat

POST   /api/chat
GET    /api/chat
GET    /api/chat/:conversationId
DELETE /api/chat/:conversationId

Payments

POST /api/payment/create
POST /api/payment/submit-transaction
GET  /api/payment/history

GET  /api/payment/admin/pending
POST /api/payment/verify

๐Ÿ”’ Security Architecture

Nexora AI applies multiple server-side security controls.

JWT Authentication

Protected API endpoints require a valid Bearer token.

User Ownership

User-specific conversations and payment records are scoped to the authenticated account.

Backend Subscription Validation

Subscription access is decided by the backend rather than trusting the frontend.

Server-side Payment Validation

The backend validates the actual received amount before activating Pro.

receivedAmount < Rs.999
          โ”‚
          โ–ผ
        Reject

Environment Variables

Sensitive values are stored outside the source code:

  • Gemini API key
  • MongoDB connection string
  • JWT secret
  • Admin payment secret

๐ŸŽจ UI / UX

Nexora AI follows a premium dark-first SaaS design direction.

Design Principles

  • ๐ŸŒ‘ 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.


๐Ÿ“ฑ Responsive Design

Desktop

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              โ”‚ Header                        โ”‚
โ”‚   Sidebar    โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚              โ”‚                               โ”‚
โ”‚ Conversationsโ”‚           Messages            โ”‚
โ”‚              โ”‚                               โ”‚
โ”‚              โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚              โ”‚ Composer                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Mobile

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.


๐Ÿ“Ž File Attachment Architecture

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

Current MVP Status

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.


๐Ÿ› ๏ธ Technology Stack

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

๐Ÿ“ˆ Project Complexity

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

๐Ÿš€ Future Roadmap

โšก AI Streaming

Client
  โ”‚
  โ–ผ
API
  โ”‚
  โ–ผ
AI Service
  โ”‚
  โ–ผ
Streaming Response
  โ”‚
  โ–ผ
Live UI Updates

๐Ÿ“„ Document Intelligence

File Upload
    โ”‚
    โ–ผ
File Validation
    โ”‚
    โ–ผ
Text Extraction
    โ”‚
    โ–ผ
Chunking
    โ”‚
    โ–ผ
Embeddings
    โ”‚
    โ–ผ
Vector Database
    โ”‚
    โ–ผ
RAG
    โ”‚
    โ–ผ
Gemini

๐Ÿ”Ž AI Tools

Future capabilities may include:

  • Web search
  • Deep research
  • Code generation
  • Code analysis
  • Image generation
  • Document analysis
  • Voice interaction
  • AI agents

๐Ÿง  Advanced AI Architecture

                    Nexora AI
                        โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ–ผ               โ–ผ                โ–ผ
   Chat Engine      Tool Engine      Agent Engine
        โ”‚               โ”‚                โ”‚
        โ–ผ               โ–ผ                โ–ผ
     Gemini         Web Search          RAG
                    Code Tools          Memory
                    Files               Planning
                    APIs                Execution

๐Ÿ”ง Environment Variables

Backend

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_SECRET

Frontend

Create:

frontend/.env.local
NEXT_PUBLIC_API_URL=http://localhost:5000

For production, set:

NEXT_PUBLIC_API_URL=https://ai-chatbot-application-nam9.onrender.com

Never commit API keys, database credentials, JWT secrets, or admin secrets to GitHub.


๐Ÿ’ป Local Development

1. Clone Repository

git clone https://github.com/Abdullah-Asim-dev/AI-Chatbot-Application.git
cd "AI-chatbot Application"

2. Backend Setup

cd backend
npm install

Create:

backend/.env

Add the required environment variables.

Start the backend:

npm run dev

Backend:

http://localhost:5000

3. Frontend Setup

Open another terminal:

cd frontend
npm install

Create:

frontend/.env.local

Add:

NEXT_PUBLIC_API_URL=http://localhost:5000

Start the frontend:

npm run dev

Frontend:

http://localhost:3000

โ˜๏ธ Production Deployment

Frontend

Deployed with:

Vercel

https://ai-chatbot-application-teal.vercel.app/

Backend

Deployed with:

Render

https://ai-chatbot-application-nam9.onrender.com

Production Architecture

                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚      Vercel         โ”‚
                 โ”‚   Next.js Frontend  โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                            โ”‚
                            โ”‚ HTTPS
                            โ–ผ
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚       Render        โ”‚
                 โ”‚ Node + Express API  โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚       โ”‚
                         โ–ผ       โ–ผ
                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ”‚ MongoDB  โ”‚  โ”‚ Gemini API  โ”‚
                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ›ก๏ธ Production Considerations

Before operating Nexora AI as a large public SaaS platform, the following areas should be strengthened.

Payments

Replace the MVP manual verification workflow with official payment-provider integrations where available.

Admin Security

Replace the static admin payment secret with role-based admin authentication.

API Security

Add:

  • Rate limiting
  • Request validation
  • Security headers
  • Abuse prevention
  • Request logging
  • Production CORS configuration

AI Reliability

Add:

  • Streaming
  • Retry handling
  • Provider fallback
  • Usage tracking
  • Token/cost monitoring
  • AI request limits

File Processing

Add:

  • Secure uploads
  • File-size limits
  • MIME validation
  • Malware scanning
  • Text extraction
  • File storage
  • Document indexing
  • RAG pipeline

๐Ÿงฑ Architecture Principles

Separation of Concerns

Frontend, routes, controllers, services, middleware, and database models have separate responsibilities.

Backend as the Source of Truth

Authentication, subscription status, message limits, and payment validation are enforced server-side.

Provider Abstraction

Gemini integration is isolated inside a service layer.

Persistent State

Users, conversations, and payments are persisted in MongoDB.

Extensibility

The architecture is designed so future AI tools and services can be added without rebuilding the entire application.


โœ… Current Status

Completed

  • 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

๐Ÿ”ฎ Future

  • 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

๐ŸŽฏ Why Nexora AI?

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.


๐Ÿ“„ License

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.


๐Ÿ‘จโ€๐Ÿ’ป Developed By

Abdullah Asim
Full-Stack Developer

GitHub โ€ข LinkedIn

โญ If you find Nexora AI interesting, consider giving the repository a star.

About

Nexora AI is a full-stack AI workspace built with Next.js, Node.js, Express, MongoDB, JWT authentication, and Gemini AI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages