A production-ready web application for students to learn Java through quizzes and gamified progress tracking.
- Lecture-Based Learning: Study Java topics organized by university lecture structure
- Multiple Question Types: Single choice, multiple choice, true/false, fill-in-blank, code analysis
- Gamification: XP system, levels, streaks to keep students motivated
- Progress Tracking: Track performance by lecture and difficulty
- AI Question Generation: Generate new questions using OpenAI API (optional)
- Admin Dashboard: Manage lectures and questions
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Styling: TailwindCSS
- Database: PostgreSQL with Prisma ORM
- Authentication: NextAuth.js
- AI: OpenAI API (optional)
- Testing: Vitest
- Node.js 18+
- PostgreSQL database
- npm or pnpm
- Clone the repository:
git clone <repository-url>
cd java-repeater- Install dependencies:
npm install- Set up environment variables:
cp .env.example .envEdit .env with your configuration:
DATABASE_URL="postgresql://user:password@localhost:5432/java_repeater"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key"
- Set up the database:
# Generate Prisma client
npm run db:generate
# Push schema to database
npm run db:push
# Seed with initial data
npm run db:seed- Start the development server:
npm run devVisit http://localhost:3000
After seeding, you can log in with:
| Role | Password | |
|---|---|---|
| Admin | admin@example.com | admin123 |
| Student | student@example.com | student123 |
src/
├── app/ # Next.js App Router
│ ├── (protected)/ # Authenticated routes
│ │ ├── admin/ # Admin pages
│ │ ├── dashboard/ # Student dashboard
│ │ ├── lectures/ # Lecture pages & quiz
│ │ └── settings/ # User settings
│ ├── api/ # API routes
│ └── auth/ # Auth pages
├── components/ # React components
├── lib/ # Utility functions
│ ├── auth.ts # NextAuth config
│ ├── prisma.ts # Prisma client
│ ├── gamification.ts # XP/level logic
│ └── question-evaluator.ts # Answer evaluation
└── types/ # TypeScript types
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run start |
Start production server |
npm run test |
Run tests |
npm run lint |
Run ESLint |
npm run db:generate |
Generate Prisma client |
npm run db:push |
Push schema to database |
npm run db:migrate |
Run database migrations |
npm run db:seed |
Seed database with initial data |
npm run db:studio |
Open Prisma Studio |
| Type | Description |
|---|---|
| SINGLE_CHOICE | One correct answer from multiple options |
| MULTIPLE_CHOICE | Multiple correct answers |
| TRUE_FALSE | Statement evaluation |
| FILL_IN_BLANK | Text input answer |
| CODE_WILL_COMPILE | Java code analysis |
| CODE_WILL_CRASH | Runtime behavior analysis |
| SHORT_TEXT | Brief explanation |
- XP System: +10 XP for correct answers, +2 XP for attempts
- Levels: Progressive thresholds (Level 1: 0, Level 2: 100, Level 3: 250, etc.)
- Streaks: Daily activity tracking for motivation
Admins can generate questions using OpenAI:
- Go to Settings > AI Settings
- Enter your OpenAI API key
- Select preferred model
- Use "Generate Questions" in admin lecture pages
| Route | Method | Description |
|---|---|---|
/api/auth/* |
* | NextAuth endpoints |
/api/register |
POST | User registration |
/api/quiz |
GET | Get next question |
/api/quiz/submit |
POST | Submit answer |
/api/admin/lectures |
GET, POST | Manage lectures |
/api/admin/questions |
GET, POST | Manage questions |
/api/admin/generate-questions |
POST | AI generation |
/api/settings/ai |
GET, POST, DELETE | AI settings |
npm run test # Watch mode
npm run test:run # Single run# View data in browser
npm run db:studio
# Reset database
npx prisma db push --force-reset
npm run db:seedBased on university Java curriculum:
- Classes and Objects
- OOP Concepts
- Exceptions
- Javadoc
- Collections
- Generics
- Lambda Expressions
- Stream API
- Sorting
- Code Behavior Prediction
- Java Basics
ISC