Skip to content
TypeScript

batam-cbt

This public repository does not include a GitHub description yet.

0

Stars

0

Forks

0

Watchers

0

Issues

243

Size (KB)

main

Branch

Files

2 folders · 19 files

Click a file to open it on GitHub. Browse full tree →

CBT AI - Computer Based Test System

Sistem ujian berbasis komputer modern dengan fitur anti-cheat, single login, dan manajemen soal yang lengkap.

🚀 Fitur Utama

🔒 Keamanan & Anti-Cheat


  • Single Login: Satu sesi per user dengan device fingerprint

  • Anti-Cheat System: Deteksi tab blur, fullscreen enforcement, clipboard disabled

  • Device Binding: IP dan device fingerprint validation

  • Real-time Monitoring: WebSocket proctoring dengan violation detection

  • Auto-lock: Akun terkunci otomatis jika logout saat ujian


📚 Manajemen Soal


  • Import Word (.docx): Parser dokumen Word dengan ekstraksi media

  • Export Excel: Ekspor bank soal ke format Excel

  • Bank Soal: Kategorisasi dan pengelompokan soal

  • Tipe Soal: PG, Multiple Choice, True/False, Esai, Menjodohkan

  • Media Support: Gambar dan audio embedded


📝 Ujian & Penilaian


  • Paket Ujian: Konfigurasi durasi, randomisasi, scoring

  • Timer Server: Sinkronisasi waktu anti-manipulasi

  • Auto-save: Penyimpanan otomatis jawaban setiap 5-10 detik

  • Penilaian Otomatis: Koreksi PG/TrueFalse, manual untuk esai

  • Analitik: Analisa butir soal dan rekap nilai


👥 Role & Akses


  • Admin: Manajemen sistem lengkap

  • Proktor: Monitoring real-time dan kontrol ujian

  • Guru: Manajemen soal dan paket ujian

  • Siswa: Mengikuti ujian dengan interface anti-cheat


🛠️ Teknologi

Backend


  • Node.js dengan Express.js

  • MySQL database dengan Sequelize ORM

  • Socket.IO untuk real-time communication

  • JWT authentication dengan HttpOnly cookies

  • Multer untuk file upload

  • Mammoth untuk parsing Word documents

  • ExcelJS untuk export Excel


Frontend


  • Next.js dengan TypeScript

  • TailwindCSS untuk styling

  • Zustand untuk state management

  • Socket.IO Client untuk WebSocket

  • React Hook Form dengan Zod validation


📁 Struktur Proyek

cbt-ai/
├── backend/ # Express.js backend
│ ├── config/ # Database configuration
│ ├── controllers/ # Route controllers
│ ├── middlewares/ # Authentication & validation
│ ├── models/ # Sequelize models
│ ├── routes/ # API routes
│ ├── services/ # Business logic
│ ├── uploads/ # File uploads
│ └── server.js # Main server file
├── frontend/ # Next.js frontend
│ ├── components/ # React components
│ ├── pages/ # Next.js pages
│ ├── styles/ # CSS & Tailwind
│ └── lib/ # Utilities & API
├── package.json # Root package.json
└── README.md # This file

🚀 Instalasi & Setup

Prerequisites


  • Node.js 18+ dan npm

  • MySQL 8.0+

  • Git


1. Clone Repository


git clone <repository-url>
cd cbt-ai

2. Install Dependencies


npm run install:all

3. Setup Database


# Buat database MySQL
mysql -u root -p
CREATE DATABASE cbt_ai CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
exit

Copy environment file


cp backend/.env.example backend/.env

Edit backend/.env dengan kredensial database


4. Setup Environment Variables


# Backend (.env)
DB_HOST=localhost
DB_PORT=3306
DB_NAME=cbt_ai
DB_USER=root
DB_PASS=your_password

JWT_SECRET=your-super-secret-jwt-key-here
JWT_REFRESH_SECRET=your-super-secret-refresh-key-here

PORT=5000
NODE_ENV=development

5. Database Migration & Seeding


npm run db:migrate
npm run db:seed

6. Start Development Servers


# Start both frontend and backend
npm run dev

Or start separately


npm run dev:backend # Backend on port 5000
npm run dev:frontend # Frontend on port 3000

🗄️ Database Schema

Tabel Utama


  • users: Data pengguna dengan role

  • active_sessions: Sesi aktif untuk single login

  • banks: Bank soal

  • questions: Soal ujian dengan tipe dan media

  • options: Pilihan jawaban

  • exams: Paket ujian

  • exam_sessions: Sesi ujian peserta

  • answers: Jawaban peserta

  • import_jobs: Job import dokumen

  • security_logs: Audit trail keamanan


🔐 API Endpoints

Authentication


  • POST /api/auth/login - User login

  • POST /api/auth/logout - User logout

  • POST /api/auth/refresh - Refresh token

  • GET /api/auth/profile - Get user profile


Bank Soal


  • GET /api/banks - List bank soal

  • POST /api/banks - Create bank soal

  • PUT /api/banks/:id - Update bank soal

  • DELETE /api/banks/:id - Delete bank soal


Soal


  • GET /api/questions - List soal dengan filter

  • POST /api/questions - Create soal

  • POST /api/questions/import/docx - Import dari Word

  • GET /api/questions/export.xlsx - Export ke Excel


