The Car Management Application is a full-stack web application for managing car listings. It includes user authentication, car listing creation, and image uploads. The application is built with Node.js, Express for the backend, and a React frontend.
This repository contains the following folders:
- backend/: Backend code (Node.js, Express, MongoDB)
- frontend/: Frontend code (React)
- User registration and login
- Create, update, and delete car listings
- Search for cars
- Upload car images using Cloudinary
- Backend: Node.js, Express, MongoDB, JWT, Cloudinary, Multer
- Frontend: React, Axios
- API Documentation: Swagger UI
- Database: MongoDB (MongoDB Atlas recommended)
- Image Upload: Cloudinary
- File Upload Handling: Multer
Clone the repository to your local machine:
git clone https://github.com/yourusername/car-management-app.git
cd car-management-app
The backend is located inside the backend/
folder.
Navigate to the backend
directory and install the required dependencies:
cd backend
npm install
Create a .env
file in the backend/
folder with the following content:
JWT_SECRET=your_jwt_secret_key
JWT_REFRESH_SECRET=your_jwt_refresh_secret_key
MONGODB_URI=your_mongodb_connection_string
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
PORT=5000
- Replace
your_jwt_secret_key
,your_mongodb_connection_string
,your_cloudinary_*
values with your actual credentials.
To start the backend server, run the following command:
npm start
The backend will be available at http://localhost:5000/api
.
The frontend is located inside the frontend/
folder.
Navigate to the frontend
directory and install the required dependencies:
cd frontend
npm install
In the frontend/
directory, open the src/api.js
file and update the API base URL to your backend URL:
const API_URL = "http://localhost:5000/api";
To start the frontend application, run:
npm start
The frontend will be available at http://localhost:3000
.
Once the backend is running, you can access the Swagger UI for API documentation by navigating to:
http://localhost:5000/api-docs
This UI allows you to explore and test all the available API routes, including user authentication and car management.
- Login / Signup: Users can create an account or log in.
- Car Listings: Users can view all their car listings, create new listings, and update existing ones.
- Image Upload: Car images can be uploaded using Cloudinary.
- Search: Users can search for cars by keywords.
backend/
├── controllers/
│ ├── authController.js
│ └── carController.js
├── models/
│ ├── Car.js
│ └── User.js
├── routes/
│ ├── authRoutes.js
│ └── carRoutes.js
├── middleware/
│ └── auth.js
├── config/
│ └── database.js
├── app.js
└── .env
frontend/
├── public/
├── src/
│ ├── components/
│ │ └── CarList.js
│ ├── pages/
│ │ ├── LoginPage.js
│ │ └── HomePage.js
│ ├── App.js
│ └── api.js
├── package.json
└── .env
- Clone the repository: As mentioned, clone the repository and follow the setup instructions for both frontend and backend.
- API Routes: The API has routes for authentication (
/auth/signup
,/auth/login
) and car management (/cars
). - Swagger Documentation: Visit
http://localhost:5000/api-docs
to see the API documentation and try out different routes.