This project follows strict TypeScript/Node.js/React development principles with emphasis on functional programming, clean architecture, and type safety.
- Business logic completely outside components and states
- Functional programming approach without classes
- Layer-based project structure
- Maximum TypeScript strictness
- Pragmatic library selection (no rigid stack)
/src/components/- Reusable UI components/src/hooks/- Custom React hooks (rarely used)/src/services/- API and external services/src/stores/- Nanostores state management/src/utils/- Pure utility functions/src/types/- TypeScript type definitions- Business domain types separately
- UI types next to components
- Shared types in dedicated files
- Frontend: React with Nanostores
- Backend: NestJS or Fastify
- Validation: Zod schema validation
- Testing: Vitest for unit tests
- Linting: ESLint + Prettier
- No Husky/lint-staged - rely on CI and manual checks
- Complete ban on
anytype - Rare use of
unknowntype - Prefer
enumover union types - Maximum strict compiler flags
- Consistent use of
typevsinterface(choose one per project) - No barrel files - use explicit relative imports
- Only function components with hooks
- Business logic in pure functions and services
- State management with Nanostores
- Rare custom hooks - prefer pure functions
- Self-documenting code over comments
- JSDoc only for complex algorithms or public APIs
- Explicit error handling with try/catch in each handler
- Async/await everywhere possible
- Pure functions for business logic
- Zod validation for all incoming data
- Self-documenting code as primary approach
- Clear naming for variables and functions
- Single responsibility for functions and components
- Unit tests for functions and services with Vitest
- Pure function testing without side effects
// BUSINESS LOGIC OUTSIDE COMPONENTS
const CartTotal = () => {
const items = useStore($cartItems);
const total = calculateTotal(items); // Pure function
return <div>Total: {total}</div>;
};
// NO ANY, EXPLICIT TYPING
function processData(data: unknown) {
if (typeof data === 'string') {
return data.toUpperCase();
}
return '';
}
// CLEAN SELF-DOCUMENTING CODE
const isUserActive = user.status === UserStatus.ACTIVE;- Unit tests for functions and services only
- Vitest framework (not Jest)
- Mock dependencies for service testing
- Pure function testing without side effects
- Prefer self-documenting code over comments
- JSDoc only when absolutely necessary
- Clear, descriptive function and variable names
- No redundant comments for obvious code