This document describes the installation and setup process for the CRM Integrator project.
- Introduction
- Prerequisites
- Installation Steps
- Configuration
- Running Locally
- Deployment
- Troubleshooting
Before starting the installation, ensure you have the following tools installed:
- Node.js version 14 or higher
- Firebase CLI
- An active Firebase project
- Google Secret Manager for storing API keys
- TypeScript installed globally
First, clone the project repository and navigate to the functions directory:
git clone https://github.com/webdevgrisha/crm-integrator.git
cd crm-integrator/functionsInstall all necessary dependencies by running the following command:
npm install-
Create a Firebase project at Firebase Console.
Note: Ensure you are on the Blaze plan; otherwise, you will not be able to run functions
-
Log in to Firebase CLI:
firebase loginDuring this step, make sure to select the Google account that has access to your Firebase project.
- Initialize Firebase in the project:
firebase init- Select "Functions: Configure a Cloud Functions directory and its files" and follow the on-screen instructions. Make sure to choose ESLint and TypeScript when prompted.
- Select "Functions: Configure a Cloud Functions directory and its files"
- Use an existing project
- Select your project created in the previous step
- Choose TypeScript
- Select the option to use ESLint
- When prompted to install dependencies with npm, select "No"
- Move all files from the root directory, except for .firebaserc and firebase.json, into the functions directory, including node_modules. Confirm the option to replace them if prompted.
After executing these commands, the project structure will look as follows:
.
├── .firebase/
├── functions/
├── docs/
│ │ ├── advanced.md
│ │ ├── installation.md
│ │ ├── secrets.md
│ │ ├── usage.md
│ ├── lib/
│ │ ├── callback24Sync/
│ │ ├── facebookSync/
│ │ ├── gmailSync/
│ │ ├── pipedrive/
│ │ ├── utils/
│ │ ├── index.js
│ │ ├── init.js
│ │ ├── interfaces.js
│ ├── src/
│ │ ├── callback24Sync/
│ │ ├── facebookSync/
│ │ ├── gmailSync/
│ │ ├── pipedrive/
│ │ ├── projectConfig/
│ │ ├── utils/
│ │ ├── index.ts
│ │ ├── init.ts
│ │ ├── interfaces.ts
│ ├── .eslintrc.js
│ ├── package.json
│ ├── tsconfig.json
│ ├── tsconfig.dev.json
│ ├── .gitignore
│ ├── README.md
│ ├── public/
│ │ ├── index.html
│ │ ├── privacy-policy.html
│ │ ├── terms-of-service.html
├── .firebaserc
├── firebase.json
- Enable Firebase Database to ensure that the tables used in the project can be created.
- Create secrets in Google Secret Manager to store API keys and other sensitive information.
You can decide which secrets to store, whether it's a JSON file or a simple string.
gcloud secrets create gmail-info --data-file=gmail-info.json
gcloud secrets create pipedrive-api --data-file=pipedrive-api.json- Ensure your Firebase project has access to these secrets. Follow the instructions on how to add a principal to allow Firebase to access the data you store: Google Cloud Functions - Configuring Secrets
To start the Firebase emulators for local development, use the command:
npm run serveTo deploy the functions to Firebase, use the command:
npm run deploy - Lint the code:
npm run lint- Automatically fix linting errors:
npm run lint:fix- View function logs:
npm run logsYour project should now be set up and ready to use. If you have any questions or issues, please refer to the documentation or contact us at roi.grisha.work@gmail.com.