/referral-code-api

NodeJS REST API for referral codes powered by Firebase

Primary LanguageTypeScript

referral Code API

About

What is this repo?

This is a Firebase Function + Express API for referral codes, with Firestore as the database.

What can I do with the API?

  • Create a new referral code using an existing one, this will link the newly created referral code with the one used in a tree like structure.
  • Perfom an action using a referral code, this will update all the parents of the referral code with the action as well.
  • View the referral code data: parent referral code, children referral code, data on children referral code actions.
  • [WIP] Send lifecyle emails update. When someone created a referral code or performed an action using your referral code.

Dev env setup

First, install the following VSCode extensions: ESLint, Jest, sort-imports, Prettier - Code formatter.

Then navigate to the repo using the terminal and install the depencencies:

npm run ci

Finally, run the development server:

npm run serve

You will also need to run unit tests before making a pull request or changing the tests with:

npm run test

App Structure - Outdated

TODO - update this section

  • pages - where all the pages are found.
  • components - where all the commonly used components are found. Ex: button, links, input.
  • pages/api - where the backend apis are found, mostly to interact with the database.

Resources

Firebase:

  • Firebase Console - (you will need to request access to access this link) view stats about the website, manage resource and interact with the database.
  • Firestore Documentation - documentation on functions to interact with the firestore database.