This project follows strict coding standards to ensure maintainability and consistency.
- Language: TypeScript (strict mode recommended).
- Target: ES2020 or higher.
We use Prettier for code formatting.
- Indentation: 2 spaces.
- Quotes: Double quotes (
") preferred. - Semicolons: Always used.
- Use
camelCase. - Functions should be verbs (e.g.,
createUser,getThread). - Booleans should be prefixed (e.g.,
isActive,hasPermission).
- Use
camelCaseorkebab-caseconsistently. - Classes/Components (if any) should be
PascalCase.
- Prisma models use
PascalCase(e.g.,User,Thread). - Database table mapping is usually lowercase (e.g.,
@@map("user")).
- Controllers: Handle HTTP headers, status codes, and input parsing. Do not put business logic here.
- Services: Handle business logic, database calls, and external API calls.
- Utils: Pure functions and helpers.
- Use
try/catchblocks in Controllers. - Pass errors to the global error handling middleware using
next(err). - Do not fail silently.
(If configured) Run linting before committing:
npm run lint