You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 20, 2025. It is now read-only.
Nitric is a cloud framework with common resources like APIs, websockets, databases, queues, topics, buckets, and more.
17
+
Nitric is a declarative cloud framework with common resources like APIs, websockets, databases, queues, topics, buckets, and more.
18
18
19
-
However, Nitric is unique - it doesn't just deploy the resources, it helps you interact with them. It also makes them pluggable, so you can swap services or even whole clouds without changing your code.
19
+
However, Nitric doesn't just deploy the resources, it helps you interact with them. It also makes them pluggable, so you can swap services or even whole clouds without changing your code.
20
20
21
21
It's what's missing between applications and infrastructure automation.
22
22
23
23
Oh, and it supports basically any language, like JavaScript, TypeScript, Python, Go, you name it.
24
24
25
25
<divclassName="">
26
-
<Librariesminimal />
26
+
<Librariesminimal />
27
27
</div>
28
28
29
+
If you're familiar Nitric already, you might want to jump to the [Installation](/getting-started/installation), [Guides](/guides) or [Resources](/apis) sections. Otherwise, keep reading to learn more about Nitric.
30
+
29
31
---
30
32
31
33
## Services
@@ -35,17 +37,17 @@ Services are the heart of Nitric apps, they're the entrypoints to your code. The
35
37
```yaml {{ label:"nitric.yaml" }}
36
38
name: example
37
39
services:
38
-
- match: services/*.ts
39
-
start: npm run dev:services $SERVICE_PATH
40
+
- match: services/*.ts
41
+
start: npm run dev:services $SERVICE_PATH
40
42
```
41
43
42
-
You might have one service that handles everything, or a service for each route. It's up to you.
44
+
You might have one service that handles everything, or a service for each route. It's up to you. Every matched services becomes a container, so you can scale them independently.
43
45
44
46
---
45
47
46
48
## Resources
47
49
48
-
Resources are the building blocks of your apps. They're the databases, queues, buckets, etc. that your services interact with. If you want a resource, you just ask for it.
50
+
Resources are the building blocks of your apps. They're the databases, queues, buckets, etc. that your services interact with. To request a resource, import the resource type and create one with a name.
49
51
50
52
<CodeGroup>
51
53
@@ -94,21 +96,23 @@ void main() {
94
96
95
97
</CodeGroup>
96
98
97
-
Nitric collects everything your services request. When you deploy, the deployment plugin you choose creates the resources and services, then links it all together.
99
+
Nitric collects everything your services request. When you deploy, the deployment plugin you choose creates the resources and services, then links them all together.
98
100
99
101
<Note>
100
-
That probably sounds like magic, but it's more like a compiler for Infrastructure-as-Code - you can read about it in the [Concepts](/docs/concepts) section.
102
+
That might sound like magic, but it's more like a compiler for
103
+
Infrastructure-as-Code - you can read about it in the [Concepts](/concepts)
104
+
section.
101
105
</Note>
102
106
103
107
---
104
108
105
-
## Providers
109
+
## Deployment Plugins (Providers)
106
110
107
-
Nitric is designed to be independent of any platform, so you can run your apps anywhere. You can deploy to AWS, Azure, GCP, or even your own Kubernetes cluster. You can even deploy to multiple clouds at once.
111
+
Nitric is designed to be independent of any platform, so you can run your apps anywhere. You can deploy to AWS, Azure, GCP, your own Kubernetes cluster or a single server. You could even deploy to multiple clouds at once.
108
112
109
-
Seriously, is there really a difference between a bucket on AWS and a bucket on Azure? We don't think so. So why should the code be different?
113
+
Are the differences between a bucket on AWS and a bucket on Azure important to most apps? We don't think so. So why should the code be different?
110
114
111
-
Nitric abstracts away the differences, so you can focus on your app. The part that makes that possible is a plugin, we call a **Provider**.
115
+
Nitric abstracts away API layer differences, so you can focus on your app. The part that makes that possible is a plugin, we call a **Provider**.
We have a few providers built-in with IaC from Pulumi or Terraform, but you can build your own with any tools you prefer and to anywhere you want.
151
+
We have several providers built-in with IaC from [Pulumi](https://www.pulumi.com/) or [Terraform](https://www.terraform.io/), but you can build your own with any tools you prefer and **deploy anywhere**.
148
152
149
153
---
150
154
151
155
## Projects
152
156
153
-
Projects built with Nitric don't have many restrictions. You can use most languages, most libraries, most tools, most clouds, most services, mostly anything you like. But, you need to have a `nitric.yaml` file in the root of your project.
157
+
Projects built with Nitric don't have many restrictions. You can use most languages, libraries, tools, clouds, services, mostly anything you like. But, you need to have a `nitric.yaml` file in the root of your project.
154
158
155
159
```yaml {{ label:"nitric.yaml" }}
156
160
name: example
157
161
services:
158
-
- match: services/*.ts
159
-
start: npm run dev:services $SERVICE_PATH
162
+
- match: services/*.ts
163
+
start: npm run dev:services $SERVICE_PATH
160
164
```
161
165
162
166
Nitric uses this to find your services, then it turns each service into a container, runs them in deployment mode to match the resources you requested and gives the result to the Provider - which either generates IaC (like Terraform) or automatically deploys your app.
You can create a new project from a template with the `new` command.
@@ -246,21 +255,28 @@ nitric start
246
255
```
247
256
248
257
<Note>
249
-
Start also emulates the resources you requested, so you can test your app locally. And provides a Dashboard UI to interact with the resources.
258
+
Start also emulates the resources you requested, so you can test your app
259
+
locally. And provides a Dashboard UI to interact with the resources.
250
260
</Note>
251
261
252
262
### Deploy
253
263
254
264
You can deploy your project with the `up` command, once you have a stack file (deployment target).
255
265
256
266
```bash
267
+
# Create a new stack (deployment target)
257
268
nitric stack new
258
-
269
+
# Deploy to the stack, using the provider in the stack file
259
270
nitric up
260
271
```
261
272
262
273
<Note>
263
-
Some providers don't deploy directly, instead they generate IaC files. In those cases you use the IaC tool to deploy (e.g. `terraform apply`).
274
+
Some providers deploy directly, others generate IaC files for existing tools
275
+
(like HCL for Terraform). In the cases where IaC is generated you use the
276
+
chosen IaC tool to deploy (e.g. `terraform apply`).
277
+
278
+
Currently, all Pulumi providers deploy directly, while Terraform providers generate IaC.
279
+
264
280
</Note>
265
281
266
282
### Tear Down
@@ -271,15 +287,20 @@ You can tear down your project with the `down` command.
271
287
nitric down
272
288
```
273
289
290
+
<Note>
291
+
If you used a provider that generates IaC, use the IaC tool to tear down (e.g.
292
+
`terraform destroy`).
293
+
</Note>
294
+
274
295
---
275
296
276
297
## Local development
277
298
278
-
Sometimes you just want to run your app locally and we let you do just that. And we don't mean "binds to a cloud environment and syncs your code, but doesn't work without Wifi" local, we mean "runs on your machine, on a desert island" local.
299
+
Sometimes you'll want to run your app locally. We don't mean "binds to a cloud environment and syncs your code, but doesn't work without Wifi" local, we mean "runs on your machine, on a desert island" local.
279
300
280
301
`nitric start` hosts entrypoints like APIs, websockets, and schedules, as well as resources like databases, topics, queues, key/value stores and buckets.
281
302
282
-
It also provides a Dashboard to interact with your resources, so you can trigger schedules without waiting, or topics without a publisher, or upload test files to a bucket. It even produces a real-time architecture diagram of your services and resources.
303
+
It also provides a Dashboard to interact with your resources, so you can trigger schedules without waiting, or topics without a publisher, or upload test files to a bucket. It even produces a live architecture diagram of your services and resources as your code updates.
@@ -293,36 +314,41 @@ It also provides a Dashboard to interact with your resources, so you can trigger
293
314
294
315
The services of cloud providers are vast, we can't cover everything and we shouldn't. Many services are unique enough that abstraction would be a disservice. Nitric aims to make common "table stakes" services easy to use, but we never want to limit you.
295
316
317
+
Here are some ways you can extend or escape Nitric.
318
+
296
319
### Runtime
297
320
298
321
If you need to access a service in a way Nitric doesn't support, you can always use the provider's SDK directly. Code like this will always work:
final response = await s3.listObjectsV2(Bucket: 'my-bucket');
340
-
341
367
print(response.contents);
342
368
```
343
369
@@ -348,21 +374,22 @@ print(response.contents);
348
374
If you need to change how Nitric deploys a resources or how it interacts with a service at runtime, you can [extend or modify a provider](/reference/providers/custom/extend-standard-provider).
349
375
350
376
<Note>
351
-
For example, here's a [project that swaps SNS for EventBridge](https://github.com/jyecusch/iac-ifc-comparison) on AWS.
377
+
For example, here's a [project that swaps SNS for
378
+
EventBridge](https://github.com/jyecusch/iac-ifc-comparison) on AWS.
352
379
</Note>
353
380
354
381
### Full Customization
355
382
356
-
If you need to deploy to a cloud or new set of services that Nitric doesn't support, you can [build your own provider](/reference/providers/custom/building-custom-provider). This is a bit more advanced, but it's the ultimate escape hatch.
383
+
If you need to deploy to a new platform or new set of services that Nitric doesn't support, you can [build your own provider](/reference/providers/custom/building-custom-provider). This is a bit more advanced, but it's the ultimate escape hatch.
357
384
358
385
The included providers are written in Go and built using Terraform or Pulumi, but you can use any language or tool you like.
359
386
360
387
### Additional Resources
361
388
362
-
If you need to use a service that Nitric doesn't support, you just do that like you always would. Nitric doesn't get in the way of you using the cloud, it just makes it easier.
389
+
If you need to use a service/resource that Nitric doesn't support, you do that like you always would. Nitric doesn't get in the way of you using the cloud, it just makes it easier.
363
390
364
391
---
365
392
366
393
## What now?
367
394
368
-
If you're still not sure what to make of Nitric, maybe start with the [Concepts](/docs/concepts) section, otherwise the best way to learn is to dive into the [Guides](/docs/guides) and start building your first project.
395
+
If you're still not sure what to make of Nitric, maybe start with the [Concepts](/concepts) section, otherwise the best way to learn is to dive into the [Guides](/guides) and start building your first project.
0 commit comments