Architecture Overview

Nitric allows your team to work together to build an application:

  • Developers: Writes application code with built-in support for APIs, storage (bucket), secrets, key/value store, SQL databases and other cloud resources, leveraging the Nitric SDK.
  • Automation Engineers: Customize, extend or use Nitric's generated IaC (Terraform or Pulumi) to provision and manage the resources needed to support applications.
  • Operations: Configure environment/region/policy specific details, they also are heavily involved in overseeing that the Terraform, Pulumi or other IaC modules adhere to governance standards.

These roles are only representative, they often overlap or further divide depending on team structure. For example, it's not unusual in smaller teams for Developers to assume all roles, or for Automation and Operations to be handled by the same team.

Nitric interacts with code to generate a specification of the resources required by each application. It then uses one or more IaC/cloud-specific plugins to turn those requirements into Infrastructure-as-Code (e.g. Terraform) or fully automate cloud deployments, which fully satisfy all of the applications infrastructure requirements. Effectively, Nitric is a cloud-agnostic way to define and deploy cloud applications, which automates the transition from code to cloud resources.

While many Nitric examples focus on AWS, Nitric's flexibility allows plugins (providers) to support any cloud or on-prem environment, even multiple clouds simultaneously if that's required.

Deployment Config
Code
Extend/Customize IaC Modules
Generate
Build
Exposes REST/HTTP Routes
Stores/Retrieves Files
Manages Sensitive Data
Reads/Writes Data
Executes SQL Queries
1..n
Developer
Automation Engineer
Operations
Deployed Application
Nitric CLI - 'nitric up'
Nitric Provider
Container Images
Nitric Specification
API Gateway
Bucket
Secrets
Key/Value Store
Relational Database
Other Resources

Nitric applications can have any number of APIs, Secrets, Buckets etc. Providers can also be extended to further support new resources, many of which will work across all cloud providers and some that are cloud specific.

Interact seamlessly with services exposed through HTTP routes in an API gateway, as scheduled tasks, via event subscriptions, through WebSocket handlers, and more.

Example: Handling HTTP requests

Sends HTTP Request
Triggers Service
Triggers Service
Read/Write
Access
Read/Write
Execute Queries
Client Browser
HTTP API - API Gateway
GET Route
POST Route
Other Services/APIs
Storage Bucket
Secrets Manager
Key/Value Store
Relational Database Service
  • The Client Browser sends an HTTP request to the API Gateway.
  • The API Gateway acts as a proxy, forwarding the request to the appropriate Services.
  • The Services process the request by coordinating with different resources like buckets, secrets, key/value store etc.

Example: Handling Websockets

Connect
Message
Disconnect
Connect
Message
Disconnect
Read/Write
Read/Write
Other services/APIs
Websocket Client
WebSocket API
onConnection Callback
onMessage Callback
onDisconnect Callback
Storage Bucket
Key-Value Store
...
  • The Client opens a WebSocket connection.
  • The WebSocket API handles the connection lifecycle:
    • When the connection opens, it triggers the onConnect callback function.
    • Once the connection is established, messages from the client trigger the onMessage callback function.
    • When the connection closes, it triggers the onDisconnect callback function.
  • The onMessage, onConnect and onDisconnect callbacks:
    • Are contained within one or more Services, accepting events from the WebSocket API.
    • Interact with other cloud resources e.g. Buckets, KeyValue stores and APIs.

Example: Sharing resources

Deploy multiple services, behind shared API Gateways and interact with other shared resources.

HTTP Request
HTTP Request
GET: /orders
PUT: /users/1/orders/2
Read
Read/Write
Alice
Bob
api.example.com
Orders Service
Orders Mgmt Service
Invoices Bucket
  • Client Browsers send HTTP requests to a shared API Gateway, which routes requests to the appropriate service.
  • The API Gateway's respective route handlers (services) are established with least privileges:
    • The Orders Service, can be restricted to read-only permissions to the Invoices Bucket.
    • The Orders Management Service, is instead granted both read and write permissions to the Invoices Bucket.

Example: Multiple entry points

A Nitric application can also have multiple entry points, such as multiple HTTP API Gateways and a Schedule, all sharing specific common resources.

HTTP Request
HTTP Request
3am daily
GET: /orders
PUT: /users/1/orders/2
Read
Read/Write
Read/Delete
Write
Alice
Bob
Archive Orders
public.api.example.com
internal.api.example.com
Orders Service
Orders Mgmt Service
Archive Service
Invoices Bucket
Archive Bucket
  • Client Browsers send HTTP requests to different API Gateways, which route requests to the appropriate service.
  • The API Gateway's respective route handlers (services) are established with least privileges:
    • The Orders Service, can be restricted to read-only permissions to the Invoices Bucket.
    • The Orders Management Service, is instead granted both read and write permissions to the Invoices Bucket.
  • A Schedule triggers the Archive Service to read and delete from the Invoices Bucket and write to the Archive Bucket.
Last updated on Feb 15, 2025