Git Product home page Git Product logo

bitespeed-backend's Introduction

Bitespeed Backend Task: Identity Reconciliation

Note : I am using Render.com for deployment and I am using the free tier. So it gets spindown with inactivity,
which can delay requests by 50 seconds or more.So please wait for 50 seconds for getting to initial request
and then it will work fine. Sorry for this issue.

NOTE: You can use the /api-docs to try the api -> Link to Api Documentation

This project is a web service designed to identify and reconcile customer identities across multiple purchases. It tracks customer contact information in a relational database and consolidates contact data based on provided email or phone number.

Project Overview

  • Framework: Node.js with Express
  • Database: PostgreSQL
  • ORM: Sequelize
  • Deployment: Render.com

Features

  • Identify and reconcile customer identities based on email and/or phone number.
  • Link multiple contacts under a primary contact.
  • Consolidate and return contact information, including primary and secondary contacts.

Deployed API

The API is deployed at: https://bitespeed-backend-ern2.onrender.com

Endpoint

  • POST /api/identify

Request Body

{
  "email": "string",
  "phoneNumber": "string"
}
  • Either email or phoneNumber must be provided. Response Body
{
  "contact": {
    "primaryContactId": number,
    "emails": ["string"],
    "phoneNumbers": ["string"],
    "secondaryContactIds": [number]
  }
}

Running the Project Locally

Prerequisites

  • Node.js installed (version 14 or later)
  • PostgreSQL installed and running

Steps

Clone the Repository

git clone https://github.com/yourusername/bitespeed-backend.git
cd bitespeed-backend

Install Dependencies

Copy code

npm install

Configure Environment Variables

Create a .env file in the root directory and add your database configuration:

env

DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=your_db_port
DB_DIALECT=postgres

Run Migrations

Make sure your database is created and then run the migrations:

npx sequelize-cli db:migrate

Start the Server

npm run dev

The server will start on http://localhost:3000.

Example Request

To test the API locally, you can use a tool like Postman or curl.

Using curl

curl -X POST http://localhost:3000/api/identify -H "Content-Type: application/json" -d '{"email":"[email protected]", "phoneNumber":"123456"}'

Using Postman

  1. Open Postman.
  2. Create a new POST request.
  3. Set the URL to http://localhost:3000/api/identify.
  4. Set the Content-Type header to application/json.
  5. In the body, use raw JSON format to send the request:
{
  "email": "[email protected]",
  "phoneNumber": "123456"
}

bitespeed-backend's People

Contributors

dev265545 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.