Skip to main content

Directory Overview

The Zarna frontend follows a structured, modular organization:

Directory Guidelines

src/components/

Component organization by purpose:

ui/ - shadcn/ui Components

🚨 DO NOT MANUALLY EDIT - Generated by shadcn CLI
Adding components:

layout/ - Layout Components

Reusable layout components:

features/ - Feature Components

Domain-specific components organized by feature:

src/context/

React Context for global state:
Current Contexts:
  • AuthContext - Authentication state
  • CompanyContext - Current company selection

src/hooks/

Custom React hooks for reusable logic:
Example hook:

src/lib/

Pure utility functions (no React dependencies):

src/services/

API integration and external service calls:

public/

Static assets served as-is:
Usage:

File Naming Conventions

Components

  • PascalCase: ComponentName.tsx
  • Examples: Button.tsx, UserProfile.tsx, DealPipeline.tsx

Hooks

  • kebab-case: use-hook-name.ts
  • Examples: use-auth.ts, use-mobile.ts, use-debounce.ts

Utilities

  • kebab-case: util-name.ts
  • Examples: format-date.ts, api-client.ts, validation.ts

Context

  • PascalCase: ContextName.tsx
  • Examples: AuthContext.tsx, ThemeContext.tsx

Types

  • PascalCase: TypeName.ts or inline in component files
  • Examples: types.ts, api-types.ts

Import Organization

Order imports for consistency:

Path Aliases

Configured in tsconfig.json:
Usage:

Configuration Files

tsconfig.json

TypeScript configuration with strict mode:

vite.config.ts

Vite build configuration:

tailwind.config.js

Tailwind CSS configuration:

components.json

shadcn/ui configuration:

Best Practices

Component Organization

Each component should have a single responsibility. If a component does too much, split it.
Group related components by feature rather than type.
Move common logic to custom hooks or utility functions.

Naming Conventions

  • Be descriptive: UserProfileCard > Card
  • Be consistent: Always use PascalCase for components
  • Prefix hooks: Always start with use (e.g., useAuth)
  • Suffix contexts: End with Context (e.g., AuthContext)

Next Steps

Components Guide

Learn component patterns and architecture

Theme System

Understand the color system and theming

Best Practices

Follow coding standards

Tech Stack

Explore all technologies