File tree Expand file tree Collapse file tree 8 files changed +84
-38
lines changed Expand file tree Collapse file tree 8 files changed +84
-38
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ frontend/.idea
36
36
backend /.git
37
37
frontend /.git
38
38
39
+ backend /dbdata-old
39
40
backend /dbdata
40
41
41
42
# TODO: For demo purposes we allow .env to be pushed
Original file line number Diff line number Diff line change 26
26
* Docker
27
27
* Nginx
28
28
29
+ ## Setup
29
30
31
+ ### Run and Deploy Instantly
30
32
33
+ ### This would run the script to install and setup backend and frontend apps
34
+ ``` bash
35
+ $ chmod +x start.sh
36
+ $ chmod +x stop.sh
37
+ ```
31
38
32
- ## Setup
33
39
40
+ #### Start the docker apps
41
+ ``` bash
42
+ $ ./start.sh
43
+ ```
34
44
35
45
36
- ### Run and Deploy Instantly
46
+ #### Stop the docker apps
37
47
``` bash
38
- $ docker-compose up
48
+ $ ./stop.sh
49
+ ```
39
50
40
- or
51
+ < br >
41
52
42
- $ docker-compose up --build
43
- ```
44
53
54
+ ---
45
55
46
- ### Run Individually
56
+ ### Run Manually
47
57
48
58
#### 1) Backend (default url http://localhost:8888)
49
59
50
60
``` bash
51
61
$ cd backend
62
+
63
+ # install deps
52
64
$ pnpm install
65
+
66
+ # run mysql db server
53
67
$ docker-compose up
68
+
69
+ # run prisma migration
70
+ $ npx prisma migrate dev
71
+
72
+ # (optional) add predefined data to db
73
+ $ npx prisma db seed
74
+
75
+ # run backend app
76
+ $ pnpm run start
77
+ or
78
+ $ pnpm run start:dev
54
79
````
55
80
56
81
57
82
# ### 2) Frontend (default url http://localhost:8080)
58
83
` ` ` bash
59
84
$ cd frontend
60
85
$ pnpm install
61
- $ pnpm run start
86
+ $ pnpm run dev
62
87
` ` ` `
63
88
64
89
Original file line number Diff line number Diff line change @@ -20,6 +20,16 @@ $ pnpm run start:dev
20
20
$ pnpm run start:prod
21
21
```
22
22
23
+
24
+ > Once backend mysql db is running we need to run Prisma CLI to apply migrations and generate the Prisma client:
25
+
26
+ ``` bash
27
+ $ npx prisma migrate dev
28
+
29
+ $ npx prisma generate
30
+ ```
31
+
32
+
23
33
## Test
24
34
25
35
``` bash
@@ -33,13 +43,6 @@ $ pnpm run test:e2e
33
43
$ pnpm run test:cov
34
44
```
35
45
36
- ##
37
- Use Prisma CLI to apply migrations and generate the Prisma client:
38
-
39
- ``` bash
40
- $ npx prisma migrate dev
41
- $ npx prisma generate
42
- ```
43
46
44
47
### Seed the Cafes and Employees (add dummy data)
45
48
@@ -57,7 +60,7 @@ Then just to be sure run again...
57
60
$ npx prisma migrate dev
58
61
```
59
62
60
- After that, seed data is now added.
63
+ After that, seeded data is now planted in the db ;-)
61
64
62
65
63
66
## API
Original file line number Diff line number Diff line change @@ -9,17 +9,3 @@ services:
9
9
environment :
10
10
- MYSQL_ROOT_PASSWORD=password
11
11
- MYSQL_DATABASE=cedb
12
-
13
-
14
- backend :
15
- build : .
16
- depends_on :
17
- - db
18
- ports :
19
- - ' 8888:8888'
20
- volumes :
21
- - .:/app
22
- environment :
23
- - DATABASE_URL=mysql://root:password@db:3306/cedb
24
- - NODE_DOCKER_PORT=8888
25
-
Original file line number Diff line number Diff line change @@ -13,6 +13,6 @@ async function bootstrap() {
13
13
} ;
14
14
15
15
app . enableCors ( options ) ;
16
- await app . listen ( port ) ;
16
+ await app . listen ( port || 8888 ) ;
17
17
}
18
18
bootstrap ( ) ;
Original file line number Diff line number Diff line change 3
3
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
4
5
5
6
- ### Features
6
+ ## Features
7
7
8
8
- ⚡ [ React.js] ( https://react.dev/ )
9
9
- ⚡ [ Material-UI] ( https://mui.com/ )
@@ -25,24 +25,25 @@ This template provides a minimal setup to get React working in Vite with HMR and
25
25
Run the following command on your local environment:
26
26
27
27
``` shell
28
- git clone --depth=1 https://github.com/sonht113/react-boilerplate-for-starter.git
29
- cd my-project-name
30
- pnpm install
28
+ $ pnpm install
31
29
```
32
30
33
31
Then, you can run locally in development mode with live reload:
34
32
35
33
``` shell
36
- pnpm run dev
34
+ $ pnpm run dev
37
35
```
38
36
39
- Open http://localhost:5173 with your favorite browser to see your project.
37
+ Open http://localhost:5173 (development) with your favorite browser to see your project.
40
38
39
+ > ** Important:**
40
+ > Backend should be already running at http://localhost:8888 or whatever the .env settings is configured
41
+
42
+ ## Project Structure
41
43
``` shell
42
44
.
43
45
├── README.md # README file
44
46
├── .github # GitHub folder
45
- ├── .husky # Husky configuration
46
47
├── public # Public assets folder
47
48
├── src
48
49
│ ├── apis # Common apis folder
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Install pnpm globally
4
+ echo " ===========[ Install local pnpm globally...] ============"
5
+ npm install -g pnpm
6
+
7
+ # Navigate to backend directory and install dependencies
8
+ echo " ===========[ Install backend deps...] ============"
9
+ cd backend
10
+ pwd
11
+ pnpm install
12
+
13
+ # Return to the root directory and start Docker containers
14
+ echo " ===========[ Run main docker command...] ============"
15
+ cd ..
16
+ pwd
17
+ docker-compose up -d
18
+
19
+ # Navigate back to backend directory and run Prisma migrations
20
+ echo " ===========[ Run prisma migrate in backend...] ============"
21
+ cd backend
22
+ pwd
23
+ npx prisma db seed
24
+ npx prisma migrate dev
25
+
26
+ echo " ===========[ Setup complete! ] ============"
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ echo " ===========[ Stop docker] ============"
4
+ docker-compose down
You can’t perform that action at this time.
0 commit comments