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
Copy file name to clipboardexpand all lines: README.md
+91-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,8 @@
1
-
# CarRental
1
+
# Car Rental
2
+
3
+
This project is a vehicle rental application that allows users to add, edit, remove, and view vehicles. It also allows users to add client email and client address information if the vehicle is rented to someone. The application is built using Angular for the frontend, NestJS for the backend, and MySQL for the database. The development environment is managed using Docker Compose.
4
+
5
+
2
6
## Docker Compose Setup
3
7
4
8
This project uses Docker Compose to manage the development environment. The setup includes three services: `db`, `backend`, and `frontend`.
@@ -7,6 +11,17 @@ This project uses Docker Compose to manage the development environment. The setu
7
11
8
12
#### Database (`db`)
9
13
14
+
##### Description
15
+
16
+
The database service uses MySQL to store all the data related to the car rental application. When you run the `db` service for the first time, it will execute all SQL scripts located in the `scripts` directory to set up the database schema and seed initial data. The scripts currently included are:
17
+
-`0_create_database.sql`
18
+
-`1_create_vehicle_brands_table.sql`
19
+
-`2_create_addresses_table.sql`
20
+
-`3_create_vehicles_table.sql`
21
+
-`4_seed_data.sql`
22
+
23
+
##### Docker compose structure
24
+
10
25
-**Image**: `mysql:8.0`
11
26
-**Ports**: `3306:3306`
12
27
-**Container Name**: `car_rental_db`
@@ -22,6 +37,12 @@ This project uses Docker Compose to manage the development environment. The setu
22
37
23
38
#### Backend (`backend`)
24
39
40
+
##### Description
41
+
42
+
The backend service is a Node.js application built with NestJS. It provides the API endpoints for the frontend to interact with the database. The backend service depends on the `db` service to be running.
@@ -41,6 +62,12 @@ This project uses Docker Compose to manage the development environment. The setu
41
62
42
63
#### Frontend (`frontend`)
43
64
65
+
##### Description
66
+
67
+
The frontend service is an Angular application that provides the user interface for the car rental application. It depends on the `backend` service to be running to fetch and display data.
68
+
69
+
##### Docker compose structure
70
+
44
71
-**Build Context**: `./apps/car-rental`
45
72
-**Dockerfile**: `./apps/car-rental/Dockerfile`
46
73
-**Command**: `npm run serve:car-rental -- --host 0.0.0.0`
@@ -71,3 +98,66 @@ docker-compose down
71
98
```
72
99
73
100
For more information on Docker Compose, refer to the [official documentation](https://docs.docker.com/compose/).
101
+
102
+
### Running Locally
103
+
104
+
To run the application locally, you need to uncomment the lines in `app.module.ts` that configure the database connection for local development:
To run the frontend locally, use the following command:
145
+
```sh
146
+
npx nx run car-rental:serve
147
+
```
148
+
149
+
To run the backend locally, use the following command:
150
+
```sh
151
+
npx nx run car-rental-backend:serve
152
+
```
153
+
Before you run backend service, do not forget to run db service.
154
+
155
+
### Running Tests
156
+
157
+
To run tests for all projects, use the following command:
158
+
```sh
159
+
npx nx run-many --targets=test
160
+
```
161
+
162
+
### VS Code Run Settings
163
+
The project includes ```./vscode``` run settings to facilitate running the application locally. Make sure to check the ```.vscode``` folder for predefined configurations.
0 commit comments