This project is a Settlement Management System built with Node.js, Express, Sequelize (PostgreSQL), and React. It includes WebSocket support via socket.io
for real-time notifications.
Before running this project, ensure you have the following software installed on your machine:
- Node.js (version 14.x or later)
- npm (usually comes with Node.js)
- PostgreSQL (version 12.x or later)
-
Clone the repository:
git clone https://github.com/momin0606/leyline-backend.git cd <repository-directory> //default value is leyline-backend
-
Install backend dependencies:
npm install
-
Create a
.env
file in theleyline-backend
directory with the following content:PORT=5000 JWT_SECRET=your_jwt_secret
-
Update the
config/config
file in theleyline-backend
directory with the following content:```plaintext
{ "development": { "username": "your_postgres_username", //default is "postgres" "password": "your_postgres_password", //default is "postgres" "database": "postgres", "host": "127.0.0.1", "dialect": "postgres" } }
-
Set up the database:
Ensure PostgreSQL is running and create a database with the name you specified in the
config/config.json
file in theleyline-backend
directory.Then run the migrations and seeders:
npx sequelize-cli db:create npx sequelize-cli db:migrate
-
Start the backend server:
npm start
-
Clone the repository:
git clone https://github.com/momin0606/leyline-ui.git cd <repository-directory> //default value is leyline-ui
-
Install frontend dependencies:
npm install
-
Start the frontend development server:
npm start
After completing the setup steps, you should have the backend server running on http://localhost:5000
and the frontend server running on http://localhost:3000
.
You can now access the application in your web browser at http://localhost:3000
.
The backend server includes WebSocket support via socket.io
for real-time notifications. The WebSocket connection is initialized and authenticated using a token.
-
Auth Routes:
POST /auth/signup
- Register a new userPOST /auth/signin
- Log in a user and return a JWT
-
User Routes:
GET /users
- Get a list of all users (excluding the requesting user)
-
Settlement Routes:
GET /settlements
- Get a list of all settlementsGET /settlements/:id
- Get details of a specific settlement by IDPOST /settlements
- Create a new settlementPUT /settlements
- Update an existing settlement
leyline-backend/
- Contains the backend code (Express server, Sequelize models, migrations, routes)leyline-ui/
- Contains the frontend code (React application)
-
Backend:
- Node.js
- Express
- Sequelize (PostgreSQL)
- Socket.io
- JWT for authentication
-
Frontend:
- React
- Axios for API requests