description |
---|
Setting up the backend locally |
Once you have cloned the Digitomize repository and installed the dependencies in the root directory, you can take the following steps to setup the backend of the project.
cd digitomize/backend
npm install
You will be using the same Firebase App as the frontend or if you haven't already created a Firebase app, you can follow these instructions.
To get the Firebase App credentials, you will need to:
- select the project
- go to the 'Project Overview' by clicking on the gear icon
- choose the 'Project Settings' option
- navigate to the 'Service Accounts' tab
- click on 'Generate new private key'. This will generate a private key and automatically download a JSON file containing the app credentials. The downloaded JSON file will have the following structure:
{
"type": "service_account",
"project_id": "your-project-id",
"private_key_id": "your-private-key-id",
"private_key": "-----BEGIN PRIVATE KEY-----\nYourPrivateKey\n-----END PRIVATE KEY-----\n",
"client_email": "your-service-account-email@your-project-id.iam.gserviceaccount.com",
"client_id": "your-client-id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/your-service-account-email%40your-project-id.iam.gserviceaccount.com"
}
To add the Firebase App credentials, you can take the folllowing steps:
- Create a
.env
file - Copy the
.env.example
file or use the following template:
TEST=Env file connected.
MONGODB_URL=mongodb://localhost:27017/digitomize
PORT=4001
BACKEND_URL=http://localhost:4001
CONTESTS=true
USERS=true
NODE_ENV=development
# Firebase Configuration
FIREBASE_CREDENTIALS= # you need to add JSON for this
- Copy the downloaded JSON file into the
FIREBASE_CREDENTIALS
variable
To ensure that the backend server is functional, you can try starting the server by running the following command
npm start
You are all setup. 🎉
To run the application, start both the frontend and backend by following these instructions.