# Setting Up Backend

### Cloning the repository

Clone the repository available at <https://github.com/coronasafe/superhero_frontend>

```
git clone https://github.com/coronasafe/superhero_frontend.git
```

### Setting up the database

In src/config/config.js

```
{
  "db": {
    "development": {
      "username": "",
      "password": "",
      "database": "",
      "host": "",
      "dialect": "postgres",
      "port": 5432
    },
    "staging": {
      "username": "",
      "password": "",
      "database": "",
      "host": "",
      "dialect": "postgres",
      "port": 5432
    },
    "production": {
      "username": "",
      "password": "",
      "database": "",
      "host": "",
      "dialect": "postgres",
      "port": 5432
    },
    "staging_heroku": {
      "username": "",
      "password": "",
      "database": "",
      "host": "",
      "dialect": "postgres",
      "port": 5432
    }
  },
  "env": {
    "HOST": "",
    "JWT_SECRET": "",
    "KCC_GMAPS_API_KEY" : "",
    "NODE_ENV": "production"
  }
}
```

Add database credentials corresponding to each stage.

Only Relational databases  supported by Sequelize ORM can be used.

Set `NODE_ENV` to correct stage before deployment or remove this key and set it for each server.

Set  `KCC_GMAPS_API_KEY` to your Google Maps API Key

Copy your Firebase Service Account JSON to `src/keys`

In `src/utils/fcm.js`&#x20;

```
const serviceAccount = require("../keys/");

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: ""
});

```

Add Firebase serviceAccount file and database URL

Go to the root directory of the project

Run `npm install` and `npm start`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://riafy-2.gitbook.io/coronasafe-logistics-deployment/setting-up-backend.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
