Team Name: Djarum 76 (Tim 7) Project Title: SkyTicket
Praise be to Allah for all of our health and for making this final project run smoothly.
Shout out to:
For their huge contribution to this project. Thanks, guys!
And also big thanks to our mentors:
- Mas Febrian Aditya Ramdahan as the Mentor of this batch's Back-End Javascript course.
- Mas Imam Taufiq Hermawan as the Mentor of this batch's Fullstack Web Javascript course.
- Mas Jensen Alimukti as the former mentor of this batch's Back-End Javascript course.
Before installing, ensure you have the following prerequisites installed on your system:
- Node.js: The project requires Node.js to run. You can download it from Node.js official website.
- npm: npm (Node Package Manager) is used to manage the dependencies and should come installed with Node.js.
To set up the project for development on your local machine, please follow the steps below:
- First, clone this repository to your local machine using Git commands. For example:
git clone https://github.com/SkyTicket/skyticket-backend.git
cd skyticket-backend
-
Run the following command in the root directory of the project to install all necessary dependencies:
npm install
Once the installation is complete, you can start the application using one of the following methods:
-
npm
Automatically start using nodemon (if you have installed all the required dependencies and configured the value of "start" under the "scripts" to "nodemon app.js" in
package.json
file).npm start
-
Directly using Node.js or nodemon
node index.js
ornodemon index.js
You can access the needed environment variables in the .env.example
- Set the
DATABASE_URL
value to your own database information. - By default,
PORT
is 3000. However, you can change the port to your own port as long as it's not in use. - Set the
NODE_ENV
to either 'development', 'test', 'staging', or 'production'. However, in this case, since you will try it on your local computer, use 'development' as the value. STAGING_SERVER_NO_SSL
andPRODUCTION_SERVER_NO_SSL
values are fixed. These are used for sending E-tickets to the user's email.- The default value of
ETICKET_PDF_PATH
may not work in your machine. You may change it to the full or specific directory to skyticket-backend/public/etickets. - Set the value of
GOOGLE_CLIENT_ID
andGOOGLE_CLIENT_SECRET
to your own Google Client. This is to be used as the OAuth authentication. - Provide secure
JWT_SECRET
by running this on your terminal:node -e "console.log(require('crypto').randomBytes(256).toString('base64'));"
. Then, copy and paste the output as the value ofJWT_SECRET
. However, since you will try this on your local machine, it's fine to use the default value as theJWT_SECRET
- Set the
EMAIL_USER
to your own gmail address. - Set the
EMAIL_PASS
to your own gmail app password. SESSION_SECRET
applies the same asJWT_SECRET
- Set the
FRONTEND_RESET_PASSWORD_URL
to the Front-End's host. Since you will run it on your local machine, use the default value, but with port that you use to run the Front-End locally. FRONTEND_TRANSACTION_HISOTRY_URL
applies the same asFRONTEND_RESET_PASSWORD_URL
- Set the
MIDTRANS_SERVER_KEY
to your own Midtrans Server Key. - Set the
MIDTRANS_CLIENT_KEY
to your own Midtrans Client Key.
- Run
npx prisma migrate dev
in the skyticket-backend/src/ directory. - Wait for the database migration to be completed.
- Voila, your database is ready!
- Run src/flights-seeder.sh by using
sh flights-seeder.sh
command if you are already in skyticket-backend/src/ directory. - After that, run
node prisma/seeders/seats.seed.js
,node prisma/seeders/flight_seat_assignments.seed.js
, andnode prisma/seeders/users.seed.js
command (sequentially) if you are already in skyticket-backend/src/ directory. - Ta-da, you have some data in your database!