---
title: "N-Tier Architecture"
description: "--- ###### Elements uses the N-Tier Architecture style with three layers, including the Presentation Layer, [Service](https://namazustudios.com/glossary/service/) Layer, and [DAO](https://namazustudios.com/glossary/dao/) Layer. Internally, Elements uses an N-tier architecture style consisting of three layers. - The [**Presentation Layer**](#presentation-layer) is a thinly defined layer…"
url: "https://namazustudios.com/docs/general-concepts/n-tier-architecture/"
updated: "2026-08-13"
category: General Concepts
---

# N-Tier Architecture

---

###### Elements uses the N-Tier Architecture style with three layers, including the Presentation Layer, [Service](https://namazustudios.com/glossary/service/) Layer, and [DAO](https://namazustudios.com/glossary/dao/) Layer.

Internally, Elements uses an N-tier architecture style consisting of three layers.

- The [**Presentation Layer**](#presentation-layer) is a thinly defined layer of abstraction over the underlying [Service](https://namazustudios.com/glossary/service/) Layer. RESTful APIs provide a translation between the [Service](https://namazustudios.com/glossary/service/) layer and the Presentation layer. JSON-RPC APIs (experimental) are essentially calling [Service](https://namazustudios.com/glossary/service/) layer methods directly. The endpoint code simply unpacks the requests and translates that to the [Service](https://namazustudios.com/glossary/service/) layer. The Presentation layer does nothing to enforce security.
- The [**[Service](https://namazustudios.com/glossary/service/) Layer**](#service-layer) (also sometimes called the *Logic Layer*) houses all the business logic of the system. This layer exists with multiple implementations of each [Service](https://namazustudios.com/glossary/service/). All APIs labeled "[Service](https://namazustudios.com/glossary/service/)" (e.g. - `dev.getelements.elements.sdk.Service.smartcontract.evm`) will always consider the context of the [User](https://namazustudios.com/glossary/user/) making the request. In some cases, the [Service](https://namazustudios.com/glossary/service/) layer implementation is configured to do nothing but throw exceptions.
- The [**[DAO](https://namazustudios.com/glossary/dao/) Layer**](#data-layer) (also sometimes called the *Data Layer*) is the layer that provides access to the database through layers of abstraction. All APIs labeled "[DAO](https://namazustudios.com/glossary/dao/)" (e.g. - `namazu.elements.DAO.User`) are part of the [DAO](https://namazustudios.com/glossary/dao/) layer.

### Presentation Layer [#presentation-layer](#presentation-layer)

The presentation layer is the layer closet to the client code. In the context of Elements, this is the [Resource](broken-reference) handling the cloud function invocation. Internally, Elements uses [JAX-RS](https://en.wikipedia.org/wiki/Jakarta_RESTful_Web_Services) annotated methods at the presentation layer.

### [Service](https://namazustudios.com/glossary/service/) Layer [#service-layer](#service-layer)

The [Service](https://namazustudios.com/glossary/service/) Layer houses the logic of the [Application](https://namazustudios.com/glossary/application/). Each [Service](https://namazustudios.com/glossary/service/) is a common interface through which client code makes calls. Depending on [User Acccess Level](../../core-features/users-and-profiles#user-properties), Elements will use a different implementation of the [Service](https://namazustudios.com/glossary/service/). Most services honor [User](https://namazustudios.com/glossary/user/) access level. However, as the developer of the [Application](https://namazustudios.com/glossary/application/), you should not worry about these details. When using the Scripting engine, invoking [Service](https://namazustudios.com/glossary/service/) layer code will typically enforce the appropriate permissions.

Warning

If a [Service](https://namazustudios.com/glossary/service/) is not available for a particular access level, the [Service](https://namazustudios.com/glossary/service/) will throw the appropriate exception indicating that the permission check failed.

#### Scoped Services [#scoped-services](#scoped-services)

A [Service](https://namazustudios.com/glossary/service/) that specifically honors [User](https://namazustudios.com/glossary/user/) Access Levels is said to be *scoped*, which means it may have a reference to the currently logged-in [User](https://namazustudios.com/glossary/user/) when processing the request. Useful information may be inferred from this scoping.

#### Unscoped Services [#unscoped-services](#unscoped-services)

A [Service](https://namazustudios.com/glossary/service/) that does not honor [User](https://namazustudios.com/glossary/user/) Access Levels is said to be *unscoped*, meaning it will not have any reference to the currently logged-in [User](https://namazustudios.com/glossary/user/). Typically, unscoped services provide super-[User](https://namazustudios.com/glossary/user/) access to the system. Alternatively, they may provide information that is available to all users without restriction.

Warning

When writing cloud functions, you should handle the [Service](https://namazustudios.com/glossary/service/) layer with care because it is unscoped and super-[User](https://namazustudios.com/glossary/user/) access is provided.

### [DAO](https://namazustudios.com/glossary/dao/) Layer [#data-layer](#data-layer)

The data layer has no [User](https://namazustudios.com/glossary/user/) scope, and therefore provides unrestricted access to the database. The Data Layer abstracts the database details. The Data Layer performs operations such as querying, inserting, updating, and deleting.

Warning

As with unscoped services, Data Layer code provides raw access to the database without regard for any scoping rules. Therefore, special care must be taken to make use of this.
