Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint-and-test:
runs-on: ubuntu-latest

services:
mongo:
image: mongo:7
ports:
- 27017:27017

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check (lint + format)
run: pnpm check

- name: Build
run: pnpm build

- name: Test
run: pnpm test
env:
DATABASE_URL: mongodb://localhost:27017/test?directConnection=true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package-lock.json
yarn.lock

# Environment variables
packages/api/.env
.env
.env.local
.env.development.local
Expand Down
72 changes: 72 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Full-stack TypeScript monorepo implementing a TryHackMe-inspired learning platform. Built as a technical challenge project demonstrating modern full-stack capabilities.

## Common Commands

```bash
# Development (starts both API on :3001 and Client on :3000)
pnpm dev

# Code quality
pnpm lint # Run Biome linting
pnpm lint:fix # Fix linting issues
pnpm format # Format code with Biome
pnpm check # Run both linting and formatting checks

# Build
pnpm build # Build all packages

# Database (required before running dev)
docker-compose up -d mongo
```

### Package-specific commands

```bash
# API only
cd packages/api && pnpm dev

# Client only
cd packages/client && pnpm dev
```

## Architecture

**Monorepo Structure:** pnpm workspaces + Turborepo for task orchestration

- `packages/api` - Express.js backend with MongoDB
- `packages/client` - React 19 + Vite frontend

**API:** Single endpoint `GET /rooms/:roomCode` returns room data with nested tasks and questions. MongoDB connection via `DATABASE_URL` env var.

**Frontend:** React Router (2 routes: `/` and `/room/:roomCode`), TanStack Query for data fetching with 5-minute stale time.

**Data Flow:** RoomData → Tasks[] → Questions[] hierarchy. Question progress tracks correctness and attempts.

## Code Style

- **Formatter/Linter:** Biome (not ESLint/Prettier)
- **Indentation:** 2 spaces
- **Line width:** 100 characters
- **Language:** TypeScript only (strict mode enabled)

Run `pnpm check` before committing.

## Environment Setup

API requires `.env` file (see `packages/api/.env.sample`):
```
DATABASE_URL=mongodb://localhost:27017/technical-challenge?directConnection=true
PORT=3001
```

## Prerequisites

- Node.js v18+
- pnpm v8+
- Docker v24+ (for MongoDB)
Loading