Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

41 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

JSCraft

Platform belajar JavaScript interaktif untuk developer Indonesia

JSCraft Banner

TypeScript React Node.js License: MIT CI

Overview ยท Tech Stack ยท Quick Start ยท Structure ยท API ยท Deployment ยท Roadmap


Overview

JSCraft adalah platform EdTech full-stack untuk belajar JavaScript โ€” dari nol sampai siap kerja. Terinspirasi dari freeCodeCamp, Codecademy, dan Scrimba, dengan UI modern dan konten dalam Bahasa Indonesia.

Dashboard dengan progress tracker, XP system, dan streak calendar

Features

Belajar Gamifikasi Platform
42 hari kurikulum terstruktur Sistem XP, level & streak Auth JWT + refresh token rotation
Live code editor (Monaco) Kuis interaktif + leaderboard Role-based access (Student / Admin)
Latihan dengan test cases Verifiable certificates Dark / Light mode
AI coding assistant (Claude) Dashboard progress visual Responsive mobile-first

Live code editor (Monaco)1 ย ยทย  Sistem kuis interaktif


Tech Stack

Layer Technology
Frontend React 18, Vite 5, TypeScript 5
Styling Tailwind CSS v3 + custom design tokens
State Zustand v4 (persist + devtools)
Animation Framer Motion
Editor Monaco Editor (VS Code engine)
Routing React Router v6
Backend Node.js 20, Express 4, TypeScript
Database PostgreSQL + Prisma ORM
Auth JWT โ€” RS256 access token + opaque refresh (httpOnly cookie)
Email Nodemailer (Resend / SMTP)
AI Anthropic Claude API
Monorepo Turborepo + npm workspaces
CI/CD GitHub Actions โ†’ Vercel (web) + Railway (API)

Quick Start

Prerequisites

  • Node.js >= 20.0.0
  • PostgreSQL >= 15
  • npm >= 10.0.0

1. Clone & Install

git clone https://github.com/Jouqio/JSCraft.git
cd jscraft
npm install

2. Environment Setup

# API
cp apps/api/.env.example apps/api/.env

# Web
cp apps/web/.env.example apps/web/.env

Edit apps/api/.env dan isi nilai berikut:

DATABASE_URL=postgresql://user:password@localhost:5432/jscraft
JWT_ACCESS_SECRET=<generated-secret>
JWT_REFRESH_SECRET=<generated-secret>

3. Generate JWT Secrets

# Jalankan dua kali โ€” satu untuk ACCESS, satu untuk REFRESH
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"

4. Database Setup

cd apps/api

npx prisma migrate dev --name init
npx prisma generate
npm run db:seed        # Membuat demo users + konten Week 1

5. Start Development

# Dari root project โ€” menjalankan web (5173) dan api (3000) sekaligus
npm run dev
Service URL
Web http://localhost:5173
API http://localhost:3000/v1
Prisma Studio http://localhost:5555

Jalankan npm run db:studio untuk membuka Prisma Studio.

Demo Accounts

Role Email Password
Admin admin@jscraft.dev Admin@123456
Student budi@example.com Student@123

Project Structure

jscraft/                          # Turborepo monorepo root
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ images/                   # Screenshot dan aset README
โ”‚       โ”œโ”€โ”€ banner.png
โ”‚       โ”œโ”€โ”€ dashboard.png
โ”‚       โ”œโ”€โ”€ editor.png
โ”‚       โ””โ”€โ”€ quiz.png
โ”œโ”€โ”€ apps/
โ”‚   โ”œโ”€โ”€ web/                      # React + Vite frontend (@jscraft/web)
โ”‚   โ”‚   โ””โ”€โ”€ src/
โ”‚   โ”‚       โ”œโ”€โ”€ components/
โ”‚   โ”‚       โ”‚   โ”œโ”€โ”€ ui/           # Button, Input, Badge, Modal, Spinner
โ”‚   โ”‚       โ”‚   โ”œโ”€โ”€ layout/       # Navbar, RootLayout
โ”‚   โ”‚       โ”‚   โ”œโ”€โ”€ editor/       # CodeEditor, ConsoleOutput, RunButton
โ”‚   โ”‚       โ”‚   โ”œโ”€โ”€ lesson/       # QuizBlock
โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ dashboard/    # ProgressRing, XPBar, StreakCalendar
โ”‚   โ”‚       โ”œโ”€โ”€ features/         # Feature-specific logic
โ”‚   โ”‚       โ”œโ”€โ”€ hooks/            # useAuth, useProgress, useEditor, ...
โ”‚   โ”‚       โ”œโ”€โ”€ lib/              # api.ts, utils.ts, xp.ts, validators.ts
โ”‚   โ”‚       โ”œโ”€โ”€ pages/            # Route-level page components
โ”‚   โ”‚       โ”œโ”€โ”€ router/           # Router config + guards
โ”‚   โ”‚       โ”œโ”€โ”€ store/            # Zustand stores (auth, progress, editor, theme)
โ”‚   โ”‚       โ””โ”€โ”€ styles/           # globals.css (Tailwind + design tokens)
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ api/                      # Express + Prisma backend (@jscraft/api)
โ”‚       โ”œโ”€โ”€ prisma/               # schema.prisma + seed.ts + migrations/
โ”‚       โ””โ”€โ”€ src/
โ”‚           โ”œโ”€โ”€ config/           # env.ts (Zod), database.ts (Prisma)
โ”‚           โ”œโ”€โ”€ middleware/       # auth.ts, errorHandler.ts, rateLimit.ts, validate.ts
โ”‚           โ”œโ”€โ”€ routes/           # auth, courses, progress, quiz, exercises, profile, admin, ai
โ”‚           โ”œโ”€โ”€ services/         # authService, xpService, streakService, progressService, emailService
โ”‚           โ”œโ”€โ”€ utils/            # response.ts, crypto.ts
โ”‚           โ””โ”€โ”€ server.ts         # Express app + graceful shutdown
โ”‚
โ””โ”€โ”€ packages/
    โ”œโ”€โ”€ types/                    # Shared TypeScript types (@jscraft/types)
    โ””โ”€โ”€ content/                  # Lesson MDX content files (@jscraft/content)

