Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ CodeQuest RPG

CodeQuest RPG Next.js Express MongoDB TypeScript

The only RPG where your code is your sword.

Conquer bugs, build systems, and become a legend in Neo-Jakarta 2077.


๐Ÿš€ Features

๐ŸŽฏ Core Gameplay

  • Real Coding Challenges - Solve actual JavaScript/Python problems
  • Character Classes - Frontend Warrior, Backend Mage, or Fullstack Ranger
  • Progression System - Level up, earn XP & Gold, unlock new challenges
  • AI Mentor - Get real-time code reviews and hints from "The Architect"

๐Ÿ› ๏ธ Technical Features

  • Full-Stack Architecture - Next.js 14 + Express.js + MongoDB
  • Secure Code Execution - Sandboxed via Piston API
  • AI Integration - OpenRouter API with Qwen model
  • GitHub OAuth - Login with your GitHub account
  • Responsive Design - Works on desktop and mobile

๐Ÿ—๏ธ Tech Stack

Layer Technology
Frontend Next.js 14, React 18, TypeScript, Tailwind CSS
State Zustand
Code Editor Monaco Editor
Animations Framer Motion
Backend Node.js, Express.js, TypeScript
Database MongoDB with Mongoose
Auth JWT + GitHub OAuth
AI OpenRouter API (Qwen model)
Code Execution Piston API

๐Ÿ“ฆ Project Structure

CodeQuest-RPG/
โ”œโ”€โ”€ backend/                 # Express.js API
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ config/          # Database & env config
โ”‚   โ”‚   โ”œโ”€โ”€ controllers/     # Route controllers
โ”‚   โ”‚   โ”œโ”€โ”€ middleware/      # Auth, validation, rate limiting
โ”‚   โ”‚   โ”œโ”€โ”€ models/          # MongoDB schemas
โ”‚   โ”‚   โ”œโ”€โ”€ routes/          # API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ services/        # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ app.ts           # Entry point
โ”‚   โ”‚   โ””โ”€โ”€ seed.ts          # Database seeding
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ frontend/                # Next.js 14 App
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ app/             # App Router pages
โ”‚   โ”‚   โ”œโ”€โ”€ components/      # Reusable components
โ”‚   โ”‚   โ”œโ”€โ”€ lib/             # API client, utilities
โ”‚   โ”‚   โ””โ”€โ”€ store/           # Zustand store
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ””โ”€โ”€ README.md

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+
  • MongoDB (local or MongoDB Atlas)
  • npm or yarn

1. Clone the Repository

git clone https://github.com/noahvlone/codequest-rpg.git
cd codequest-rpg

2. Backend Setup

cd backend
npm install

Create .env file (copy from .env.example):

PORT=5000
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/codequest
JWT_SECRET=your-super-secret-jwt-key
JWT_EXPIRES_IN=7d
OPENROUTER_API_KEY=your-openrouter-api-key
OPENROUTER_MODEL=qwen/qwen-2.5-vl-7b-instruct:free
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GITHUB_CALLBACK_URL=http://localhost:5000/api/auth/github/callback
FRONTEND_URL=http://localhost:3000
PISTON_API_URL=https://emkc.org/api/v2/piston

Seed the database:

npm run db:seed

Start the server:

npm run dev

3. Frontend Setup

cd frontend
npm install

Create .env.local:

NEXT_PUBLIC_API_URL=http://localhost:5000/api

Start the development server:

npm run dev

4. Open the App

Visit http://localhost:3000 ๐ŸŽ‰


๐Ÿ” GitHub OAuth Setup

  1. Go to GitHub Developer Settings
  2. Click "New OAuth App"
  3. Fill in:
    • Application name: CodeQuest RPG
    • Homepage URL: http://localhost:3000
    • Authorization callback URL: http://localhost:5000/api/auth/github/callback
  4. Copy the Client ID and Client Secret to your .env

๐ŸŒ Deployment

Frontend (Vercel)

  1. Push your code to GitHub
  2. Import project to Vercel
  3. Set environment variables:
    • NEXT_PUBLIC_API_URL = Your backend URL

Backend (Railway)

  1. Create a new project on Railway
  2. Add MongoDB (or use MongoDB Atlas)
  3. Deploy from GitHub
  4. Set environment variables in Railway dashboard

๐Ÿ“š API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/register Register new user
POST /api/auth/login Login with email/password
GET /api/auth/github Initiate GitHub OAuth
GET /api/auth/me Get current user

Characters

Method Endpoint Description
POST /api/characters Create character
GET /api/characters/active Get active character
GET /api/characters/progress Get challenge progress

Challenges

Method Endpoint Description
GET /api/challenges Get all challenges
GET /api/challenges/:id Get challenge details
POST /api/challenges/:id/execute Execute code

AI

Method Endpoint Description
POST /api/ai/chat Chat with AI mentor
POST /api/ai/review Get code review
POST /api/ai/hint Get hint

Shop & Leaderboard

Method Endpoint Description
GET /api/shop/items Get shop items
POST /api/shop/purchase/:itemId Purchase item
GET /api/leaderboard Get leaderboard

๐ŸŽฎ Game Classes

Class Specialty Starting Stats
Frontend Warrior DOM manipulation, CSS, UI CSS: 20, JS: 15, Python: 5
Backend Mage Server-side, APIs, Databases Python: 15, DB: 15, JS: 10
Fullstack Ranger Jack of all trades Balanced stats

๐Ÿ“ Challenge Categories

  1. Syntax Valley (Easy) - Basic syntax and variables
  2. Logic Labyrinth (Medium) - Loops, conditions, functions
  3. Algorithm Abyss (Hard) - Sorting, searching, optimization
  4. Data Structure Dungeon (Expert) - Stacks, queues, trees

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


๐Ÿ“„ License

MIT License - see LICENSE for details.


Built for developers who want to level up their skills

ยฉ 2077 Neotech Industries

About

Conquer bugs, build systems, and become a legend in Neo-Bogor 2077.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages