Cybersecurity
Init

Clone the repository

Follow all instructions in the πŸ™Repository, but choose the 2. repository (opens in a new tab).
If you completed the "Web App Setup" chapter, you can just directly clone the second repository, because you have already configured the SSH key. Implementation is slightly adjusted for this part, so you have to clone the second repository, even though you did the first part.

Install dependencies

  1. In the terminal, navigate to the client directory and run npm install to install all dependencies.
  2. After it is completed, do the same for the server directory.

Initialize Database

For the database, we are using PostgreSQL.
The database server is already running on the VM, so we are just going to create the database, tables and seed the tables with some data.

Before running following commands, terminate (CTRL + C) the running server in the terminal and insert the commands in the server directory

Create a database

In the terminal, run the following command:

npm run db-create

Create tables and insert data

Run the following command:

npm run db-seed

Drop database

If you corrupt the database and data in it during exposing the vulnerabilities, you can drop the database and create it again.

⚠️

Do not run this command now, because it will erase everything you just created.

npm run db-drop
ℹ️

In case of need, to recreate the database, tables, and records, run npm run db-drop, npm run db-create and npm run db-seed commands.

[Optional] Interact with the database

πŸ’‘
  1. To interact with the PostgreSQL database server, you can use psql CLI.
  • You can type SQL commands to interact with the database, and it also provides meta-commands to interact with the server.
  1. Second option is to use preinstalled GUI tool called DBeaver, but we strongly recommend using psql CLI. A tutorial for these two tools is not part of this tutorial, but there are many available online.

Run the Application

  1. In the terminal, navigate to the server directory and run npm run dev to start the server.
  2. In another terminal, navigate to the client directory and run npm start to start the client.
  3. Open the browser and navigate to http://localhost:3001 and familiarize yourself with the application.