Backend Specs

Technical documentation on how I AM HUMAN backend works

The backend for the I-am-human app is built using Node.js deployed to Google Cloud using Firebase-admin and connects to a Supabasearrow-up-right database.

Link to our source code on GitHub herearrow-up-right.

API Endpoints

Database CRUD Operations API

  • There are 4 endpoints which are pretty much self explanatory : POST /api/select , api/insert , api/delete , api/update

  • This API helps to retrieve and update the supabase database.

  • Request Body

    • /api/insert :

      const { match = undefined, table } = req.body;
    • /api/select :

      const { match = undefined, table } = req.body;
    • /api/update :

      const { match, body , table } = req.body;
    • /api/delete :

      const { match, table } = req.body;
  • Response: The API will respond with the data and any error if there is:

    RESPONSE : { data: [..], error:"" }

is_admin API

  • Endpoint: POST /api/is-admin

  • Request body:

  • Response: The API will respond with a boolean value indicating whether the user with the specified ID is a superadmin or not.

Community Scoreboard API

Endpoint: GET /scoreboard

Checkout scoreboard branch to run the code

This API helps users to fetch data of humans onboarded using a particular community name and vertical.

Query Param: communityName, communityVertical: Mention the name or vertical of the community you want to receive data.

Response: The API will respond with an object containing data which is an array of objects and error which is a string of error message in case any error occurs.

To help non technical users, we have made our scoreboard API open for community usage, following is the curl you can use to fetch data of humans onboarded using communityName=marketingdao and communityVertical=infrastructure

Installation and Setup

To install and set up the backend for the I-am-human app, follow these steps:

  1. Clone the repository from GitHub.

  2. Install the required dependencies using NPM.

  3. Set up environment variables by creating a .env file in the root directory with the Supabase URL and key.

  4. Start the server.

Dependencies

The backend for the I-am-human app uses the following dependencies:

  • @supabase/supabase-js: A JavaScript client for interacting with the Supabase API

  • body-parser: A middleware for parsing request bodies

  • cors: A middleware for enabling CORS

  • express : A NODE JS backend server library

  • firebase-admin and firebase-functions: Used to host the APP on the firebase cloud functions

Last updated