Skip to main content

Nile Examples

This collection of examples demonstrates how to use Nile as a control plane for an Infrastructure SaaS product.

The mock scenario in these examples is a company that provides databases as SaaS. For this SaaS company, you define your example entity schema called SaaSDB in the file SaaSDB_Entity_Definition.json that has a schema for each database instance.

For demonstration purposes, these examples simulate different organizations and entity instances from mock customers:

  • dbList.json: list of entity instances, i.e., databases. Each of these instances conforms to the SaaSDB schema
  • userList.json: list of users of each database

First run the Quickstart to setup your control plane in Nile, and then you can run the other modules for different use cases. The modules can also be run sequentially to build on top of one another, in which case, we recommend running them in the order presented here to build up your SaaS as you go.

Note: the languages presented below are an indication just of which examples have been developed, not of what's available. Please see the Nile API and SDK documentation for details.

Contents

Setup

To run these examples, you need to access to Nile. Please reach out for more information.

For all examples, you need to set the following parameters that represent your control plane configuration in Nile. These can be an existing control plane or a new one will be created for you from these values.

  • NILE_URL
  • NILE_WORKSPACE
  • NILE_DEVELOPER_EMAIL
  • NILE_DEVELOPER_PASSWORD
  • NILE_ORGANIZATION_NAME
  • NILE_ENTITY_NAME

At the top-level of the examples, copy the .env.defaults file to .env:

cp .env.defaults .env

Set the values in this .env file to match the values you want in your control plane, and it will be used for all the examples.

Quickstart

Start with the quickstart to configure a base Nile control plane. This provides a simple setup to learn the concepts but also serves as the foundation for the other examples below.

  • Quickstart | JS SDK | Setup a minimal Nile control plane with a single tenant

Multi-tenancy

Tenants have access to specific organizations that have isolated sets of resources. Users are allowed to access only the entity instances in the organizations to which they have been added.

  • Multi-tenancy | JS SDK | Setup the Nile control plane with multiple tenants and users

Data Plane

These examples show how to synchronize, e.g. reconcile, your data plane and control plane in real time with Nile events. As instances are created or destroyed from the control plane, the example reconciler creates or destroys data plane deployments. Even if you're using another deployment tool like Kubernetes or Terraform, similar principles apply as they do for Pulumi.

Authorization

Attribute-based access control (ABAC) is an authorization model that gives you fine-grained authorization capabilities. You can configure these in the control plane so that they are aligned to your business's security policies.

Webapp

Configure a front-end web application that is customizable on a per-tenant basis.

  • Webapp | JS SDK | Builds a self-service frontend that integrates with Nile on the backend

Metrics

Observability is a critical use case for any SaaS to be able to measure and monitor consumption and do accurate tenant billing. These metrics should be exposed externally to the end user as well as internally for business operations.

coming soon