Code Patterns & Conventions
This document outlines the coding patterns, conventions, and best practices used in development at Innox Technologies.
Table of Contents
General Principles
1. Clarity Over Cleverness
// ❌ Bad - Clever but unclear
const u = users?.find(u => u.id === id)?.n ?? 'Unknown';
// ✅ Good - Clear and explicit
const user = users?.find(user => user.id === currentUserId);
const userName = user?.name ?? 'Unknown';2. Explicit Over Implicit
3. Early Returns
TypeScript Conventions
Type Definitions
Type Imports
Strict Typing
Avoid any
anyReact Patterns
Server Components (Default)
Client Components (When Needed)
Component Structure
Props Destructuring
Custom Hooks
Next.js Patterns
Server Components for Data Fetching
Parallel Data Fetching
Dynamic Imports
Server Actions
Standard Server Action Pattern
ActionResult Pattern
Revalidation
Component Patterns
Compound Components
Render Props
Controlled vs Uncontrolled
Styling Conventions
Chakra UI v3 Patterns
Custom Styling
Error Handling
Try-Catch Pattern
Error Boundaries
File Naming
Conventions
Folder Structure
Import Conventions
Order
Absolute Imports
Type Imports
Testing Patterns
Test Structure
Test File Naming
Documentation
JSDoc Comments
Component Documentation
Inline Comments
Best Practices Summary
Do's ✅
Don'ts ❌
Last updated
