This repository contains a comprehensive React.js Product Management System designed to help developers master modern frontend development, React.js framework, API integration, and full-stack web application architecture. The project features a complete product management system with authentication, CRUD operations, responsive design, and modern web development practices. It serves as a complete learning platform for understanding React.js development from basics to advanced concepts.
- Node.js (version 14 or higher) and npm installed on your system
- A modern web browser (Chrome, Firefox, Edge, Safari, etc.)
- (Optional) A code editor like VS Code, Sublime Text, or Atom for easier code navigation
- Basic understanding of JavaScript, HTML, CSS, and web development concepts
- Knowledge of React.js fundamentals (components, hooks, state management)
-
Clone the repository (if not already downloaded):
git clone <repository-url> cd Product-Management-main
-
Install dependencies:
npm install
-
Start the development server:
npm start
-
Start the application:
npm start
This will start the development server with hot reloading at http://localhost:3000.
-
Build for production:
npm run build
-
Run tests:
npm test
-
Build the application:
npm run build
-
Serve the production build:
npx serve -s build
Note: The application uses React Scripts for development, which automatically starts the development server with hot reloading when you make changes to the source code.
Product-Management-main/
├── public/
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
├── src/
│ ├── components/
│ │ ├── addProduct.jsx
│ │ ├── detail.jsx
│ │ ├── login.jsx
│ │ ├── product.jsx
│ │ └── updateProduct.jsx
│ ├── App.js
│ └── index.js
├── package-lock.json
├── package.json
└── README.md
- public/: Static assets served directly to the browser
index.html
: Main HTML templatefavicon.ico
: Website faviconlogo192.png
&logo512.png
: Application logosmanifest.json
: Web app manifest for PWA featuresrobots.txt
: Search engine crawling instructions
- src/components/: React components organized by feature
login.jsx
: Authentication component with form handlingproduct.jsx
: Product listing component with grid layoutdetail.jsx
: Product detail view componentaddProduct.jsx
: Product creation form componentupdateProduct.jsx
: Product editing form component
- src/App.js: Main application component with routing and state management
- src/index.js: Application entry point and React rendering
- React.js Framework: Modern JavaScript library for building user interfaces
- Component-Based Architecture: Reusable UI components with props and state
- React Router: Client-side routing for single-page application
- Authentication System: Login functionality with token-based authentication
- API Integration: RESTful API calls using Axios and Fetch API
- CRUD Operations: Complete Create, Read, Update, Delete functionality
- Responsive Design: Bootstrap integration for mobile-friendly UI
- State Management: React hooks for local state management
- Local Storage: Persistent authentication state
- Modern JavaScript: ES6+ features and async/await patterns
- Hot Reloading: Automatic browser refresh during development
- Form Handling: Controlled components with validation
- Error Handling: Try-catch blocks and error states
- Loading States: Conditional rendering based on data availability
This module covers the core React.js concepts:
- Component Structure: Functional components with hooks
- State Management: useState hook for local state
- Effect Management: useEffect hook for side effects
- Routing: React Router setup and navigation
- Authentication Flow: Token-based login/logout system
- Local Storage: Browser storage for persistent data
This module demonstrates component-based development:
- Form Handling: Controlled input components
- API Integration: Axios for authentication requests
- Error Handling: User feedback for login failures
- Navigation: Programmatic routing with useNavigate
- Token Management: JWT token storage and retrieval
- Product Listing (
product.jsx
): Grid layout with product cards - Product Detail (
detail.jsx
): Individual product information - Product Creation (
addProduct.jsx
): Add new products form - Product Update (
updateProduct.jsx
): Edit existing products
This module covers external API communication:
- RESTful APIs: Integration with DummyJSON API
- HTTP Methods: GET, POST, PUT, DELETE requests
- Authentication Headers: Bearer token implementation
- Error Handling: Network error management
- Data Transformation: API response processing
This module covers React Router implementation:
- Route Configuration: Path-based component rendering
- Dynamic Routes: URL parameters for product IDs
- Navigation: Link components and programmatic routing
- Route Protection: Authentication-based access control
- Nested Routes: Complex routing structures
This module covers React state patterns:
- Local State: useState hook for component state
- Effect Dependencies: useEffect cleanup and dependencies
- State Updates: Immutable state updates
- Conditional Rendering: State-based UI changes
- Data Fetching: API calls with loading states
This module covers client-side development:
- Bootstrap Integration: Responsive design framework
- CSS Styling: Inline styles and component styling
- Responsive Layout: Mobile-first design approach
- Component Styling: Card layouts and grid systems
- User Experience: Loading states and error messages
- React.js 18.2.0: JavaScript library for building user interfaces
- React Router DOM 6.13.0: Client-side routing for React applications
- Axios 1.6.7: HTTP client for API requests
- Bootstrap 5.3.3: Frontend CSS framework
- React Bootstrap 2.10.2: Bootstrap components for React
- React Scripts 5.0.1: Development and build tools
- Testing Library: Jest and React Testing Library for testing
- Web Vitals 2.1.4: Performance monitoring
- JSON Server 0.17.3: Mock API server for development
- Start Development Server: Run
npm start
for hot reloading - API Integration: Use DummyJSON API for product data
- Authentication: Test login with provided credentials
- Code Changes: Files automatically reload when modified
- Build Assets: Compile and optimize for production
- Environment Setup: Configure production API endpoints
- Deployment: Deploy to hosting platform (Netlify, Vercel, etc.)
- Monitoring: Set up analytics and error tracking
- Start with
src/App.js
to understand React component structure - Explore
src/components/
to learn component patterns - Study authentication flow in
login.jsx
- Implement CRUD operations in product components
- Add form validation and error handling
- Create custom hooks for reusable logic
- Add state management with Context API or Redux
- Implement advanced routing with guards
- Add testing and deployment configurations
- Optimize performance with React.memo and useMemo
- Component Composition: Reusable and maintainable components
- Hook Usage: Proper useState and useEffect implementation
- Error Handling: Comprehensive error catching and user feedback
- Security: Input validation and secure authentication
- Performance: Efficient re-rendering and data fetching
- Code Organization: Consistent naming conventions and structure
- Documentation: Clear code comments and README
- Version Control: Proper Git workflow and commit messages
POST https://dummyjson.com/auth/login
- User authenticationGET https://dummyjson.com/user
- Get user profile (with token)
GET https://dummyjson.com/products
- List all productsGET https://dummyjson.com/products/:id
- Get product detailsPOST https://dummyjson.com/products/add
- Create new productPUT https://dummyjson.com/products/:id
- Update productDELETE https://dummyjson.com/products/:id
- Delete product
/
- Login page (default route)/product
- Product listing page (requires authentication)
/product/:id
- Product detail page/product/:id/update
- Product edit page/product/add
- Product creation page
-
Login Process:
- User enters credentials on login page
- System validates with DummyJSON API
- JWT token stored in localStorage
- User redirected to product listing
-
Session Management:
- Token checked on app initialization
- Automatic redirect if token exists
- Logout clears localStorage and redirects
-
Route Protection:
- Authentication state managed in App component
- Conditional rendering based on login status
- Programmatic navigation for authenticated users
- API Connection: Ensure internet connection for DummyJSON API
- Port Conflicts: Change port in package.json if 3000 is busy
- Dependencies: Run
npm install
if modules are missing - Build Issues: Clear node_modules and reinstall dependencies
- Authentication: Check browser console for token storage issues
- Routing: Ensure React Router is properly configured
- Console Errors: Check terminal and browser console for error messages
This is a learning project designed for educational purposes. Feel free to:
- Modify examples to experiment with different approaches
- Add new features and functionality
- Improve documentation and comments
- Share your learning experiences
- Report bugs and suggest improvements
- React.js Documentation
- React Router Documentation
- Bootstrap Documentation
- Axios Documentation
- Create React App Documentation
- React Testing Library
- DummyJSON API Documentation
For questions or contributions, please open an issue or pull request on the GitHub repository.
This project is licensed under the ISC License - see the LICENSE file for details.