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 Supabase database.
Link to our source code on GitHub here.
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:
const { wallet } = req.body;
Response: The API will respond with a boolean value indicating whether the user with the specified ID is a superadmin or not.
RESPONSE : { is_super_admin: boolean }
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.
RESPONSE : { data: [..], error:"" }
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
curl --location
'https://scoreboard-ophc7vkxsq-uc.a.run.app/scoreboard?communityName=marketingdao&communityVertical=infrastructure'
Installation and Setup
To install and set up the backend for the I-am-human app, follow these steps:
Clone the repository from GitHub.
Install the required dependencies using NPM.
Set up environment variables by creating a
.env
file in the root directory with the Supabase URL and key.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 APIbody-parser
: A middleware for parsing request bodiescors
: A middleware for enabling CORSexpress
: A NODE JS backend server libraryfirebase-admin and firebase-functions: Used to host the APP on the firebase cloud functions
Last updated