Database Schema

Key models in apps/api/prisma/schema.prisma:

Model Description
User Auth, XP, level, streak
Course โ†’ Lesson Content as JSON, starterCode, solutionCode
Progress Per user/lesson, unique constraint
Quiz โ†’ Question โ†’ QuizAttempt Graded answers
Exercise Test cases + submissions
Achievement โ†’ UserAchievement Many-to-many
Session Refresh token store, rotated on each use
Certificate Verifiable via unique code

API Reference

Base URL: http://localhost:3000/v1

Auth
Method Endpoint Auth Description
POST /auth/register โ€” Register + set refresh cookie
POST /auth/login โ€” Login + set refresh cookie
POST /auth/refresh cookie Rotate refresh token
POST /auth/logout cookie Revoke session
GET /auth/me Bearer Current user
Courses & Progress
Method Endpoint Auth Description
GET /courses optional All published courses
GET /courses/:slug optional Course with lessons
GET /courses/:slug/lessons/:id optional Lesson + quiz + exercises
POST /progress/:lessonId/start Bearer Mark in-progress
POST /progress/:lessonId/complete Bearer Mark complete + award XP
GET /progress Bearer Full progress map
GET /progress/streak Bearer Streak info
Quiz, Profile & AI
Method Endpoint Auth Description
GET /quiz/:lessonId Bearer Quiz (answers hidden)
POST /quiz/:id/attempt Bearer Submit + grade answers
GET /quiz/leaderboard โ€” Top 50 by XP
GET /profile/:username optional Public profile
PATCH /profile Bearer Update own profile
POST /ai/hint Bearer AI hint / explain / review
Admin
Method Endpoint Auth Description
GET /admin/stats Admin Platform stats
GET /admin/users Admin Paginated user list
POST /admin/courses Admin Create course
POST /admin/lessons Admin Create lesson

Deployment

Frontend โ†’ Vercel

# Connect GitHub repo ke Vercel, lalu set environment variable:
VITE_API_URL=https://api.jscraft.dev/v1

# Build command:  npm run build --filter=@jscraft/web
# Output dir:     apps/web/dist

Backend โ†’ Railway

# Connect GitHub repo ke Railway
# Set semua env vars dari apps/api/.env.example
# Railway otomatis menjalankan: npm run start --filter=@jscraft/api

Database โ†’ Railway PostgreSQL

# Tambahkan PostgreSQL plugin di Railway
# Salin DATABASE_URL ke env vars API service
# Prisma migrations berjalan otomatis via:
# RAILWAY_RUN_UID=0 npx prisma migrate deploy

Security

  • Passwords โ€” bcrypt (cost 12)
  • JWT โ€” opaque refresh token in httpOnly cookie; signed access token (15 min)
  • Refresh rotation โ€” setiap penggunaan menghasilkan token pair baru
  • Code execution โ€” iframe sandbox (allow-scripts only, no DOM access)
  • Rate limiting โ€” 100 req/15min global, 10 req/15min pada auth routes
  • Input validation โ€” Zod pada semua API endpoints
  • SQL injection โ€” Prisma parameterized queries
  • Headers โ€” Helmet.js (CSP, HSTS, X-Frame-Options)
  • CORS โ€” origin whitelist only

Roadmap

Phase 1 โ€” Foundation โœ… (Current)

  • Monorepo setup (Turborepo)
  • Full TypeScript frontend + backend
  • Authentication (JWT + refresh rotation)
  • Database schema (Prisma + PostgreSQL)
  • Week 1 curriculum (7 lessons seeded)
  • Lesson page with Monaco editor
  • Sandboxed code execution (iframe)
  • XP + level gamification
  • Streak tracking
  • Quiz system with grading
  • Dashboard with progress visualization
  • Admin panel foundation
  • CI/CD (GitHub Actions)

Phase 2 โ€” Full Curriculum

  • Migrate all 42 lessons from bootcamp repo
  • Exercise test runner (isolated-vm)
  • Email verification + reset password flow
  • Leaderboard (live updates)
  • Certificate PDF generation
  • Notes system per lesson
  • Bookmarks

Phase 3 โ€” AI + Community

  • AI coding assistant (Claude API, streaming)
  • AI code review
  • Community comments per lesson
  • Personalized learning path
  • Playground sharing (public URLs)
  • Multiplayer coding rooms

Contributing

Contributions are welcome! Silakan buka issue terlebih dahulu untuk mendiskusikan perubahan yang ingin dilakukan.

  1. Fork repository ini
  2. Buat feature branch โ€” git checkout -b feat/nama-fitur
  3. Commit perubahan โ€” git commit -m 'feat: tambahkan fitur x'
  4. Push ke branch โ€” git push origin feat/nama-fitur
  5. Buka Pull Request

License

MIT ยฉ 2026 Jouqio

About

๐Ÿ‡ฎ๐Ÿ‡ฉ Interactive JavaScript learning platform for Indonesian developers โ€” with Monaco editor, XP gamification, and AI assistant.

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages