Skip to content

An API written in Node.js for integrate two different services: an ERP and a CRM. Also using MongoDB.

License

Notifications You must be signed in to change notification settings

rckmath/api-integration

Repository files navigation

API Integration

This project wises aims to integrate two distinct platforms: Pipedrive and Bling. The first one catching up all registered deals with "won" status and the second one receiving these won deals as an order, then we save a collection aggregating the won deals orders per day with the total value of the all orders.

Table of Contents

Features

  • Integrate Pipedrive deal system, getting all won deals
  • Integrate Bling order creation, registering the according to Pipedrive deals
  • Gather deal and order data post creation into a collection and bring the document to an API

Setup

Pre-requisites

  • Node 14.17.5 LTS -> To run the application if you will not use Docker
  • NPM -> To install and use the package.json scripts
  • Docker -> If you don't have a prepared environment setup
  • MongoDB -> To locally setup or MongoDB Atlas cluster use
  • Pipedrive -> To integrate with Pipedrive, create an account and get the API key
  • Bling -> To integrate with Bling, create an account and get the API key

Instructions

Done with the pre-requisites, the next step is to follow these instructions:

  1. Clone the repository
  2. Open the terminal at the project root folder and type "npm install" to install all dependencies
  3. Create a file named as ".env-development" and a ".env-production" at the root of the project.
  4. Use the following code in the created file:
NODE_ENV=development

PORT=3000

DATABASE_URI=mongodb+srv://<YOUR_HOST>
DATABASE_USER=<YOUR_MONGO_DB_USER>
DATABASE_PASSWORD=<YOUR_MONGO_DB_PASS>
DATABASE_HOST=<YOUR_HOST>
DATABASE_NAME=<YOUR_NAME>

BLING_MOCK_PRODUCT_CODE=<A_DEFAULT_PRODUCT_CODE_CREATED_AT_BLING>
BLING_BASE_URL=<THE_BLING_BASE_URL>
BLING_API_KEY=<YOUR_PIPEDRIVE_API_KEY>

PIPEDRIVE_API_KEY=<YOUR_PIPEDRIVE_API_KEY>
PIPEDRIVE_BASE_URL=<THE_PIPEDRIVE_BASE_URL>

For every environment variable you need to substitute with your own configured data.

  1. With setup done, you just need to test running npm run dev OR npm run docker
  2. If everything's OK, you should could test the server status through the endpoint: your_domain:your_port/api/status which returns a JSON with basic information and the terminal should show a log like GET /api/status 200 1.152 ms.
  3. Have fun! :)

Docker

This project is Docker compatible, and I've used the following configuration in order to set-up the project with Docker:

Dockerfile

FROM node:lts-alpine

WORKDIR /usr/src/app/

COPY package*.json ./

RUN npm install --production

COPY . .

RUN chmod +x docker.entrypoint.sh
ENTRYPOINT [ "./docker.entrypoint.sh" ]

docker.entrypoint.sh

#!/bin/sh
npm run start & npm run start:job

Technologies

  • ⭐ Node.js
  • ⭐ Express
  • ⭐ Moongose
  • ⭐ MongoDB Atlas
  • ⭐ Docker
  • ⭐ Pipedrive
  • ⭐ Bling

Environment

  • 🖥️ Visual Studio Code for coding
  • 🖥️ Robo3T for database management
  • 🖥️ Postman for API testing
  • 🖥️ Git for code versioning
  • 🖥️ Spotify music for focusing
  • 🖥️ Stack Overflow for debugging

About

An API written in Node.js for integrate two different services: an ERP and a CRM. Also using MongoDB.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published