Skip to main content

Architect 101

Resource management#

Introduction#

Resource management is the bedrock of Architect. You will be starting with the clean slate and will be creating your data model on the fly by using Architect API as if everything already exists. Each resource, already created or not, has standard HTTP method handlers attached allowing CRUD operations against it.

Here is the basic concept overview on how to use Architect API. More on this coming up.

// Get all resources from the collection
HTTP GET /api/{resource_name}
// Get resource by id
HTTP GET /api/{resource_name}/{resource_id}
// Create a resource
HTTP POST /api/{resource_name}
// Update a resource
HTTP PUT /api/{resource_name}/{resource_id}
// Delete a resource
HTTP DELETE /api/{resource_name}/{resource_id}

Basic concepts#

Resources and Collections#

The Resource API is the bedrock of the Essentialz Architect. It provides the resource abstraction and a mechanism for CRUD operations agains the resource defined.

A resource can be anything formatted as a JSON object that you want to store inside your database. Let's start with a simple example.

A basic resource for a Todo App would be a TodoObject.

{
"title": "Buy milk",
"description": "Buy a carton of milk, if they have eggs buy 6",
"date": "2021-05-05"
}

The collection of your todo items would be todos. Architect know that so if you would ask Architect to get you all the items from the todos collection it would know what to look for. Therefore the API call would look like this:

const requestOptions = {
method: 'GET'
};
fetch("https://demo.essentialz.cloud/api/todos", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));

If you were to trigger this right away you would get and the message that the resource is not available in the database. And that is ok.

But what if we just created one?

const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
const raw = JSON.stringify({
"title": "Buy milk",
"description": "Buy a carton of milk, if they have eggs buy 6",
"date": "2021-05-05"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw
};
fetch("https://demo.essentialz.cloud/api/todos", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Triggering this would create a resource named todo and the collection todos is now available as well.

Triggering the first HTTP request to fetch the collection would return all the todos as expected

Authentication#

Introduction#

Authentication & Authorization are built-in into Architect so you can use them right off the bat. We are constantly expanding the list of available authorization providers and updating our docs as we make progress.

You will need to provide your set of credentials for each of the authentication providers, and Architect will handle the rest.

Available Authentication providers#

ProviderAvailabilityDocumentation link
Username & PasswordYES
GoogleYES
FacebookYES
AppleYES
GithubYES
OKTABETA
SAMLBETA

Authorization#

Authorization on the other hand is defined using the set of policies, available through Architect Dashboard. Read the docs on how to create policies and determine who can do what within your product.

Static content management#

Introduction#

Uploading files is a must within every project, and usually gets pushed on a side for too long. To avoid that, Architect provides two endpoints for uploading static files, one for a single file upload and the other for bulk file upload.

Architect leverages amazing AWS S3 storage, so all of your static content is safe, and your storage is highly available across the internet.

Make this simple request to upload a single file to Architect
https://...
Make this request to upload files in bulk

Events and triggers#

Introduction#

Everything that happens inside the Architect ecosystem has an event attached. Architect's Webhook system allows for easy integration with third-party services in order to expand the possibilities even further.

Architect provides Zapier integration out of the box for easy integration with your favorite services and tools.

Explore the Events & Triggers section in the documentation area to learn more on how to use them.

Custom functions#

Introduction#

We know that every product is a bit different and unique. Therefore Architect allows definition of your custom endpoints and functionality. Custom functions functionality is available through the Architect Dashboard.

Read the docs on how to create your custom functions.