A robust backend service for the Easy Legal application, built with Node.js, Express, MongoDB, and Socket.IO.
Easy Legal Backend provides the server-side implementation for managing legal cases, tasks, user authentication, and real-time chat functionality. The system is designed to facilitate communication and case management between legal professionals and clients.
- User Authentication & Authorization
- Case Management
- Task Management with Categories
- Real-time Chat System
- Social Relationship Management
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB
- Real-time Communication: Socket.IO
- Authentication: JWT (JSON Web Tokens)
easy-legal-backend/
├── configuration/ # Server and database configuration
│ ├── configureChat.js # Socket.IO chat configuration
│ ├── connectDb.js # MongoDB connection setup
│ ├── hostExpressServer.js # Express server configuration
│ └── hostSocketServer.js # Socket server setup
├── controllers/ # Request handlers
│ ├── CaseController.js
│ ├── ChatController.js
│ ├── TaskCategoryController.js
│ ├── TaskController.js
│ └── UserController.js
├── middleware/ # Authentication middleware
│ ├── isAuth.js
│ └── isAutho.js
├── models/ # MongoDB models
│ ├── Case.js
│ ├── Chat.js
│ ├── SocialRelationship.js
│ ├── Task.js
│ ├── TaskCategory.js
│ └── User.js
├── routes/ # API routes
│ ├── CaseRouter.js
│ ├── ChatRouter.js
│ ├── TaskCategoryRouter.js
│ ├── TaskRouter.js
│ └── UserRouter.js
├── index.js # Application entry point
└── package.json # Project dependencies and scripts
- Node.js (v14 or higher)
- MongoDB
- npm or yarn package manager
-
Clone the repository:
git clone https://github.com/aramelheni/easy-legal-backend.git
-
Install dependencies:
cd easy-legal-backend npm install -
Set up environment variables: Create a
.envfile in the root directory with the following variables:PORT=6005 DB_URL=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key JWT_EXPIRES_IN=90
-
Start the server:
npm start
POST /api/users/register- Register a new userPOST /api/users/login- User loginGET /api/users/profile- Get user profile
GET /api/cases- Get all casesPOST /api/cases- Create a new caseGET /api/cases/:id- Get case by IDPUT /api/cases/:id- Update caseDELETE /api/cases/:id- Delete case
GET /api/tasks- Get all tasksPOST /api/tasks- Create a new taskGET /api/tasks/:id- Get task by IDPUT /api/tasks/:id- Update taskDELETE /api/tasks/:id- Delete task
GET /api/chats- Get user chatsPOST /api/chats- Start a new chatGET /api/chats/:id- Get chat messagesPOST /api/chats/:id/message- Send a message
The application uses Socket.IO for real-time features including:
- Live chat messaging
- Instant notifications
- Real-time updates for case status changes
We welcome contributions! See the CONTRIBUTING file for details.
This project is licensed under the MIT License - see the LICENSE file for details.