You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Install the dependencies in both the `/client` and `/server` directories:
30
-
31
-
```bash
32
-
cd EcoSync/client
33
-
npm install
34
-
35
-
cd ../server
36
-
npm install
37
-
```
38
-
39
-
## Configuration
40
-
41
-
In the `/server` & `/client` directory, rename `.env.example` to `.env` and fill in your PostgreSQL database details `with you postgres password e.g: "postgresql://postgres:YOURPASSWORDHERE@127.0.0.1:5432/ecosync"` and other environment variables from [this google doc link](https://docs.google.com/document/d/1j1UFD3U4ejqeDRb26N9WffqvaLzwYYAxGY2OaWlZTO4/edit?usp=sharing).
42
-
43
-
## Running the Application
44
-
45
-
1. Start the backend server:
46
-
21
+
2. Open the source directory in a terminal and give the following command
47
22
```bash
48
-
cd EcoSync/server
49
-
npm run dev
23
+
docker compose up --build
50
24
```
25
+
wait for the docker compose to complete and then frontend application will be available running at `http://localhost:3000`, and the backend server will be running at `http://localhost:8585` (or whatever port you specified).
51
26
52
-
2. In a new terminal window, start the frontend application:
53
-
27
+
3. After backend and frontend services are running again open the source directory in `another terminal` and give the following command
54
28
```bash
55
-
cd EcoSync/client
56
-
npm run dev
29
+
docker exec -it backend /bin/bash -c "cd ./src && npx prisma migrate dev --name init && npx prisma db seed 2> /dev/null || echo \'Database is already seeded\'"
57
30
```
58
-
59
-
The frontend application will be available at `http://localhost:3000`, and the backend server will be running at `http://localhost:8585` (or whatever port you specified).
31
+
This will do the prisma migration and run the seed file to push initial data.
60
32
61
33
## Credentials set by the initial db migration
62
34
@@ -76,17 +48,30 @@ The frontend application will be available at `http://localhost:3000`, and the b
76
48
}
77
49
}
78
50
```
79
-
## To run using Docker
80
-
Go to the source directory and give the following command
81
-
```bash
82
-
docker compose up --build
83
-
```
84
-
## To run using AWS Backend (if docker compose fails)
51
+
52
+
## RUNNING THE BACKEND USING AWS (IF DOCKER COMPOSE FAILS!)
85
53
Go to `client\data\apiRoutes` and comment the `first line` and uncomment the second
86
54
```js
87
55
exportconstbaseUrl="http://localhost:8585"; // Uncomment to run Locally
88
56
// export const baseUrl = "http://13.250.36.61"; // Uncomment to run in AWS
89
57
```
58
+
## CONFIGURATION
59
+
In the `/server` & `/client` directory, rename `.env.example` to `.env` and fill in your PostgreSQL database details `with you postgres password e.g: "postgresql://postgres:YOURPASSWORDHERE@127.0.0.1:5432/ecosync"` and other environment variables from [this google doc link](https://docs.google.com/document/d/1j1UFD3U4ejqeDRb26N9WffqvaLzwYYAxGY2OaWlZTO4/edit?usp=sharing).
60
+
61
+
## RUNNING FRONTEND
62
+
Run the frontend using docker:
63
+
```bash
64
+
docker compose up --build
65
+
```
66
+
or locally by running following command:
67
+
```bash
68
+
cd .\client\
69
+
npm i
70
+
npm run dev
71
+
```
72
+
73
+
74
+
## NOTE ON USING AWS BACKEND
90
75
When running on AWS the frontend might face some slow network problems which can be fixed by switching speed from no thorttling to fast 3G. [You can check this video to see the demonstration of the problem mentioned here](https://drive.google.com/drive/folders/1B5N5o0ms7mizSYm5HNiAjJj0O82Zb1tq?usp=sharing).
0 commit comments