Quick Start

Last updated: September 19th, 2023

Getting Started

Registration

To get started with Sapien you will need an account. Visit the registration page and fill in the fields required.

Creating an App

Sapien works in an app-like fashion. This means every gateway you create is considered as an application.On your Dashboard click on the Create App button to create a new gateway application. Fill in the fields required and click on the Create button. This will auto create an gateway url for you to give to the client side.



Example:

Let's say we are building an software named BoardHub, and in this software we have 6 microservices on the backend and we need to expose all this microservices to our clients or the front-end developer. We can create an app on Sapien and call it "boardhub-backend" or "boardhub".

Useful Tip:

The gateway url is the single entry point for all the client side requests to your server side architecture

Creating an app rules
  • App name should be in lowercase
  • App name should not contain any special characters apart from dash (-)
  • App name should be unique

App Configuration

Each App has a set of default configurations. For you to achieve ultimate experience and benefits with Sapien you will need to modify some of the configs based on your needs. To modify the configs of an app, click on the View button besides your app name on your dashboard.

Useful Tip:

Asses your gateway needs before changing the configurations for your app

Sapien Configurations are defined below

Service Definations

The whole purpose of a gateway is to re-route traffic from the client side to the server side using only one single API or rather one single gate. This allows for your clients to continue operation even if the server side changes. It also allows for your server side to continue being annonymous and grow in any direction.

For all this to happen, Sapien allows you to add the location and names in terms of ip address and service name in a json object as below

Now this is a very important part. Let's break it down.

  1. URL attribute: This value is the URL/IP that the service is hosted on. As above I have a service running locally on "port 9004".
    This is where the traffic will be re-routed to.
  2. Name Attribute: This will be used to direct traffic to the relevant microservices. This value should be a part of your server urls.

    Calling via entraway structure:

    gateway url + "/name attribute" == "/url attribute"+"/anything else the user adds"

    Example:

    boardhub.sapienafrica.com + "/user" == "http://127.0.0.1:9004"+"/anything else the user adds which is under the user service"
    boardhub.sapienafrica.com/user == http://127.0.0.1:9004/anything else the user adds which is under the user service";
Traffic Conversions

In some case scenario, you would need to have different body for both the server and client side.
Example

Let's say your client side consumes(sends and receives) JSON data while your server side only consumes(sends and receives) XML data, Sapien can convert that data for you using the incoming and outgoing values as below.

Incoiming request is the request from Client side to your server side while

Outgoing request is the request from your Server side to the client side

Authentication

Sapien also handles authentication depending with the configurations set. This means if you need all your client side to be authenticated before the request response is served, you can turn this authentication config On. Now in the case scenario you need to implement your own authentication that is also allowed.
Sapien has the following authentication methods available.

For each authentication type, Sapien creates a key for you.
Example

  1. If you select Basic then you will get the consumer key and secret.
  2. If you select JWT you will get a secret key for you to integrate with in your authentication backend
  3. If you select API key, then you will get an api key for use
Ignore routes

Sapien also allows the input of routes that need to be ignored, this mainly applies if authentication is set.
Example

Let's say you have a route that does not need authentication, you can add it to the ignore routes and Sapien will ignore it.

Rate Limiting & Throtlling

Sapien also allows you to set the rates per IP per second for your application. This let's you protect your infrastructure from DDOS.
Example

Let's say you have a requirement of each IP should have only 3 requests per 1 second,you can be able to add it as below

Whitelisting

The platform allows IP whitelisting.
Example

If you are creating a gateway for specific client side IP's, you can list them here and Sapien will only accept requests from those IP's

Plans & Packages

Sapien Pricing is entirely dependant on the plan & package that you purchase. The good thing is we offer you flexible plans, depending with your requirements.

Packages can be found here

By default while registering you get a hobby package. You can then upgrade on your user profile