Skip to content

Code Style

  • strict: true everywhere — tsc --noEmit must report 0 errors.
  • No any without justification — prefer unknown + type guards.
  • No @ts-ignore — use @ts-expect-error with a reason.
  • Use consistent-type-imports.
  • Write compact code: collapse duplicate branches, avoid needless nesting, share abstractions instead of copy-pasting.
  • Match the existing style of the file/module you are editing — look at neighboring code before introducing new patterns.

Every source file must begin with the property header:

// ==============================================================================
// Property of Ralf Carsjens - All Rights Reserved.
// Proprietary and Confidential.
// Unauthorized copying of this file, via any medium, is strictly prohibited.
// Standard: ISO 27001 Compliance | Security-First | Modular API Architecture
// ==============================================================================

Exceptions: standard JSON files (package.json, tsconfig.json), generated files (dist/, .next/, node_modules/), lockfiles.

  • Code, identifiers, and code comments: English.
  • User-facing UI strings: via next-intl messages (German default).
  • Explanations and documentation for the owner: German; developer-facing technical documentation (this site): English.
  • Handle errors at meaningful boundaries — not every line needs a try/catch. Follow the error-handling style of the surrounding code.
  • Throw specific error classes; the global exception filter maps them to TT-xxx codes — see Error Codes.
  • Every API endpoint validates input (DTOs + class-validator).
  • No string interpolation in SQL — parameterized queries / Prisma only.
  • File operations on user input require path sanitization.
  • No eval() or dynamic code execution. No dangerouslySetInnerHTML except sanitized/static content.
  • No PII in logs — no emails, names, addresses in logger.* output or test output.
  • A setup() function per spec file encapsulates wiring (no shared beforeEach state).
  • Assert specific error classes: rejects.toThrow(SpecificError).
  • Verify tenant isolation in every service test.
  • No any in tests except where strictly needed for mocks.
  • No PII in fixtures — synthetic UUIDs, example.com addresses.