This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Kelas Rumah Berbagi is an online course platform for Rumah Berbagi, built with Remix framework. The project enables users to purchase and access online courses with features for authentication, course management, and transactions.
npm run dev # Start development server (uses dev.db)
npm run prod # Start dev server with prod.db
npm run build # Build for production
npm run start # Start production serverThe development server runs on http://localhost:3000
# Unit tests (Jest)
npm test # Run tests (coverage in CI, standard run locally)
npm run test:coverage # Run tests with coverage report
npm run test:watch # Run tests in watch mode
npm run test:debug # Debug tests with Node inspector
# E2E tests (Playwright)
npm run test:e2e # Run Playwright tests (requires server)
npm run test:e2e:run # Build, start server, and run E2E tests
npm run test:e2e:dev # Run E2E tests against dev serverPlaywright runs tests across multiple browsers/devices: Pixel 4 (Chromium), iPhone 11 (WebKit), Desktop Firefox, Desktop Safari, and Desktop Chrome with JS disabled.
npm run lint # Lint JS/TS/YAML files with ESLint
npm run lint:fix # Auto-fix linting issues
npm run format # Format code with Prettier
npm run type-check # TypeScript type checkingThe project uses two Prisma schemas:
prisma/schema.prisma- MySQL schema (original)prisma/schema.sqlite.prisma- SQLite schema (current)
Always specify --schema=./prisma/schema.sqlite.prisma for local
development.
# Development database (dev.db)
npm run dev # Auto-generates Prisma client for dev.db
# Production database (prod.db) - from MySQL dumps
npm run prod # Auto-generates Prisma client for prod.db
# Database management
npx prisma studio --schema=./prisma/schema.sqlite.prisma # Open Prisma Studio
npx prisma db push --schema=./prisma/schema.sqlite.prisma # Push schema changes
npx prisma migrate dev --name <name> --schema=./prisma/schema.sqlite.prisma # Create migration
npx prisma migrate reset --force --schema=./prisma/schema.sqlite.prisma # Reset DB and run seed
npx prisma generate --schema=./prisma/schema.sqlite.prisma # Generate Prisma ClientThree SQLite databases:
prisma/dev.db- Development database (auto-generated)prisma/test.db- Testing database (E2E tests)prisma/prod.db- Production data migrated from MySQL dumps
npm run setup # Install deps, reset DB, run E2E tests
npm run presetup # Install Playwright browser dependencies- Framework: Remix v1.2.2 (React 17, TypeScript)
- Styling: Tailwind CSS v3 with Headless UI components
- Database: SQLite with Prisma ORM v3.10.0
- Authentication: remix-auth with email magic link (remix-auth-email-link)
- Testing: Jest (unit), Playwright (E2E), MSW (API mocking)
- Deployment: Vercel (configured with
remix.config.js)
The data model follows this hierarchy:
User (email-based auth, roles)
├── Course[] (as author)
│ ├── Chapter[]
│ │ └── Lesson[]
│ │ └── Attachment[]
│ ├── Subscription[]
│ └── Transaction[]
├── Subscription[] (as subscriber)
└── Transaction[] (as purchaser)Key models:
- User: Email, name, contact info (phone/telegram/instagram), role
- Course: Name, description, price, image, category (belongs to User author)
- Chapter: Name, order (belongs to Course)
- Lesson: Name, description, videoId, order (belongs to Chapter, has Attachments)
- Subscription: Links User to Course with status (approved author can see subscriber)
- Transaction: Payment tracking (bankName, bankAccountNumber, amount, datetime, status, notes)
All models use UUID primary keys and have createdAt/updatedAt timestamps.
app/
├── components/ # React components (organized by feature)
├── contexts/ # React contexts
├── models/ # Prisma model utilities and queries
├── routes/ # Remix file-based routing
│ ├── index.tsx # Homepage
│ ├── login.tsx # Email login
│ ├── magic.tsx # Magic link handler
│ ├── logout.tsx # Logout
│ └── dashboard/ # Protected dashboard routes
├── services/ # Business logic (auth, email, session, verifier)
├── utils/ # Utility functions
└── root.tsx # Root layout
prisma/
├── schema.prisma # MySQL schema (original)
├── schema.sqlite.prisma # SQLite schema (current)
├── migrations/ # Migration files
├── seed.ts # Seed data script
├── dumps/ # Database dumps (gitignored)
│ ├── main/ # Original MySQL dumps
│ └── prod/ # Converted SQLite dumps
├── dev.db # Development database
├── test.db # Testing database
└── prod.db # Production database
e2e/ # Playwright E2E tests
├── fixtures/ # Test fixtures and data builders
└── *.spec.ts # Test specs
scripts/ # Utility scripts
└── convert-mysql-dumps.js # MySQL to SQLite dump converterUses remix-auth with email magic link strategy:
- User enters email on
/login - System sends magic link via email
- User clicks link, redirected to
/magic?code=... - System verifies code and creates session
- User redirected to
/dashboard
Session managed via cookies (see app/services/session.server.ts).
/- Public homepage/login- Email authentication/magic- Magic link verification/logout- Session termination/dashboard- Protected area (requires auth)- Nested routes for course management, profile, transactions, etc.
The project recently migrated from MySQL to SQLite. The conversion process:
- Export MySQL dumps to
prisma/dumps/main/ - Run
node scripts/convert-mysql-dumps.jsto convert syntax - Create SQLite schema with Prisma
- Import converted dumps in dependency order
Key conversions:
- Backticks → double quotes
- DateTime format:
YYYY-MM-DD HH:MM:SS.mmm→YYYY-MM-DDTHH:MM:SS.mmmZ - Remove MySQL-specific syntax (ENGINE, CHARSET, COLLATE)
- Quote reserved keywords (
order,Transaction)
See docs/database-migration.md for full details.
This project uses Conventional Commits with commitlint. All commits MUST follow this format:
<type>[optional scope]: <description>Types: build, chore, docs, feat, fix, perf, refactor, style,
test
Scopes: assets, ci, cms, components, cypress, deps, dx, e2e,
fetcher, pages, security, seo, ui
Component scopes: donasi, education, home, json-ld, kontak-darurat,
layout, telemedicine
Use commitlint.io if needed for assistance.
When creating PRs, follow .github/pull_request_template.md:
Closes #<issue-number>
## Description
<!-- Implementation plan and approach -->
## Current Tasks
- [ ] Task 1
- [ ] Task 2Important: Never add Claude co-authorship to commit messages per user's global instructions.
- Unit tests: Jest with Testing Library for components and utilities
- E2E tests: Playwright for user flows across multiple browsers
- Fixtures: Use
@jackfranklin/test-data-botfor test data generation - Mocking: MSW for API mocking (work in progress)
Pre-commit hooks run:
- Jest tests on related files
- ESLint with auto-fix
- Prettier formatting
- ESLint configured for TypeScript, React, JSX a11y, Playwright
- Prettier for formatting
- Tailwind CSS for styling (no CSS modules)
- Database schema: Always use
schema.sqlite.prismawith--schemaflag for local work - Environment: Copy
.env.exampleto.envbefore starting - Node version: Requires Node.js >= 14
- Git hooks: Husky manages pre-commit hooks for linting and testing
- Deployment: Configured for Vercel (see
remix.config.jsandvercel.json) - GitHub Projects: Issues tracked on rbagi.id/board
- Language: Use English for all issues and PRs
This project uses bd (beads) for issue tracking. Run bd onboard to get
started.
bd ready # Find available work
bd show <id> # View issue details
bd update <id> --status in_progress # Claim work
bd comments add <id> # Add comment
bd close <id> # Complete work
bd sync # Sync with gitWhen ending a work session, you MUST complete ALL steps below. Work is NOT
complete until git push succeeds.
MANDATORY WORKFLOW:
-
File issues for remaining work - Create issues for anything that needs follow-up
-
Run quality gates (if code changed) - Tests, linters, builds
-
Commit changes - Stage and commit all related code changes
-
Update issue status - Close finished work, update in-progress items
-
PUSH TO REMOTE - This is MANDATORY:
git pull --rebase bd sync git push git status # MUST show "up to date with origin" -
Clean up - Clear stashes, prune remote branches
-
Verify - All changes committed AND pushed
-
Hand off - Provide context for next session
CRITICAL RULES:
- Work is NOT complete until
git pushsucceeds - NEVER stop before pushing - that leaves work stranded locally
- NEVER say "ready to push when you are" - YOU must push
- If push fails, resolve and retry until it succeeds
| Type | Description |
|---|---|
| bug | Software defect or error |
| feature | New functionality or enhancement |
| task | General work item (default) |
| epic | Large multi-step initiative |
| chore | Maintenance or operational work |
| message | Ephemeral inter-agent communication |
| merge-request | Code review queue entry |
| molecule | Workflow template or hierarchy |
| gate | Async coordination primitive |
| Type | Category | Description |
|---|---|---|
| blocks | Workflow | Hard blocker relationship |
| parent-child | Workflow | Hierarchical relationship |
| conditional-blocks | Workflow | B runs only if A fails |
| waits-for | Workflow | Fanout gate: wait for dynamic children |
| related | Association | Soft relationship |
| discovered-from | Association | Track issues found during work |
| replies-to | Graph Link | Conversation threading |
| relates-to | Graph Link | Loose knowledge graph edges |
| duplicates | Graph Link | Deduplication link |
| supersedes | Graph Link | Version chain link |
| authored-by | Entity | Creator relationship |
| assigned-to | Entity | Assignment relationship |
| approved-by | Entity | Approval relationship |
This project uses
beads_viewer for issue
tracking. Issues are stored in .beads/ and tracked in git.
# View issues (launches TUI - avoid in automated sessions)
bv
# CLI commands for agents (use these instead)
bd ready # Show issues ready to work (no blockers)
bd list --status=open # All open issues
bd show <id> # Full issue details with dependencies
bd create --title="..." --type=task --priority=2
bd update <id> --status=in_progress
bd close <id> --reason="Completed"
bd close <id1> <id2> # Close multiple issues at once
bd sync # Commit and push changes- Start: Run
bd readyto find actionable work - Claim: Use
bd update <id> --status=in_progress - Work: Implement the task
- Test: Test your changes thoroughly, including running all tests and linters
- Commit: Stage and commit code changes
- Complete: Use
bd close <id> - Sync: Always run
bd syncat session end
- Dependencies: Issues can block other issues.
bd readyshows only unblocked work. - Priority: P0=critical, P1=high, P2=medium, P3=low, P4=backlog (use numbers, not words)
- Types: task, bug, feature, epic, question, docs
- Blocking:
bd dep add <issue> <depends-on>to add dependencies
Before ending any session, run this checklist:
git status # Check what changed
git add <files> # Stage code changes
bd sync # Commit beads changes
git commit -m "..." # Commit code
bd sync # Commit any new beads changes
git push # Push to remote- Check
bd readyat session start to find available work - Update status as you work (in_progress → closed)
- Create new issues with
bd createwhen you discover tasks - Use descriptive titles and set appropriate priority/type
- Always
bd syncbefore ending session