99 lines
1.4 KiB
Markdown
99 lines
1.4 KiB
Markdown
# 🚀 Robin Network Server Setup
|
||
|
||
Follow these steps to run the project locally.
|
||
|
||
---
|
||
|
||
## 1️⃣ Install Dependencies
|
||
|
||
```bash
|
||
npm install
|
||
```
|
||
|
||
---
|
||
|
||
## 2️⃣ Run PostgreSQL
|
||
|
||
Make sure PostgreSQL is installed and running on your system.
|
||
|
||
Create the database if it does not exist:
|
||
|
||
```sql
|
||
CREATE DATABASE robin_network;
|
||
```
|
||
|
||
Default database configuration used in this project:
|
||
|
||
- Host: localhost
|
||
- Port: 5432
|
||
- User: postgres
|
||
- Password: 1234
|
||
- Database: robin_network
|
||
|
||
---
|
||
|
||
## 3️⃣ Create .env File
|
||
|
||
Create a `.env` file in the root directory and add:
|
||
|
||
```env
|
||
PORT=4000
|
||
|
||
# Database
|
||
DATABASE_HOST=localhost
|
||
DATABASE_PORT=5432
|
||
DATABASE_USER=postgres
|
||
DATABASE_PASSWORD=1234
|
||
DATABASE_NAME=robin_network
|
||
|
||
OTP_EXPIRE_TIME_MINUTES=5
|
||
|
||
JWT_SECRET=IOnf9828bcoeiwfnoUTFDIUWNDOINiuesvfc7632biUBEC&OInuy2vciabkjmcpqocuyBIUBFUEYVXUWVD
|
||
JWT_EXPIRATION=10d
|
||
JWT_EXPIRATION_IN_HOUR=240
|
||
```
|
||
|
||
---
|
||
|
||
## 4️⃣ Run Database Migrations
|
||
|
||
```bash
|
||
npm run migration:run
|
||
```
|
||
|
||
---
|
||
|
||
## 5️⃣ Create Admin User Manually
|
||
|
||
After migrations are completed, create an admin user manually in PostgreSQL.
|
||
|
||
Example:
|
||
|
||
```sql
|
||
INSERT INTO users (id, username, email, role)
|
||
VALUES (
|
||
'a random uuid',
|
||
'your_username',
|
||
'your_email@example.com',
|
||
'admin'
|
||
);
|
||
```
|
||
|
||
---
|
||
|
||
## 6️⃣ Start the Application
|
||
|
||
```bash
|
||
npm start
|
||
```
|
||
|
||
---
|
||
|
||
## ✅ Application URL
|
||
|
||
If everything is configured correctly, the server will run at:
|
||
|
||
```
|
||
http://localhost:4000
|
||
```
|