This project is a basic storefront built using the Fake Store API. It fetches all products and displays them as cards on a page, with the ability to add items to a cart.
Tools used by this repo:
- Turbo - for incremental bundling
- Next.js - a React framework for server-side rendering and static site generation
- Storybook - for building UI in isolation
- Redux - for state management and data fetching
- Tailwind CSS for styles
- TypeScript for static type checking
- ESLint for code linting
- Prettier for code formatting
- Global State Management: Utilized Redux for state management, including handling cart operations and user authentication.
- See
cart-slice.ts
for cart state management. - See
auth.ts
for authentication services.
- See
- Routing: Implemented multiple routes using Next.js.
- TypeScript: Ensured type safety across the application.
- Semantic HTML: Used semantic HTML elements for better accessibility.
- CSS: Styled components using Tailwind CSS for a polished look.
- Clone the repository.
- Install dependencies:
npm install
- Run the development server:
- Open http://localhost:3000 to view the application.
- Open http://localhost:6006 to view the application storybook.
npm run dev
: Starts the development server.npm run build
: Builds the application for production.npm run start
: Starts the production server.npm run lint
: Runs ESLint to check for linting errors.npm run format
: Runs Prettier to format the code.
- Project Setup:
- Initialized the project with Next.js and TypeScript.
- Configured ESLint and Prettier for code quality and consistency.
- Set up Tailwind CSS for styling.
- State Management:
- Implemented Redux for global state management.
- Created slices for handling cart operations and user authentication.
- Used Redux persist to save cart data on local storage
- Used cookies to store user token
- Routing:
- Set up multiple routes using Next.js.
- Created pages for product listing and cart.
- API Integration:
- Integrated with the Fake Store API to fetch product data.
- Implemented data fetching using Redux Toolkit's RTK Query.
- UI Components:
- Built reusable UI components using React.
- Styled components with Tailwind CSS.
- Used Storybook to develop and test components in isolation.
- TypeScript:
- Ensured type safety across the application.
- Defined types for API responses and application state.
- Semantic HTML:
- Used semantic HTML elements to improve accessibility.
- Enhance responsiveness for better mobile experience.
- Add more unit tests for critical components and functions.
- Improve error handling and user feedback mechanisms.