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.jsonfile).npm start -
Directly using Node.js or nodemon
node index.jsornodemon index.js
You can access the needed environment variables in the .env.example
- Set the
DATABASE_URLvalue to your own database information. - By default,
PORTis 3000. However, you can change the port to your own port as long as it's not in use. - Set the
NODE_ENVto 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_SSLandPRODUCTION_SERVER_NO_SSLvalues are fixed. These are used for sending E-tickets to the user's email.- The default value of
ETICKET_PDF_PATHmay 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_IDandGOOGLE_CLIENT_SECRETto your own Google Client. This is to be used as the OAuth authentication. - Provide secure
JWT_SECRETby 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_USERto your own gmail address. - Set the
EMAIL_PASSto your own gmail app password. SESSION_SECRETapplies the same asJWT_SECRET- Set the
FRONTEND_RESET_PASSWORD_URLto 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_URLapplies the same asFRONTEND_RESET_PASSWORD_URL- Set the
MIDTRANS_SERVER_KEYto your own Midtrans Server Key. - Set the
MIDTRANS_CLIENT_KEYto your own Midtrans Client Key.
- Run
npx prisma migrate devin 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.shcommand 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.jscommand (sequentially) if you are already in skyticket-backend/src/ directory. - Ta-da, you have some data in your database!