Skip to content

Harsh-sh7/NotAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🧠 NotAI — AI Chat, Code Execution & Contest Arena

A full-stack web app that merges AI-powered chat, live code execution, and AI-generated coding contests, built using React, TypeScript, Node.js, and MongoDB.

Status React TypeScript Express MongoDB


⚡ Overview

NotAI lets users chat with Google Gemini AI, manage multiple conversations, execute code in real time across popular programming languages, and compete in AI-generated coding contests — all in one clean, responsive interface.


✨ Features

💬 Chat Interface

  • Google Gemini AI integration
  • Real-time streaming responses
  • Persistent chat history (MongoDB)
  • Multiple conversation sessions

💻 Code Assistant

  • Supports JavaScript, Python, Java, C++
  • Judge0 API integration for safe cloud execution
  • Monaco Editor (VS Code-like experience)
  • Syntax highlighting and error reporting

🏆 Contest Arena

  • AI-Generated DSA Problems — Unique coding challenges generated by Gemini AI
  • Three Difficulty Levels — Beginner, Intermediate, and Expert
  • Multiple Topics — Arrays, Strings, Trees, Graphs, Dynamic Programming, and more
  • Live Code Execution — Test your solutions with example and hidden test cases
  • Progress Tracking — Track solved problems and success rate
  • Leaderboard — Compete with other users and see rankings by difficulty
  • Submission History — Review all your previous attempts and solutions
  • Smart Problem Generation — Never get the same problem twice for a topic

🔐 Authentication

  • JWT-based user sessions
  • Encrypted passwords (bcrypt)
  • Protected API routes

📱 Responsive Design

  • Mobile-first layout
  • PWA-ready for installable experience
  • Smooth animations and dark/light mode

🧩 Project Structure

Frontend — React + TypeScript

frontend/
├── src/
│   ├── components/   # Chat, CodeEditor, Auth, Contest, Leaderboard, etc.
│   ├── context/      # Auth, Chat & Contest state
│   ├── services/     # API integration
│   └── types/        # TypeScript definitions

Backend — Node.js + Express

backend/
├── models/       # MongoDB schemas (User, Chat, Submission)
├── routes/       # Auth, Chat & Contest APIs
├── middleware/   # JWT verification
└── server.js     # Entry point

🛠️ Tech Stack

Layer Technologies
Frontend React, TypeScript, Tailwind CSS, Vite, Monaco Editor
Backend Node.js, Express.js, Mongoose
Database MongoDB
External APIs Google Gemini AI, Judge0 API
Auth JWT, bcrypt

🧱 Database Models

User

{
  username: String,
  email: String,
  password: String,
  createdAt: Date
}

Chat

{
  user: ObjectId (ref: User),
  title: String,
  messages: [{ role: String, content: String, timestamp: Date }],
  createdAt: Date
}

Submission (Contest)

{
  user: ObjectId (ref: User),
  problemTitle: String,
  problemDescription: String,
  difficulty: String,
  topic: String,
  language: String,
  code: String,
  solved: Boolean,
  attempts: Number,
  testCases: Array,
  lastAttemptedAt: Date
}

🏆 Contest Arena — How It Works

Starting a Contest

  1. Select Difficulty — Choose from Beginner, Intermediate, or Expert
  2. Pick a Topic — Select from 15+ DSA topics or enter a custom one
  3. Choose Language — Python, JavaScript, C++, or Java
  4. Generate Problem — AI creates a unique coding challenge

Solving Problems

  • Problem Description — Clear problem statement with constraints
  • Example Test Cases — Visible test cases to understand the problem
  • Code Editor — Monaco editor with syntax highlighting
  • Run Code — Test with custom inputs
  • Submit — Run against all test cases (including hidden ones)

Tracking Progress

  • Dashboard — View your stats (problems solved, attempts, success rate)
  • Submission History — Review all past attempts with code
  • Leaderboard — See global rankings by difficulty level
  • Smart Generation — System remembers solved problems to avoid duplicates

Difficulty Levels

  • Beginner — Basic data structures and simple algorithms
  • Intermediate — Moderate complexity with multiple concepts
  • Expert — Advanced algorithms and complex problem-solving

🚀 Getting Started

Prerequisites

  • Node.js ≥ 16
  • MongoDB (local or Atlas)
  • Google Gemini API key
  • Judge0 API key

Setup

git clone https://github.com/Harsh-sh7/NotAI.git
cd NotAI

Backend

cd backend
npm install
# Add .env
MONGODB_URI=mongodb://localhost:27017/notai
JWT_SECRET=your_jwt_secret
GEMINI_API_KEY=your_gemini_api_key
RAPIDAPI_KEY=your_judge0_api_key
PORT=5001

npm run dev

Frontend

cd ../frontend
npm install
# Add .env
VITE_API_URL=http://localhost:5001
GEMINI_API_KEY=your_gemini_api_key

npm run dev

Then visit http://localhost:3000.


⚙️ Environment Variables

Variable Description
MONGODB_URI MongoDB connection string
JWT_SECRET JWT encryption key
GEMINI_API_KEY Google Gemini API key
RAPIDAPI_KEY Judge0 API key
PORT Backend port
VITE_API_URL Frontend API base URL

🚢 Deployment

Build & Deploy

# Frontend
cd frontend && npm run build

# Backend
cd backend && npm start

Recommended Hosting:

  • Frontend → Vercel / Netlify
  • Backend → Render / Railway / DigitalOcean
  • Database → MongoDB Atlas

🤝 Contributing

  1. Fork the repo
  2. Create a branch → git checkout -b feature/new-feature
  3. Commit changes → git commit -m "Added new feature"
  4. Push → git push origin feature/new-feature
  5. Open a Pull Request

📜 License

This project is licensed under the MIT License — see LICENSE.


👨‍💻 Author

Harsh Sharma
🔗 GitHub Profile
💡 Project Repo: NotAI


🙏 Acknowledgments

  • Google Gemini AI
  • Judge0 API
  • React & TypeScript Communities
  • Tailwind CSS & Vite
  • MongoDB Atlas

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors