Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 09bcffb

Browse files
jyecuschdavemooreuws
authored andcommitted
split API sequence diagrams between runtime and build time
1 parent da876e6 commit 09bcffb

File tree

1 file changed

+52
-15
lines changed

1 file changed

+52
-15
lines changed

docs/architecture/apis.mdx

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,60 @@ classDef edgeLabel line-height:2;
8686

8787
## 2. Sequence
8888

89+
### Build Sequence
90+
91+
Here is the sequence of events that occur when a developer registers an API with Nitric, including the registration of routes, security, and middleware.
92+
93+
```mermaid
94+
sequenceDiagram
95+
participant Worker as App Worker(s)
96+
participant SDK as Nitric SDK
97+
participant Nitric as Nitric CLI
98+
participant Provider as Nitric Provider
99+
participant IAC as IaC
100+
101+
Worker->>SDK: Register API(s)
102+
SDK->>Nitric: Register API(s)
103+
104+
opt Authentication
105+
Worker->>SDK: Register Security
106+
SDK->>Nitric: Register Security
107+
end
108+
109+
Worker->>SDK: Register Route Callback(s)
110+
SDK->>Nitric: Register Route(s)
111+
Worker->>SDK: Register Middleware(s)
112+
113+
Nitric->>Nitric: Generate OpenAPI Spec
114+
Nitric->>Provider: Forward Nitric Spec
115+
Provider->>IAC: Provision API Gateway
116+
```
117+
118+
### Runtime Sequence
119+
120+
Here is the sequence of events that occur at runtime when a client makes an HTTP request to an API registered and deployed using Nitric.
121+
89122
```mermaid
90123
sequenceDiagram
91-
participant Client as Client
92-
participant NitricSDK as Nitric SDK
93-
participant NitricRuntime as Nitric Runtime
94-
participant APIGateway as API Gateway
95-
participant Worker as App Worker
96-
97-
Client->>NitricSDK: Send HTTP API request
98-
NitricSDK->>NitricRuntime: Forward API request
99-
NitricRuntime->>APIGateway: Register API routes (during deployment)
100-
101-
APIGateway->>NitricRuntime: Route incoming request
102-
NitricRuntime->>Worker: Forward request to application logic
103-
Worker-->>NitricRuntime: Process request and return response
104-
NitricRuntime-->>APIGateway: Respond with result
105-
APIGateway-->>Client: Return API response
124+
participant Client as Client
125+
participant APIGateway as API Gateway
126+
participant Auth as Auth Provider
127+
participant Nitric as Nitric Runtime
128+
participant SDK as Nitric SDK
129+
participant Worker as App Worker
130+
131+
Client->>APIGateway: HTTP Request
132+
opt Authentication
133+
APIGateway->>Auth: Verify Token
134+
APIGateway-->>Client: Unauthorized
135+
end
136+
APIGateway->>Nitric: Forward Request
137+
Nitric->>Nitric: Convert Request Format
138+
Nitric->>SDK: Route HTTP Event
139+
SDK->>Worker: Execute Route Callback
140+
141+
Worker->>Worker: Process Request
142+
Worker-->>Client: Response
106143
```
107144

108145
## 3. Component

0 commit comments

Comments
 (0)