biohazard-vfx/docs/architecture/coding-standards.md
nicholai f7073fa306
Some checks are pending
Build and Push to Docker Hub / Push Docker image to Docker Hub (push) Waiting to run
Build and Push Docker Image / build-and-push (push) Waiting to run
starting dev
2025-09-24 11:12:09 -06:00

1.1 KiB

Coding Standards

Core Standards

  • Languages & Runtimes: TypeScript 5.9.2, Node.js 20.x LTS
  • Style & Linting: ESLint with Next.js recommended rules, Prettier for formatting
  • Test Organization: Co-located tests with component files (Component.test.tsx)

Critical Rules

  • Never use console.log in production code - use proper logging
  • All database queries must use Prisma client - no direct SQL
  • API responses must follow Next.js patterns - no custom response formats
  • All external inputs must be validated - use Zod schemas
  • Authentication checks required - use session validation middleware
  • Image optimization mandatory - use Next.js Image component
  • Accessibility compliance - follow WCAG 2.1 AA guidelines

Language-Specific Guidelines

TypeScript Specifics

  • Strict Mode: Enable strict TypeScript compiler options
  • Type Safety: Prefer types over interfaces for internal types
  • Null Handling: Use optional chaining and nullish coalescing
  • Async/Await: Always handle promise rejections appropriately