Overview
Athena ERP’s frontend is built with React 19, leveraging modern component patterns, TypeScript strict mode, and performance optimizations. The application uses Vite as the build tool for fast development and optimized production builds.Technology Stack
Core Dependencies
Key Libraries
- @tanstack/react-query: Server state management and data fetching
- react-hook-form: Form handling with validation
- @hookform/resolvers + zod: Schema-based form validation
- lucide-react: Icon library
- sonner: Toast notifications
- motion: Animation library
- tailwindcss: Utility-first CSS framework
Project Structure
Component Patterns
React 19 Features
The application uses React 19’s modern features: Strict Mode for development safety:main.tsx
Functional Components with TypeScript
All components use functional components with TypeScript interfaces:components/ui/Button.tsx
forwardReffor ref forwarding- TypeScript interfaces extending native HTML attributes
- Compound variant patterns for styling
cn()utility for conditional class merging (fromtailwind-merge)
Custom Hooks Pattern
Data fetching hooks use React Query for server state:hooks/useStudents.ts
- Automatic caching and background refetching
- Optimistic updates
- Query invalidation
- Loading and error states
Module Architecture
Feature-Based Organization
Modules follow a domain-driven structure:- components/: Module-specific UI components
- hooks/: Module-specific data fetching hooks
- services/: API repository layer
Shared Components
UI components incomponents/ui/ are framework-agnostic and reusable:
- Button: Multi-variant button with loading states
- Card: Container component
- Input: Form input with validation styles
- Modal: Overlay modal component
- Select: Dropdown select component
- Table: Data table component
TypeScript Configuration
tsconfig.json
- ES2022 target: Modern JavaScript features
- react-jsx: React 19’s automatic JSX runtime
- bundler resolution: Vite-compatible module resolution
- Path aliases:
@/maps to project root
Vite Configuration
vite.config.ts
Best Practices
Component Design
- Single Responsibility: Each component has one clear purpose
- Composition over Inheritance: Build complex UIs from simple components
- Props Interfaces: Always define TypeScript interfaces for props
- ForwardRef: Use for components that need DOM refs
Performance Optimization
- React Query Caching: Automatic request deduplication and caching
- Code Splitting: Dynamic imports for routes (via react-router-dom)
- Memoization: Use
useMemoanduseCallbackfor expensive computations - Lazy Loading: Load components on-demand
State Management Strategy
- Server State: React Query (
@tanstack/react-query) - Global State: Zustand (authentication, app-wide settings)
- Local State: React
useStatefor component-specific state - Form State: react-hook-form for complex forms