-
Notifications
You must be signed in to change notification settings - Fork 0
Project Structure
This document provides a detailed overview of the Fallout Web App's directory structure and organization.
fallout/
βββ public/ # Static assets
βββ src/ # Source code
βββ .claude/ # Claude AI configuration
βββ .github/ # GitHub configuration and agents
βββ .env.example # Environment variables template
βββ .gitignore # Git ignore rules
βββ eslint.config.js # ESLint configuration
βββ index.html # HTML entry point
βββ package.json # Project dependencies
βββ package-lock.json # Dependency lock file
βββ README.md # Project documentation
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite build configuration
The src directory contains all the application source code, organized by functionality:
Handles all HTTP requests and API integrations.
src/api/
βββ axios.ts # Axios instance configuration with interceptors
βββ services.ts # API service functions and endpoints
Key Features:
- Centralized API configuration
- Request/response interceptors
- Token-based authentication support
- Error handling middleware
- TypeScript typed responses
Reusable React components used throughout the application.
src/components/
βββ Navigation.tsx # Main navigation component
βββ Navigation.css # Navigation styles
βββ Pagination.tsx # Reusable pagination component
βββ Pagination.css # Pagination styles
Component Guidelines:
- Each component has its own CSS file
- Components are typed with TypeScript interfaces
- Follows React functional component patterns
- Props are validated with TypeScript
Application-wide constants and configuration values.
src/constants/
βββ index.ts # Constant definitions
Reusable React hooks for common functionality.
src/hooks/
βββ useInfiniteScroll.ts # Hook for infinite scroll implementation
Available Hooks:
-
useInfiniteScroll- IntersectionObserver-based infinite scrolling - Configurable threshold and root margin
- Loading and error state management
Top-level route components that represent different pages of the application.
src/pages/
βββ Home.tsx # Landing page (/)
βββ Dashboard.tsx # Dashboard with metrics (/dashboard)
βββ Posts.tsx # Paginated posts list (/posts)
βββ InfinitePosts.tsx # Infinite scroll posts (/posts/infinite)
βββ Profile.tsx # User profile page (/profile)
βββ Settings.tsx # Settings page (/settings)
βββ About.tsx # About page (/about)
βββ NotFound.tsx # 404 error page
Page Responsibilities:
- Route-level components
- Data fetching with React Query
- State management with Zustand
- Layout composition
Zustand stores for global state management.
src/store/
βββ counterStore.ts # Example counter store with Immer
Store Features:
- Lightweight state management with Zustand
- Immutable updates with Immer
- TypeScript typed stores
- Devtools support
Shared TypeScript type definitions and interfaces.
src/types/
βββ index.ts # Type definitions
Helper functions and utilities used across the application.
src/utils/
βββ index.ts # Utility functions
src/
βββ App.tsx # Main app component with routing
βββ App.css # App-level styles
βββ main.tsx # Application entry point
βββ index.css # Global styles
βββ vite-env.d.ts # Vite environment type definitions
Defines TypeScript compiler options:
- Target: ES2020
- Module: ESNext
- Strict mode enabled
- React JSX support
- Path aliases (if configured)
Vite build tool configuration:
- React plugin
- Development server settings
- Build optimization
- Port configuration (default: 3000)
Code quality and linting rules:
- TypeScript ESLint parser
- React hooks plugin
- React refresh plugin
- Custom rules for code standards
Template for environment-specific configuration:
VITE_API_URL=https://jsonplaceholder.typicode.comUsage:
- Copy
.env.exampleto.env - Update values for your environment
- Access via
import.meta.env.VITE_*
-
Components: PascalCase (e.g.,
Navigation.tsx) -
Hooks: camelCase with
useprefix (e.g.,useInfiniteScroll.ts) -
Stores: camelCase with
Storesuffix (e.g.,counterStore.ts) -
Utilities: camelCase (e.g.,
formatDate.ts) - Types: PascalCase for interfaces/types
-
CSS Files: Match component name (e.g.,
Navigation.css)
- Group related files together
- Keep components small and focused
- Extract reusable logic into hooks
- Use barrel exports (
index.ts) for cleaner imports
// External dependencies
import React from 'react'
import { useQuery } from '@tanstack/react-query'
// Internal components
import { Navigation } from '@/components/Navigation'
// Utilities and helpers
import { formatDate } from '@/utils'
// Types
import type { User } from '@/types'
// Styles
import './Component.css'// Imports
import React from 'react'
import './Component.css'
// Types
interface ComponentProps {
// prop definitions
}
// Component
export const Component: React.FC<ComponentProps> = (props) => {
// Hooks
// Event handlers
// Render
return <div>...</div>
}Use these patterns to locate specific functionality:
-
API calls: Check
src/api/services.ts -
Routing: Look in
src/App.tsx -
Global state: Check
src/store/ -
Shared types: Find in
src/types/ -
Page components: Located in
src/pages/ -
Reusable components: Check
src/components/ -
Custom hooks: Located in
src/hooks/
- API Integration - Working with the API layer
- Components - Component development guide
- State Management - Using Zustand stores
- Styling - CSS and styling conventions
Back to: Home