This is the repository that will serve the process of the Frontend side of Product Selection.
- Install Node Version Manager (NVM).
- Install the node version (by utilizing the NVM) specified in the
.nvmrcfile. - Create a
.envfile. - Use the
.env.templatefile as a baseline to add the environment variables needed in.envfile to run the project. - Run
npm run devto run the project locally.
The frontend can also be run inside a Docker container for consistency and easier environment setup.
Run the following command to build the Docker image:
docker compose buildStart the application with:
docker compose upIf you want to stop the containers and also remove associated volumes (e.g., clearing cached data), run:
docker-compose down --volumesThis will delete all named volumes, ensuring a clean state when restarting the container.
The main focus will be under the src/ subdirectories.
components/: Used for components that are widely used across the application.features/: This is where everything is located regarding a feature (e.g. products), namely, the view for that functionality, the API implementation, and helper methods. The intent is for every feature to have its submodules colocated in the same folder to make it easier for developers to maintain.utils/: Utility methods that are being widely used across the application.
Contains all authentication-related logic.
services/→ Implements API communication.authService.ts→ Handles login, logout, current user retrieval, and token refresh.
types/→ Defines TypeScript types for authentication.authTypes.ts→ Defines types likeAuthResponse,LoginCredentials, etc.
components/→ UI components related to authentication.Login.tsx→ The login form.
pages/→ Full authentication-related pages.LoginPage.tsx→ Uses theLogincomponent insideLayout.
Routing is managed using react-router-dom.
Protected routes ensure only authenticated users can access specific pages.
ProtectedRoute.tsx→ Redirects unauthenticated users to the login page.Layout.tsx→ Wraps pages with shared UI elements, such as theHeader.