Architecture
This document describes the high-level architecture of Image Editor.
Project Structure
imageeditor/
├── .github/ # GitHub configuration
│ ├── workflows/ # CI/CD workflows
│ └── ISSUE_TEMPLATE/ # Issue templates
├── docs/ # Documentation (MkDocs)
├── public/ # Static assets
├── src/
│ ├── assets/ # Images, fonts, etc.
│ ├── components/ # React components
│ ├── hooks/ # Custom React hooks
│ ├── styles/ # CSS styles
│ ├── types/ # TypeScript types
│ ├── utils/ # Utility functions
│ ├── App.tsx # Main App component
│ └── main.tsx # Application entry point
├── tests/
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
├── terraform/ # Infrastructure as Code
├── mkdocs.yml # Documentation config
├── package.json
├── tsconfig.json
└── vite.config.ts
Technology Stack
Frontend
| Technology |
Purpose |
| React 19 |
UI framework |
| TypeScript |
Type safety |
| Vite |
Build tool and dev server |
| CSS Modules |
Scoped styling |
Testing
| Technology |
Purpose |
| Vitest |
Test runner |
| React Testing Library |
Component testing |
| jsdom |
DOM simulation |
Code Quality
| Technology |
Purpose |
| ESLint |
Linting |
| Prettier |
Formatting |
| Husky |
Git hooks |
| lint-staged |
Staged file linting |
Design Principles
Component Architecture
Components follow these principles:
- Single Responsibility - Each component has one clear purpose
- Composition - Build complex UIs from simple components
- Props Down, Events Up - Unidirectional data flow
State Management
- Local state with
useState for component-specific state
- Context API for shared state across components
- Custom hooks for reusable stateful logic
Code Organization
- Feature-based structure for components
- Shared utilities in
utils/
- Type definitions in
types/
- Custom hooks in
hooks/
Build Process
Development
- Vite starts dev server
- TypeScript compiled on-the-fly
- HMR for instant updates
- ESLint runs in IDE
Production
- TypeScript compilation
- Vite bundle optimization
- Code splitting
- Asset optimization
- Output to
dist/
Extending the Application
Adding a New Component
- Create component in
src/components/
- Add types in component file or
src/types/
- Write tests in
tests/unit/
- Export from appropriate index file
Adding a New Hook
- Create hook in
src/hooks/
- Add comprehensive tests
- Document usage in JSDoc comments