ambianic-cloud-api

1.6.0 • Public • Published

Ambianic-subscriptions

Repo for ambianic premium subscription management

This repo hosts [Netlify functions](https://www.netlify.com/products/functions/) that handle Ambianic premium user subscriptions. This is code that cannot run in the browser PWA, because it needs access keys to subscription and payment gateway services (Stripe) shared between all app users. If the code runs in the PWA, users will be able to see and manipulate each other's premium subscription data

The image below shows the architecture of these serverless functions in connection with the Ambianic PWA. serverless-functions-architecture

Running Locally

The serverless functions within this project are managed using netlify-dev. Start the functions emulator from the netlify directory using yarn netlify-dev to listen for requests to any of created functions on port 5050.

All credentials within this project are managed using environment variables and GitHub Secrets. To run the functions here locally using the netlify dev command, create a .env file in the root directory with the following values;

STRIPE_TEST_KEY=STRIPE_KEY

# The product ID which users are subscribed to.
EMAIL_PRODUCT_ID=STRIPE_KEY

CI / CD Pipeline

The three currently available serverless function endpoints are all tested using Postman Tests. The API documentation explaining the endpoints can be found in the GitHub pages for this repository here. An exported file of the postman collection in json format is available at ./tests/postman/ambianic-functions-collection.postman_collection.json.

Continuous integration for this project is managed using GitHub Actions, driven using the steps in the .github/workflows/ci.yaml file. The following sensitive credentials used within the CI jobs are managed using Github Secrets;

  • STRIPE_TEST_KEY
  • GITHUB_TOKEN
  • NPM_TOKEN
  • REPOSITORY_ACCESS_TOKEN

Readme

Keywords

none

Package Sidebar

Install

npm i ambianic-cloud-api

Weekly Downloads

24

Version

1.6.0

License

MIT

Unpacked Size

872 kB

Total Files

46

Last publish

Collaborators

  • vickywane