Skip to content
    Back to all Bounties

    Earn 90,000 ($900.00)

    Time Remainingdue 2 years ago
    Canceled

    Build a JS SDK for the web + an authenticated Node.js backend that lets users login, buy credits, and set usage quotas.

    vibo
    vibo
    Posted 2 years ago

    Bounty Description

    Build a JS SDK for the web + an authenticated Node.js backend that lets users login, buy credits, and set usage quotas.

    Problem Description

    Need a JS SDK built for the frontend that exposes a global function called getAccessToken().

    When called, it should return a promise that does the following:

    1. Checks if user is logged in.

    If not, give options to login with "Google" and "Github" in a top-right popup.

    1. Checks if user has available credit.

    If not, lead user to purchase credits.

    -> Topup in same popup.
    -> Add payment method in new tab.

    1. Is quota up for current domain?

    Use slider in same popup to select quota.

    1. If all checks pass, calls the backend using the authentication headers/tokens of Google/Github.

    2. The backend should check if the user has enough credit and quota for the domain.

    3. If all checks pass, the backend should return a randomly generated access token (The access token can be anything random, not going to be used at this stage).

    Here's a flowchart for the above. https://i.imgur.com/tx7Iwsk.png.

    These are essentially three components:

    1. SDK
    2. Backend
    3. Small web app for adding payment methods (Important that this isn't in the SDK popup as the keystrokes can be hijacked by the site.)

    Acceptance Criteria

    • Both the SDK and backend must be built with Typescript.
    • The SDK should be easily publishable to NPM. You can use this guide to bootstrap this.
    • The SDK needs to be plug-and-play. No dependencies.
    • Using Stripe (I'm not aware of the specifics here), find a way to let users purchase credits and remember their payment method for the next time they want to top-up.