-
Notifications
You must be signed in to change notification settings - Fork 17
Project Structure
Chintan Rathod edited this page Mar 26, 2025
·
1 revision
This document explains the organization and architecture of Let's Stream V2.0.
├── src/ # Source code
│ ├── components/ # React components
│ ├── contexts/ # React context providers
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility libraries
│ ├── pages/ # Application routes
│ └── utils/ # Helper functions
├── public/ # Static assets
├── functions/ # Firebase functions
├── dev-dist/ # Development build files
└── wiki/ # Project documentation
-
src/App.tsx: Main application component -
src/main.tsx: Application entry point -
src/index.css: Global styles -
src/vite-env.d.ts: TypeScript declarations
components/
├── ui/ # Shared UI components
│ ├── button.tsx
│ ├── input.tsx
│ └── ...
├── AccentColorPicker.tsx
├── ContentRow.tsx
├── Footer.tsx
├── Hero.tsx
├── MediaCard.tsx
├── Navbar.tsx
└── ...
contexts/
├── auth.ts # Authentication context
├── user-preferences.tsx
├── watch-history.tsx
└── types/ # TypeScript definitions
hooks/
├── auth-context.tsx
├── use-auth.tsx
├── use-mobile.tsx
├── use-toast.ts
├── use-user-preferences.tsx
└── use-watch-history.tsx
pages/
├── Index.tsx # Home page
├── Movies.tsx
├── TVShows.tsx
├── Sports.tsx
├── Profile.tsx
├── Player.tsx
└── ...
-
Presentational Components
- Focus on UI rendering
- Receive data via props
- Minimal state management
- Located in
components/
-
Container Components
- Handle data fetching
- Manage component state
- Pass data to presentational components
- Located in
pages/
-
React Context
- Authentication state
- User preferences
- Watch history
- Theme Settings
-
Local State
- Form data
- UI interactions
- Component-specific state
// Main routing configuration
<Routes>
{/* Public Routes */}
<Route path="/" element={<Index />} />
<Route path="/movies" element={<Movies />} />
<Route path="/tv" element={<TVShows />} />
<Route path="/sports" element={<Sports />} />
{/* Protected Routes */}
<Route element={<ProtectedRoute />}>
<Route path="/profile" element={<Profile />} />
<Route path="/watch-history" element={<WatchHistory />} />
</Route>
{/* Auth Routes */}
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
{/* Utility Routes */}
<Route path="*" element={<NotFound />} />
</Routes>Login/Signup → Firebase Auth → Auth Context → Protected Routes
API Request → Rate Limiter → Data Fetch → State Update → Render
User Action → Context Update → Firestore → UI Update
- PascalCase for component files
-
.tsxextension for components - Corresponding
.test.tsxfor tests
- camelCase for utility files
-
.tsextension for TypeScript files - Descriptive, function-focused names
- Same name as component
-
.module.cssfor CSS modules - TailwindCSS classes in components
- React & React DOM
- TypeScript
- Vite
- Firebase
- TailwindCSS
- Radix UI components
- Framer Motion
- Lucide icons
- Sonner toasts
- ESLint
- TypeScript ESLint
- Prettier
- PostCSS
-
tsconfig.json: Base configuration -
tsconfig.app.json: App-specific config -
tsconfig.node.json: Node-specific config
-
vite.config.ts: Build configuration - PWA plugin setup
- Path aliases
- Development server settings
-
.env: Environment variables -
.env.example: Template -
.env.development: Development values -
.env.production: Production values
// Dynamic imports for routes
const Movies = lazy(() => import('./pages/Movies'));
const TVShows = lazy(() => import('./pages/TVShows'));- Image compression
- Font subsetting
- SVG optimization
- Cache strategies
- Route-based splitting
- Component lazy loading
- Image lazy loading
- Data prefetching
__tests__/
├── components/
├── hooks/
└── utils/
tests/
├── auth/
├── media/
└── user/
cypress/
└── e2e/
dist/
├── assets/
├── index.html
└── manifest.json
dev-dist/
├── sw.js
├── workbox-*.js
└── registerSW.js
- Component props
- Hook parameters
- Utility functions
- Type definitions
/**
* Component description
* @param {Props} props - Component props
* @returns {JSX.Element} Rendered component
*//**
* Function description
* @param {string} param1 - Parameter description
* @returns {Promise<Result>} Return value description
* @throws {Error} Error description
*/- Protected routes
- Token management
- Session handling
- OAuth integration
- Input validation
- XSS prevention
- CSRF protection
- Rate limiting
- Global error boundary
- API error handling
- Fallback components
- Error logging
Home • Getting Started • API Reference • Report Bug • Request Feature
© 2025 Let's Stream V2.0. Built with ❤️ by the community.