This document provides comprehensive information about the structure, architecture, and development practices of this Todo application. It's designed to help AI agents understand the codebase and contribute effectively.
This is a React-based Todo application built with TypeScript, Vite, Material UI (MUI), and Atlas UI components. The app allows users to:
- Create new todo items
- View a list of todos
- Edit existing todos
- Mark todos as completed/uncompleted
- Delete todos
The application features a responsive design, follows modern React practices with hooks and context for state management, and includes comprehensive testing.
- Frontend Framework: React 19
- UI Component Library: Material UI 7 with Atlas UI components
- Styling: Emotion (CSS-in-JS)
- Type Safety: TypeScript
- Build Tool: Vite
- Testing: Vitest, React Testing Library
- Code Quality: ESLint, Prettier
- CI/CD: GitHub Actions
/
├── .github/ # GitHub metadata
│ └── workflows/ # CI workflows
├── .husky/ # Git hooks for pre-commit checks
├── .cursor/ # Cursor AI configuration (optional)
├── implementation-plans/ # Architecture & feature proposals
├── product/ # Product documentation
├── prompt-library/ # AI prompt examples & workflows
├── public/ # Static assets served by Vite
├── src/ # Source code
│ ├── __tests__/ # Unit & component tests
│ ├── assets/ # Media assets
│ ├── components/ # React components
│ ├── contexts/ # React contexts (state management)
│ ├── hooks/ # Custom React hooks
│ ├── providers/ # Context providers & theming
│ ├── types/ # TypeScript type definitions
│ └── ... # Other source files
├── tmp/ # Temporary generated files & prompt history
├── AI.md # Comprehensive project documentation
├── CLAUDE.md # Claude-specific guidance
├── README.md # Quick project overview
├── eslint.config.js # ESLint configuration
├── index.html # HTML entry point for Vite
├── package.json # Dependencies and scripts
├── tsconfig.json # Base TypeScript configuration
├── tsconfig.app.json # App-specific TypeScript config
├── tsconfig.node.json # Node-specific TypeScript config
├── vite.config.ts # Vite build configuration
└── vitest.config.ts # Vitest test runner configuration
The src directory follows a feature-based organization:
src/
├── __tests__/ # Test files
├── assets/ # Media assets
├── components/ # React components
│ ├── CreateTodoButton/ # Todo creation button component
│ ├── Layout/ # Layout components (Header, Footer)
│ ├── TodoList/ # Todo list related components
│ └── TodoModal/ # Modal for creating/editing todos
├── contexts/ # React contexts
│ └── TodoContext.tsx # Todo state management context
├── providers/ # React providers
│ └── ThemeProvider.tsx # Theme provider for Atlas UI
├── types/ # TypeScript type definitions
│ └── Todo.ts # Todo interface definition
├── App.tsx # Main application component
├── App.css # Application-level styles
├── index.css # Global styles
└── main.tsx # Application entry point
The application follows a unidirectional data flow pattern:
- State Management:
TodoContextmanages the application state - UI Components: Components consume the context and dispatch actions
- Actions: Functions in the context modify the state
- Rendering: UI re-renders based on state changes
This React context serves as the central state management system for todos. It provides:
- A list of todo items
- Functions to add, edit, delete, and toggle completion of todos
- A custom hook
useTodo()for components to access todos and operations
Usage pattern:
const { todos, addTodo, editTodo, toggleTodoCompletion, deleteTodo } = useTodo();The root component that:
- Sets up the theme provider
- Establishes the todo context
- Renders the main layout (Header, TodoList, Footer)
TodoList: Renders the list of todos or an empty state messageTodoItem: Renders individual todo items with completion checkbox and delete button
A modal dialog for creating new todos or editing existing ones with:
- Title and description input fields
- Completion checkbox (for edit mode)
- Validation for required fields
A button that opens the TodoModal in "create" mode.
Provides the Atlas UI theme configuration for the entire application.
interface Todo {
id: string; // Unique identifier
title: string; // Todo title
description: string; // Todo description
completed: boolean; // Completion status
createdAt: Date; // Creation timestamp
}- Clone the repository
- Install dependencies:
npm install - Start development server:
npm run dev
npm run dev: Start development servernpm run build: Build the project for productionnpm run lint: Run ESLint to check and fix code style issuesnpm run format: Format code using Prettiernpm run format:check: Check if code is properly formattednpm run test: Run tests with Vitestnpm run preview: Preview the production build locally
The project is configured with:
- ESLint: For code quality and best practices enforcement
- Prettier: For consistent code formatting
- Husky: For pre-commit hooks that run linting and formatting
- lint-staged: To run checks only on staged files
- Code changes should pass all pre-commit hooks (lint, format)
- Commit messages should follow conventional commits format
- GitHub Actions runs CI checks on push and pull requests
Tests are located in the src/__tests__/ directory and use Vitest with React Testing Library.
- Component Tests: Verify component rendering and behavior
- Context Tests: Verify state management logic
- Integration Tests: Verify component interactions
- Run all tests:
npm run test - Watch mode for development:
npm run test -- --watch
GitHub Actions workflow (.github/workflows/ci.yml) performs:
- Linting code
- Checking formatting
- Building the project
- Running tests
This ensures that all code changes maintain quality standards.
-
For new UI components:
- Create a new directory in
src/components/ - Follow the existing component structure
- Add tests in
src/__tests__/
- Create a new directory in
-
For new functionality:
- Extend the
TodoContextwith new state and actions - Update types in
src/types/if needed - Add corresponding UI components
- Extend the
- Use Material UI's
sxprop for component styling - Follow the Atlas UI design system
- Use responsive design patterns for different screen sizes
-
Context Consumption:
const { todos } = useTodo();
-
Component Structure:
export const ComponentName: React.FC<Props> = ({ prop1, prop2 }) => { // Component logic return ( // JSX markup ); };
-
Testing Pattern:
describe('Component', () => { it('should render correctly', () => { render(<Component />); expect(screen.getByText('...')).toBeInTheDocument(); }); });
This documentation should provide AI assistants with a comprehensive understanding of the project structure, architecture, and development practices to effectively contribute to the codebase.