Skip to content

Latest commit

 

History

History
100 lines (75 loc) · 3.2 KB

File metadata and controls

100 lines (75 loc) · 3.2 KB

Contributing to BoardForge

Thank you for your interest in contributing! This guide will help you get from zero to your first PR.

Quick Start

# 1. Fork & clone the repository
git clone https://github.com/<your-username>/board-games.git
cd board-games/03-boardforge

# 2. Use the correct Node.js version
nvm use  # reads .nvmrc → Node 20

# 3. Install dependencies
npm install

# 4. Set up your environment
cp .env.example .env.local

# 5. Start the dev server
npm run dev

# 6. Open http://localhost:3000

The SQLite database is automatically created and seeded with example projects on first run.

Project Structure

src/
├── app/            # Next.js App Router pages & API routes
├── components/     # React components (ui/, editor/, dashboard/, templates/)
├── db/             # Database migrations
├── hooks/          # Custom React hooks
├── lib/            # Core logic (db, reducer, utils, seed data)
└── types/          # Shared TypeScript type definitions

Development Workflow

Scripts

Command Description
npm run dev Start development server with hot reload
npm run build Production build
npm run lint Run ESLint
npm run typecheck Run TypeScript type checking
npm test Run tests with Vitest
npm run format Format code with Prettier
npm run format:check Verify code formatting (CI)
npm start Start production server

Coding Conventions

  • TypeScript: Strict mode is enabled. Avoid any types — use unknown with type guards instead.
  • Styling: Use Tailwind CSS utility classes. Avoid custom CSS unless absolutely necessary.
  • Components: Keep files under 200 lines. Extract logic into hooks or helper functions.
  • State: The editor uses useReducer with a centralized editorReducer. All editor state changes go through dispatch actions.
  • API routes: All database access happens in API route handlers. Client components fetch via fetch().
  • Naming: PascalCase for components, camelCase for functions/variables, SCREAMING_SNAKE for constants.

Commit Messages

Use Conventional Commits:

feat: add layer duplication support
fix: prevent crash when CSV has empty rows
docs: update API route documentation
refactor: extract CardCanvas resize logic into hook

Pull Request Process

  1. Create a feature branch from main: git checkout -b feat/my-feature
  2. Make your changes and ensure:
    • npm run lint passes with no errors
    • npm run build succeeds
    • npm run typecheck passes
    • npm run format:check passes
    • New code follows existing patterns and conventions
  3. Write a clear PR description explaining what and why
  4. Link related issues if applicable

Reporting Bugs

Use the Bug Report issue template. Include:

  • Steps to reproduce
  • Expected vs actual behavior
  • Browser and Node.js version

Suggesting Features

Use the Feature Request issue template. Describe:

  • The problem you're trying to solve
  • Your proposed solution
  • Any alternatives you've considered