A modern React application for managing car inventory with a clean Material UI interface.
- Car Management: Add, edit, and delete cars in the inventory
- Data Visualization: View cars in a sortable and filterable table
- Responsive Design: Works on desktop and mobile devices
- Real-time Notifications: Get feedback on actions with toast notifications
- Error Handling: Graceful error handling with user-friendly messages
- React 18: Modern React with hooks for state management
- Material UI: Beautiful and responsive UI components
- AG Grid: Advanced data table with sorting and filtering
- Vite: Fast development server and optimized builds
- Fetch API: For communication with the backend service
- Node.js 16+ and npm/yarn
-
Clone the repository:
git clone https://github.com/yourusername/carshop.git cd carshop
-
Install dependencies:
npm install
-
Create an
.env
file in the root directory with your API URL:VITE_API_URL=https://car-rest-service-carshop.2.rahtiapp.fi/cars
Start the development server:
npm run dev
The application will be available at http://localhost:5173 (or another port if 5173 is in use).
Generate a production build:
npm run build
The built files will be in the dist
directory.
- The main view shows a table of all cars in the database
- Use the grid headers to sort or filter cars by any column
- Click the "Add Car" button at the top of the page
- Fill in the required details in the form
- Click "Save" to add the car to the inventory
- Find the car you want to edit in the table
- Click the "Edit" button in that row
- Update the details in the form
- Click "Save" to update the car information
- Locate the car you want to remove in the table
- Click the "Delete" button in that row
- Confirm the deletion in the dialog
The application connects to a REST API backend. The endpoint is configured via the VITE_API_URL
environment variable.
The API should support the following operations:
- GET - Fetch all cars
- POST - Add a new car
- PUT - Update an existing car
- DELETE - Remove a car
carshop/
├── public/ # Static assets
├── src/
│ ├── assets/ # Images and other assets
│ ├── components/ # React components
│ │ ├── AddCar.jsx # Component to add new cars
│ │ ├── CarList.jsx # Main car listing component
│ │ ├── EditCar.jsx # Component to edit existing cars
│ │ └── ...
│ ├── carapi.js # API service functions
│ ├── App.jsx # Main application component
│ └── main.jsx # Application entry point
├── .env # Environment variables
├── eslint.config.js # ESLint configuration
├── package.json # Project dependencies
└── vite.config.js # Vite configuration
-
Cars not loading
- Check that the API URL is correct in
.env
- Verify the backend service is running
- Check browser console for error messages
- Check that the API URL is correct in
-
Form submission errors
- Ensure all required fields are filled
- Check that the input formats are correct
- Verify network connectivity
-
Styling issues
- Clear browser cache
- Ensure all dependencies are correctly installed
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature-name
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.