Skip to main content

Engineering Standards

Baseline engineering standards for the TrickBook project. These apply to all repositories (TrickList, Backend, Website, Docs) and must be in place before any new feature work.

Current State

StandardTrickList (Mobile)BackendWebsite (NextJS)Docs
Linting & FormattingBiomeBiomeBiomeBiome
Testing0 tests / 98+ files0 tests / 24 route filesNoneN/A
Pre-commit HooksHusky + lint-stagedHusky + lint-stagedHusky + lint-stagedHusky + lint-staged
CI/CD PipelineGitHub Actions (lint + typecheck) + EASGitHub Actions (lint) + PM2 deployGitHub Actions (lint + build)GitHub Actions (lint + typecheck + build + deploy)
Error BoundaryNoneNo global handlerNoneN/A
Error TrackingNoneNoneNoneN/A
Structured Loggingconsole.log (warnings)console.log (410+ calls)console.log (warnings)N/A
API Response ValidationZod in 2 files onlyJoi in 8/24 routesNoneN/A
.env.example.env.example.env.example.env.exampleN/A
TypeScript StrictBasic strict: trueNo TypeScriptNo TypeScriptBasic strict: true
DockerN/AMissingN/AN/A
Health CheckN/AMissingN/AN/A

Implementation Order

These standards should be implemented in this exact order. Each builds on the previous.

Phase 1: Code Quality Foundation (Day 1)

  1. Biome (Lint + Format) - Single tool for both repos
  2. Pre-commit Hooks - Prevent bad code from entering the repo

Phase 2: Safety Net (Day 1-2)

  1. Error Handling - Error boundaries (mobile) + global handler (backend)
  2. Error Tracking (Sentry) - Know when production breaks

Phase 3: Testing (Day 2-3)

  1. Testing Strategy - Start with critical paths, expand outward

Phase 4: Automation (Day 3)

  1. CI/CD Pipeline - Automated quality gates on every PR
  2. Structured Logging - Replace console.log everywhere

Phase 5: Cleanup (Day 4)

  1. Code Quality - Remove dead deps, consolidate libraries, validate API responses

Standards Per Repository

TrickList (Mobile)

TrickList/
├── biome.json # Lint + format config
├── .husky/
│ └── pre-commit # Runs: biome check --staged
├── src/
│ ├── components/
│ │ ├── Button.tsx
│ │ └── Button.test.tsx # Colocated tests
│ ├── lib/
│ │ ├── api/
│ │ │ ├── client.ts
│ │ │ └── client.test.ts
│ │ └── stores/
│ │ ├── authStore.ts
│ │ └── authStore.test.ts
│ └── app/
│ └── _layout.tsx # ErrorBoundary wraps root
├── .env.example # Template for required vars
└── package.json # Scripts: lint, test, typecheck, validate

Backend

Backend/
├── biome.json
├── .husky/
│ └── pre-commit
├── Dockerfile
├── docker-compose.yml
├── middleware/
│ ├── errorHandler.js # Global error handler
│ └── rateLimiter.js
├── __tests__/ # Or colocated
│ ├── auth.test.js
│ └── users.test.js
├── .env.example
└── package.json # Scripts: lint, test, validate

Website (NextJS)

TrickBookWebsite/
├── biome.json # Lint + format config (JS, CSS Modules, Tailwind)
├── .husky/
│ └── pre-commit # Runs: lint-staged
├── pages/ # Next.js page routes
├── components/ # React components
├── lib/ # Utilities and API calls
├── styles/ # CSS Modules + Tailwind
├── .env.example # Template for required vars
└── package.json # Scripts: lint, format, validate

Package.json Scripts (All Repos)

Every repo must have these scripts:

{
"scripts": {
"lint": "biome check .",
"lint:fix": "biome check --write .",
"format": "biome format --write .",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"typecheck": "tsc --noEmit",
"validate": "biome check . && tsc --noEmit && jest"
}
}

The validate script runs everything. CI runs validate. Pre-commit runs biome check --staged.