Component Architecture
EducaStream uses a component-based architecture built with React, organizing components into reusable, modular units. The application follows a clear separation between presentational components and page-level views.Directory Structure
The component architecture is organized into two main directories:Component Categories
UI Components
Reusable components located insrc/Components/ that handle specific UI functionality:
- Card
- Carrousel
Layout Components
- CardContainer
- CardLayout
CardContainer ComponentWrapper component for individual course cards.
Utility Components
- Loader
- Cart
Loader ComponentLoading spinner for async operations.
Page-Level Views
Views are located insrc/views/ and represent full pages:
- Layout - Home page layout with course listings
- Courses - Course catalog with filtering and pagination
- DetailCourse - Individual course detail page
- Student - Student dashboard
- Instructor - Instructor dashboard
- Dashboard - Admin dashboard
- Login - Authentication page
Context Usage
Components utilize React Context for state management:userContext provides:
- User authentication state
- User profile information
- Course purchase history
- Role-based permissions
Component Communication
Props Down
Parent components pass data to children via props
Context
Global state shared via React Context
Cart Context
Shopping cart state managed separately
Navigation
React Router for page navigation
Best Practices
When creating new components in EducaStream:
- Place reusable UI components in
src/Components/ - Create a dedicated folder for each component
- Include a matching CSS module file
- Export component as default
- Use context for global state access
- Implement prop validation where appropriate