-
Notifications
You must be signed in to change notification settings - Fork 0
Research‐Documentation‐Frontend‐Web
Selman Akman edited this page May 13, 2025
·
1 revision
This section provides insights into the technologies, architecture, and design decisions behind the Greener frontend.
The Greener frontend is built using modern JavaScript technologies to ensure a responsive, scalable, and maintainable application.
- React (v19.1.0): A JavaScript library for building user interfaces, chosen for its component-based architecture and ecosystem.
- React Router (v7.5.3): Handles client-side routing, enabling seamless navigation across pages like Home, Dashboard, and Profile.
- Axios (v1.9.0): Used for making HTTP requests to the backend API, with interceptors for token-based authentication.
- Redux Toolkit (v2.8.0): Manages global state for user authentication, waste logs, and other shared data.
- Create React App (v5.0.1): Bootstrapped the project, providing a pre-configured development environment with Webpack, Babel, and ESLint.
- Jest: Integrated via Create React App for unit and integration testing.
- React Testing Library (v16.3.0): Facilitates testing React components by simulating user interactions.
-
CSS Modules: Scoped CSS files (e.g.,
Home.css,Dashboard.css) ensure styles are component-specific and avoid conflicts. -
Global Styles:
index.cssandApp.cssfor shared styles like typography and layout.
- React: Industry-standard, supports reusable components, and has a vast community.
- Redux Toolkit: Simplifies state management compared to vanilla Redux.
- Axios: Lightweight and flexible for API interactions.
- Create React App: Reduces setup time, ideal for rapid prototyping and development.
The Greener frontend follows a component-based architecture with a clear separation of concerns, leveraging React's modularity.
-
src/components/: Houses reusable and page-specific components, organized by feature (e.g.,
auth/,dashboard/). -
src/services/: Contains API service logic (
api.js) for backend communication. - src/public/: Static assets like icons, favicon, and manifest for PWA support.
-
src/: Root files like
App.js(main app component),index.js(entry point), and global styles.
-
App.js: Root component, sets up routing with
react-router-dom. -
Pages: Top-level components like
Home,Dashboard,Profile, each corresponding to a route. -
Common Components:
Navbarfor navigation, reused across authenticated pages. -
Feature Components: Specific to pages, e.g.,
ChallengeCardinChallengesPage.
- State Management: Redux Toolkit manages global state (e.g., user authentication, waste logs).
-
API Integration: Axios in
api.jshandles requests, with interceptors adding JWT tokens. -
Local State: React's
useStateanduseEffectfor component-specific state (e.g., form inputs inWasteLog).
- Uses
react-router-domfor client-side routing. - Routes defined in
App.js, mapping paths (e.g.,/dashboard,/waste) to components.
- Modular components allow easy addition of new features.
- CSS Modules prevent style conflicts.
- Redux Toolkit's slice-based approach simplifies state management for future growth.
- Why: React's component model promotes reusability and maintainability.
-
Impact: Components like
NavbarandChallengeCardare reusable across pages.
- Why: Simplifies Redux boilerplate, suitable for managing user sessions and API data.
- Alternative Considered: React Context (lighter but less robust for complex state).
- Why: Centralized token management for authenticated API requests.
- Alternative Considered: Fetch API (native but requires more manual configuration).
- Why: Scoped styles prevent conflicts, unlike global CSS or inline styles.
- Alternative Considered: Styled-components (adds runtime overhead).
- Why: Quick setup with pre-configured tools, ideal for student projects.
- Alternative Considered: Vite (faster but less mature at project start).
- Why: JWT-based authentication stored in localStorage for simplicity.
- Trade-off: Security risks mitigated by short-lived tokens and secure backend.
-
Why:
manifest.jsonand service workers enable offline capabilities and app-like experience. - Impact: Enhances user engagement, especially on mobile.
- Lab1
- Lab 1 Meeting Notes
- Lab2
- Lab 2 Meeting Notes
- Lab3
- Lab 3 Meeting Notes
- Lab4
- Lab4 Meeting Notes
- Lab5
- Lab5 Meeting Notes
- Lab 5: MVP Implementation & Planning
- Lab6
- Lab6 Meeting Notes
- Lab7
- Lab7 Meeting Notes
- Lab 7: Milestone 2 Demo Preparation
- Lab8
- Lab8 Meeting Notes
- Lab 8: Requirements Review & Acceptance Planning
- Ahmet's Bio
- Barathan's Bio
- Berkay's Bio
- Berke's Bio
- Caglar's Bio
- Mehmet Emin's Bio
- Nilsu's Bio
- Ömer's Bio
- Selman's Bio
- Taha's Bio
Ahmet Okta
Barathan Aslan
Berke Kartal
Mehmet Çağlar Kurt
Mehmet Emin Atak
Muhammet Berkay Keskin
Mustafa Taha Söylemez
Nilsu Tüysüz
Selman Akman
Ömer Faruk Bayram
- Use Case Diagram
- Class Diagram
- Sequence Diagrams - Admin Management and Moderator Functions
- Sequence Diagrams - Rewards, Badges and Leaderboard System
- Sequence Diagrams - Notification System
- Sequence Diagrams - Tips and Recommendations
- Sequence Diagrams - Challenge and Activity Tracking
- Sequence Diagrams - Waste Tracking and Scoring System
- Sequence Diagrams - User and Account Management
- Sequence Diagrams - Goal Management
- Sequence Diagrams - Authentication
- Sequence Diagrams - Session Management
- Sequence Diagrams - Events Management
- Project Plan
- Requirements
- Elicitation Questions & Answers
- Scenario #1
- Scenario #2
- Scenario #3
- Scenario #4
- Scenario #5
- Scenario #6
- Scenario #7
- Scenario #8
- Scenario #9
- Scenario #10
- Scenario #11
- Scenario #12
- Scenario #13
- Scenario #14
- Use Case Diagram
- Class Diagram
- Sequence Diagrams - Admin Management and Moderator Functions
- Sequence Diagrams - Rewards,Badges and Leaderboard System
- Sequence Diagrams - Notification System
- Sequence Diagrams - Tips and Recommendations
- Sequence Diagrams - Challenge and Activity Tracking
- Sequence Diagrams - Waste Tracking and Scoring System
- Sequence Diagrams - User and Account Management
- Sequence Diagrams - Goal Management
- Sequence Diagrams - Auth
- Sequence Diagrams - Session Management
- User Manual for Frontend-Web
- System Manual for Frontend-Web
- Research Documentation for Frontend-Web
- Testing Manual for Frontend-Web