General Principles
Functional Components
Only functional components, no class components
Named Exports
No default exports, always use named exports
Type Safety
Strict TypeScript, no
any types allowedComposition Over Inheritance
Prefer composition patterns
TypeScript
Types Over Interfaces
Usetype instead of interface (except when extending third-party interfaces):
No Any Types
Never useany. Use proper types or unknown:
String Literals Over Enums
Use string literal types instead of enums (except for GraphQL enums):Generic Type Names
Use descriptive names for generics:Naming Conventions
Variables and Functions
UsecamelCase:
Constants
UseSCREAMING_SNAKE_CASE:
Types and Classes
UsePascalCase:
Component Props
Suffix withProps:
Files and Directories
Usekebab-case with descriptive suffixes:
No Abbreviations
Use full words, not abbreviations:React Components
Functional Components Only
Named Exports Only
Event Handlers Over useEffect
Prefer event handlers for user interactions:Props Down, Events Up
Unidirectional data flow:File Organization
Component Structure
Barrel Exports
Useindex.ts for clean imports:
Import Order
- External libraries
- Internal (
@/imports) - Relative imports
File Size Limits
- Components - Under 300 lines
- Services - Under 500 lines
- Split large files into smaller, focused modules
Comments
Use Short-Form Comments
Explain WHY, Not WHAT
No Obvious Comments
Multi-Line Comments
State Management
Jotai for Global State
Component State with Hooks
Functional State Updates
Utility Functions
Use Existing Helpers
Twenty provides utility helpers intwenty-shared:
Error Handling
Testing
See the Testing Guide for detailed testing conventions.Linting and Formatting
Run Before Committing
Prettier Configuration
Prettier runs automatically. Configuration:ESLint Rules
Key ESLint rules enforced:- No
anytypes - No unused variables
- No default exports
- Functional components only
- Named exports only
- Consistent import order
Backend (NestJS)
Module Structure
Service Pattern
Entity Pattern
Database Migrations
Migration Names
Use kebab-case descriptive names:Migration Structure
Performance
Frontend Optimization
Backend Optimization
Security
Next Steps
Testing Guide
Write and run tests
Getting Started
Start contributing
Local Setup
Set up dev environment
Architecture
Understand the codebase
