Skip to content

Latest commit

 

History

History
92 lines (71 loc) · 3.04 KB

File metadata and controls

92 lines (71 loc) · 3.04 KB

Contributing to ShelfTrade

Thank you for your interest in contributing to ShelfTrade! This guide will help you get started.

Prerequisites

  • Node.js 20 (see .nvmrc) — use nvm to install
  • npm (comes with Node.js)

Getting Started

# Clone the repository
git clone https://github.com/your-org/shelftrade.git
cd shelftrade

# Install dependencies
npm install

# Start the development server
npm run dev

The app will be available at http://localhost:3000. A local SQLite database (shelftrade.db) is created automatically on first run with seed data.

Development Workflow

Available Scripts

Command Description
npm run dev Start development server
npm run build Production build
npm run start Start production server
npm run lint Run ESLint
npm run typecheck Run TypeScript type checker
npm run format Format code with Prettier
npm run format:check Check formatting without modifying files

Before Submitting a PR

  1. Ensure your code passes all checks:

    npm run lint
    npm run typecheck
    npm run format:check
    npm run build
  2. Write clear, descriptive commit messages.

  3. Keep PRs focused — one feature or fix per PR.

Project Structure

src/
├── app/                  # Next.js App Router pages and API routes
│   ├── api/              # REST API endpoints
│   ├── dashboard/        # Private user dashboard
│   ├── games/[id]/       # Game market detail pages
│   ├── listings/         # Listing detail + create wizard
│   ├── marketplace/      # Browse & search listings
│   ├── profile/[username]/ # Public user profiles
│   └── trade/            # Trade matching
├── components/           # React components
│   └── listing-create/   # Multi-step listing wizard steps
├── hooks/                # Custom React hooks
└── lib/                  # Shared logic
    ├── db/               # Database connection, repositories, mappers
    ├── api.ts            # API response helpers and param parsers
    ├── seed.ts           # Seed data for development
    ├── types.ts          # TypeScript interfaces and constants
    └── utils.ts          # Formatting and utility functions

Coding Conventions

  • TypeScript strict mode — no any types, no unsafe casts
  • Parameterized SQL — always use ? or @name bindings, never string interpolation
  • API responses — use jsonSuccess() / jsonError() from @/lib/api for consistent {data, error} shape
  • Input validation — use parseEnum(), parseNumber(), parseEnumArray() from @/lib/api
  • Component files — PascalCase filenames, one component per file
  • Tailwind CSS — use semantic color tokens defined in tailwind.config.ts

Reporting Issues

When filing an issue, please include:

  • Steps to reproduce
  • Expected vs actual behavior
  • Node.js version and OS
  • Browser (if UI-related)