This is the frontend for a modern Product Management application, built with React and Vite. It provides a clean and responsive user interface to interact with a product database, allowing users to view, create, update, and delete products.
The application is designed to consume a separate backend API built with NestJS.
Live Demo URL: https://products-list-react-inky.vercel.app/
- List Products: Fetches and displays a list of all available products from the API.
- Responsive Design: A clean and modern UI that works on all screen sizes.
- API Integration: Uses Axios to communicate with the backend API for all data operations.
- Environment-Based Configuration: API URL is configured via environment variables, making it easy to switch between development and production.
- Ready for Deployment: Optimized for deployment on platforms like Vercel.
- React: A JavaScript library for building user interfaces.
- Vite: A next-generation frontend tooling that provides a faster and leaner development experience.
- TypeScript: A typed superset of JavaScript for building robust applications.
- Axios: A promise-based HTTP client for making requests to the backend.
- Tailwind CSS: A utility-first CSS framework for rapid UI development.
- React Icons: A library for including popular icons in your React projects.
The project follows a standard Vite + React project structure:
/
├── public/ # Static assets
├── src/
│ ├── assets/ # Images, fonts, etc.
│ ├── components/ # Reusable React components (e.g., ProductCard, Modal)
│ ├── services/ # API communication layer (e.g., api.ts with Axios)
│ ├── App.tsx # Main application component
│ ├── main.tsx # Application entry point
│ └── index.css # Global styles
├── .env.example # Example environment variables
├── package.json # Project dependencies and scripts
└── vite.config.ts # Vite configuration
This frontend application depends on a separate backend API for all data operations.
The backend is a NestJS CRUD API that handles product management, connecting to a MongoDB database. For more detailed information about its architecture, endpoints, and how to run it locally, please refer to its repository.
➡️ Backend Repository: https://github.com/s4mp41xao/nestcrud
To run this project locally, you need to create a .env file in the root directory. You can copy the .env.example file:
cp .env.example .envThen, fill in the required variables:
VITE_API_URL: The base URL of the backend API. For local development, this will likely behttp://localhost:3000. For production, it will be the URL of your deployed backend (e.g.,https://nestcrud.vercel.app).
-
Clone the repository:
git clone https://github.com/your-username/products-list-react.git cd products-list-react -
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile as described in the section above and setVITE_API_URL. -
Run the development server:
npm run dev
The application will be available at
http://localhost:5173(or another port if 5173 is in use).
This project is configured for easy deployment on Vercel.
To deploy, simply connect your GitHub repository to a new Vercel project. Vercel will automatically detect that it's a Vite project and configure the build settings.
Important: Remember to set the VITE_API_URL environment variable in your Vercel project settings to point to your deployed backend API URL.