Guides
Code Style Guide
Code Style Guide
Coding standards and best practices for Synap Backend
TypeScript Standards
Type Safety
- ✅ Always use explicit types - No
anytypes - ✅ Use Zod for validation - Runtime type checking
- ✅ Strict mode enabled -
strict: truein tsconfig - ✅ Type inference - Let TypeScript infer when possible
Example
Code Organization
File Structure
Naming Conventions
- Files:
kebab-case.ts - Classes:
PascalCase - Functions:
camelCase - Constants:
UPPER_SNAKE_CASE - Types:
PascalCase
Error Handling
Use SynapError Types
Logging
Structured Logging
Testing
Unit Tests
Documentation
JSDoc Comments
Next: See Testing for testing guidelines.