Ujian


  • GET /api/exams - List paket ujian

  • POST /api/exams - Create paket ujian

  • POST /api/exam_sessions/:exam_id/start - Mulai ujian

  • POST /api/exam_sessions/:id/answers - Simpan jawaban

  • POST /api/exam_sessions/:id/submit - Submit ujian


Proktor


  • GET /api/proctor/exams/:id/monitor - Monitor ujian real-time

  • POST /api/proctor/sessions/:id/force-submit - Force submit

  • POST /api/proctor/sessions/:id/lock-unlock - Lock/unlock akun


🎯 Alur Kerja Ujian

1. Persiapan Ujian


1. Admin/Guru buat bank soal
2. Import soal dari Word atau input manual
3. Buat paket ujian dengan konfigurasi
4. Jadwalkan ujian dengan token (opsional)

2. Pelaksanaan Ujian


1. Siswa login dengan single session
2. Masuk ke halaman ujian dengan anti-cheat
3. Soal di-randomisasi (jika diaktifkan)
4. Auto-save jawaban setiap 5-10 detik
5. Timer sinkron dengan server
6. Deteksi pelanggaran real-time

3. Monitoring & Kontrol


1. Proktor monitor via WebSocket real-time
2. Deteksi violation (tab blur, exit fullscreen)
3. Force submit jika diperlukan
4. Lock akun jika ada pelanggaran serius

4. Penilaian & Analitik


1. Koreksi otomatis untuk PG/TrueFalse
2. Penilaian manual untuk esai
3. Analisa butir soal
4. Export nilai ke Excel

🛡️ Fitur Anti-Cheat

Client-Side Protection


  • Fullscreen Enforcement: Kiosk mode saat ujian

  • Tab Blur Detection: Deteksi jika tab tidak fokus

  • Clipboard Disabled: Copy-paste diblokir

  • Right-Click Disabled: Context menu diblokir

  • Print Screen Warning: Peringatan screenshot

  • Keyboard Trap: Mencegah keluar dari ujian


Server-Side Protection


  • Device Fingerprinting: Identifikasi unik per device

  • IP Binding: Validasi IP address

  • Session Monitoring: Heartbeat dan violation tracking

  • Real-time Proctoring: WebSocket monitoring


📱 Interface Ujian

Halaman Ujian


  • Fullscreen Mode: Anti-cheat aktif

  • Question Panel: Tampilan soal dengan media

  • Navigation: Navigasi antar soal

  • Timer: Countdown sinkron server

  • Answer Panel: Input jawaban sesuai tipe soal

  • Marking: Penanda soal ragu-ragu


Dashboard Peserta


  • Jadwal Ujian: Ujian yang tersedia

  • Status Ujian: Progress dan hasil

  • History: Riwayat ujian sebelumnya


🔧 Konfigurasi

Anti-Cheat Settings


// WebSocket heartbeat interval
WS_HEARTBEAT_INTERVAL=10000 // 10 seconds

// Violation threshold
WS_VIOLATION_THRESHOLD=5 // Auto-submit after 5 violations

// File upload limits
MAX_FILE_SIZE=10485760 // 10MB for images
MAX_AUDIO_SIZE=20971520 // 20MB for audio

Database Connection


// Connection pool settings
pool: {
max: 5, // Maximum connections
min: 0, // Minimum connections
acquire: 30000, // Connection acquire timeout
idle: 10000 // Connection idle timeout
}

🚀 Deployment

Production Environment


# Build frontend
cd frontend
npm run build

Set production environment


NODE_ENV=production
DB_HOST=your_production_db_host
JWT_SECRET=your_production_jwt_secret

Start production server


npm start

Docker (Optional)


# Backend Dockerfile
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 5000
CMD ["npm", "start"]

🧪 Testing

Backend Testing


cd backend
npm test

Frontend Testing


cd frontend
npm test

E2E Testing


npm run test:e2e

📊 Monitoring & Logging

Security Logs


  • Login/logout attempts

  • Violation detection

  • Admin actions

  • System events


Performance Monitoring


  • Database query performance

  • API response times

  • WebSocket connection status

  • File upload metrics


🤝 Contributing

1. Fork repository
2. Create feature branch (git checkout -b feature/amazing-feature)
3. Commit changes (git commit -m 'Add amazing feature')
4. Push to branch (git push origin feature/amazing-feature)
5. Open Pull Request

📄 License

Distributed under the MIT License. See LICENSE for more information.

📞 Support

  • Email: support@cbt-ai.com



🙏 Acknowledgments

  • Express.js team untuk framework backend

  • Next.js team untuk React framework

  • TailwindCSS team untuk utility-first CSS

  • MySQL team untuk database system


---

CBT AI - Modern Computer Based Test System with Anti-Cheat Technology

Repository metadata

Owner
TEGAR-SRC
Primary language
TypeScript
License
Not declared
Created
Aug 19, 2025
Last pushed
Aug 20, 2025
Last updated
Aug 20, 2025

Clone this repository

HTTPS

git clone https://github.com/TEGAR-SRC/batam-cbt.git

SSH

git clone git@github.com:TEGAR-SRC/batam-cbt.git

More TypeScript repositories