githubEdit

See how it's done

To demonstrate integrating your SaaS application with Bunny, we provide a sample SaaS application written in Node.JS. This page will cover installation and configuration as well as next steps.

The Sample Saas application demonstrates the following integration features:

  • Generating a new account and contact in Bunny based on signups to your app.

  • Controlling features and limits in the SaaS app based on subscriptions in Bunny.

  • Self-service upgrade and payment through the Bunny portal.

The Sample SaaS App is a multi-tenant note taking app. The app relies on Bunny to control how many notes can be stored in each tenant. For the sake of simplicity, users are not prompted for a password when signing into the account.

Setting it up

Configure a new platform in Bunny

circle-exclamation

Since we will later install and run the Sample SaaS App locally, and Bunny will need access to it's API, we suggest installing ngrokarrow-up-right or similar to fascilitate routing the traffic to your local app. Launch ngrok with the following command to setup a tunnel:

ngrok http 3030

  1. In Products -> Platforms click New Platform.

  2. Configure it as following:\

    1. Make sure to choose your own signing key.

    2. Copy the ngrok forwarding URL to the webhook URL field: https://{your ngrok forwarding URL}/api/hook

Configure a new product in Bunny

circle-info

When you sign up for your Bunny account, it will be preloaded with demo data (accounts, contacts, products, deals etc). This can be removed by going to Other -> Settings and clicking Remove demo data in the sidebar.

  1. Setup a new product in your Bunny account. Your trial account may already have a default one with your company name. Note: It's important to select the platform created in the previous step.\

  2. Create a new feature called "Notes". Use the following settings:

  3. On the Plans and Add-Ons tab, create a new plan named "Basic". Enable Self-service purchase.

  4. Hit Save.

  5. In the Plan features section, add the newly created feature to the plan.

  6. On the Price Lists tab, create a new price list named "Monthly":\

  7. Create a new Price List Charge with the following settings:\

Configure an API key

  1. Go to Other -> API Clients and click New API Client

  2. Use the following settings: \

Install and configure the Sample SaaS app

circle-exclamation
  1. In a suitable folder on your local environment, clone the Sample SaaS repository: git clone [email protected]:bunnyapp/sample-saas.git

  2. Copy .env.example to .env and open the .env file in an editor.

  3. Replace {subdomain} with the subdomain of your Bunny account.

  4. Replace {access_token} with the access token generated when configuring the API Client earlier.

  5. Replace {webhook_signing_token} with the Webhook signing key chosen when configuring the platform earlier.

  6. Replace {price_list_code} with the code from the price list created earlier - notes_monthly

  7. Your .env file should look something like this:\

  8. In a Terminal, start the app with the following command: docker-compose up

You're all set! Navigate to http://localhost:3030 to sign up for your Sample SaaS Notes app account.

Last updated

Was this helpful?