This is a contract management system that allows users to create, edit, update, and delete contracts. Users must be authenticated to manage their contracts. The system is built with a Node.js backend and a React frontend.
- User Authentication (Signup and Login)
- Create, Read, Update, Delete (CRUD) operations for contracts
- Token-based authentication
- Protected routes for authenticated users
- Backend: Node.js, Express.js, MongoDB, Mongoose
- Frontend: React, Axios, React Router
- Authentication: JSON Web Tokens (JWT)
Make sure you have the following installed on your machine:
- Node.js (v14.x or later)
- npm (v6.x or later)
- MongoDB
-
Clone the repository:
git clone https://github.com/yourusername/contract-management-system.git cd contract-management-system
-
Install backend dependencies:
npm install
-
Create a
.env
file in the root directory and add the following environment variables:DB_CONNECT=your_mongodb_connection_string TOKEN_SECRET=your_jwt_secret PORT=5000
-
Start the backend server:
node server.js
-
Navigate to the frontend directory and install dependencies:
cd frontend npm install
-
Start the React development server:
npm start
The frontend application will be served at http://localhost:3000
.
- Signup: Create a new account by signing up.
- Login: Login with your credentials.
- Manage Contracts:
- After logging in, you will be redirected to the contracts page.
- You can view a list of your contracts.
- You can create new contracts, edit existing ones, and delete contracts.
- server.js: Entry point of the backend server.
- routes/: Contains route definitions for user authentication and contract management.
- models/: Mongoose schemas for User and Contract.
- src/components/: React components for Login, Signup, and Contract management.
- src/App.js: Main React component that sets up routing.
- POST /api/users/signup: Create a new user.
- POST /api/users/login: Authenticate a user and return a JWT.
- GET /api/contacts: Get all contracts for the authenticated user.
- POST /api/contacts: Create a new contract.
- PUT /api/contacts/:id: Update an existing contract.
- DELETE /api/contacts/:id: Delete a contract.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any changes or improvements.
- Thanks to all the open-source contributors for their invaluable work.