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.
@@ -4,49 +4,276 @@ description: 'The problems with modern cloud development'
4
4
5
5
# Why Nitric
6
6
7
-
Building and deploying cloud applications should be simple. But in practice, cloud development comes with numerous challenges, from managing provider-specific services to wrestling with deployment automation. Nitric was designed to address these pain points and provide a modern, highly declarative, and flexible approach to building cloud apps that work across providers.
7
+
### Infrastructure as Code: A System Out Approach
8
8
9
-
## The Problems
9
+
Infrastructure as Code (IaC) tools like Terraform, AWS CloudFormation, and Pulumi have reshaped how cloud infrastructure is managed. They allow teams to define resources and configurations in code, leading to reproducibility, automation, and more consistent environments.
10
10
11
-
### Provider Lock-in and Highly Coupled Architectures
11
+
However, these tools typically approach the problem from the point-of-view of the system: "What can the cloud platform do? What configuration options are available on this resource?". They expose these capabilities through configuration files, making infrastructure management more systematic but also tied to cloud/service/platform specific details.
12
12
13
-
Many applications are built with deep dependencies on a single cloud provider's services (think the AWS S3 client library or the specific shape of a Google Pub/Sub message, or any number of other subtle and not-so-subtle dependencies on cloud services).
13
+
### Nitric: A Developer In Approach
14
14
15
-
These dependencies makes it difficult to port your app to another service, or move to a different cloud get the best price, or run your app locally for testing, or even work in hybrid cloud environments. As the app grows, so does the reliance on specific cloud services, leading to vendor lock-in, making it harder to scale and evolve over time.
15
+
Nitric builds on this with a focus on what you want to achieve as the developer: "What workflow do you need to be productive? What system design are you trying to achieve?". From there, it's capable of mapping your application's needs down to the Infrastructure-as-Code required to achieve those goals.
16
16
17
-
Nitric abstracts these details, giving you the flexibility to deploy across different cloud providers without having to rewrite your application code. By decoupling your logic from the underlying infrastructure, Nitric ensures your app works wherever you need it to.
17
+
This approach keeps application code clean and focused on functionality, leaving the management and interaction with infrastructure to a new layer that supports the applications you develop.
18
18
19
-
### Deployment Automation: A Second Application
19
+
In a typical cloud application **you already make declarations of your system's requirements**.
20
20
21
-
Building a cloud app you can easily find yourself building a second application—deployment automation—that manages the infrastructure and services your app depends on. This includes provisioning cloud resources, managing permissions, configuring networking, and more. The deployment scripts become an integral part of your project, with a complex set of instructions that must be maintained alongside your app.
21
+
Consider the following code:
22
22
23
-
While this is a necessary part of cloud development, it can be a significant burden - one that can be simplified and made more robust.
23
+
<CodeSwitchertabs>
24
24
25
-
Nitric simplifies this by automatically collecting what your app needs to run and providing this to plugins that can generate the deployment automation for you. You no longer need to manually craft unique and complex Infrastructure-as-Code (IaC) files to describe each app's requirements. Instead, use independently testable and reusable deployment automation layers.
Many of the details about how an application interacts with its infrastructure are buried in the code. For example, the permissions required to access services, the environment variables needed to function, or the correct configuration of cloud resources are often implied by the codebase, but not explicitly defined. Keeping track of these is challenging, and small mistakes can lead to broken deployments or runtime failures.
31
+
if (!RECEIPT_DOCUMENTS_BUCKET) {
32
+
thrownewError('RECEIPT_DOCUMENTS_BUCKET environment variable not set')
33
+
}
30
34
31
-
Nitric brings these details to the surface, ensuring that the infrastructure requirements are automatically generated based on how your app is written. This eliminates the need to manually interrogate the code (or more likely its author) to specify the needed permissions, environment variables, and cloud resource dependencies.
35
+
exportasyncfunctiongetReceiptDoc(filename) {
36
+
constcommand=newGetObjectCommand({
37
+
Bucket:RECEIPT_DOCUMENTS_BUCKET,
38
+
Key: filename,
39
+
})
32
40
33
-
### Automation Sync & Zombies
41
+
constresponse=awaits3.send(command)
42
+
returnawaitresponse.Body.transformToByteArray()
43
+
}
44
+
```
34
45
35
-
Keeping your app code in sync with the deployment automation is a constant battle. When you make changes to your app—such as removing a resource—the deployment automation must be manually updated to prevent zombie resources. Conversely, if your deployment script creates a resource and passes its ARN as an environment variable, any typo in that variable can cause your app to fail at runtime. These issues are hard to catch because there's no strong link between the app and the IaC code.
With Nitric, your app and deployment automation are always in sync. The resources your app uses are automatically aggregated, and environment variables are no longer needed, with resource ID resolution built directly into your app at runtime. No more hunting for missing or misconfigured settings. Everything your app needs is declared in one place—your application code.
-**Decoupling App Logic from Infrastructure**: Nitric handles the cloud infrastructure for you, so your app can focus on what matters—delivering functionality. No more writing and maintaining complex deployment scripts specific to just one app.
44
-
-**Automatic Infrastructure Management**: Nitric automatically provisions the resources your app needs based on its code. There's no need to manually declare and update cloud resources. Or worse, forget to update them.
45
-
-**Built-in Permissions and Configuration**: Nitric configures permissions and resource resolution for you, so your app is ready to run securely and with the correct settings.
46
-
-**Cross-Cloud Flexibility**: Whether you want to deploy to AWS, Azure, GCP, all three, or somewhere else entirely, Nitric ensures your app works consistently across cloud providers.
62
+
const response =awaits3.send(command)
63
+
returnawaitresponse.Body.transformToByteArray()
64
+
}
65
+
```
47
66
48
-
Nitric makes cloud development a frictionless experience. By eliminating the tedious and error-prone aspects of deployment, you can focus on building great applications, confident that they will deploy reliably.
Nitric is not a silver bullet. It can't solve every problem in cloud development, nor is it a one-size-fits-all solution. However, it does provide a powerful set of tools and practices that can significantly simplify and streamline your cloud development workflow.
73
+
ifnotRECEIPT_DOCUMENTS_BUCKET:
74
+
raiseEnvironmentError('RECEIPT_DOCUMENTS_BUCKET environment variable not set')
final client = S3(region: 'us-west-2'); // Adjust region
133
+
final request = GetObjectRequest(
134
+
bucket: receiptDocumentsBucket!,
135
+
key: filename,
136
+
);
137
+
138
+
final response = await client.getObject(request);
139
+
return await response.body.toBytes();
140
+
}
141
+
```
142
+
143
+
</CodeSwitcher>
144
+
145
+
Code like this makes very clear demands of the environment it expects to run in:
146
+
147
+
- I need a bucket to be available
148
+
- I need to be able to read objects from that bucket
149
+
- The bucket must be an AWS S3 bucket
150
+
- I need to know the ARN/Name of the bucket
151
+
152
+
The problem is that these requirements are implicit. They're hidden throughout the code and for non-trivial apps it's challenging to collect them all and be sure the requirements are met.
153
+
154
+
In a IaC approach, you would write something like Terraform or CloudFormation by hand to declare these requirements, setup the necessary permissions, and set the appropriate values in the environment variables of the container/function/etc. running the code.
155
+
156
+
This manual process requires a detailed knowledge of the cloud platform's capabilities and how to safely configure them, while simultaneously understanding the numerous requirements of the application code. Unfortunately, this process is error-prone and leads to inconsistency, misconfigurations, time-consuming debugging, and in the worst cases—security vulnerabilities.
157
+
158
+
Nitric's primary goal is to flip this around. Making implicit requirements explicit and automating the process of collecting these requirements into a specification that can be used to automatically generate the appropriate IaC.
159
+
160
+
Additionally, Nitric wants to make application code concise, portable and cloud-agnostic, so that you can run your application on any cloud provider, replace underlying services at will, or run on alternate infrastructure like Kubernetes, on-premises or your own laptop.
- The requirements are explicit. The code declares that it needs a bucket named `receipt-docs` and that it needs to be able to read from it.
232
+
- The code is concise and focused on the application logic. The infrastructure requirements are declared in a separate layer, making the application code cleaner and more maintainable.
233
+
- The code is cloud-agnostic. Nitric can map the requirements to the appropriate cloud services, allowing the application to run on any cloud provider or infrastructure.
234
+
- There are no environment variables, so typos or missing values are less likely to cause runtime errors.
235
+
- You don't need to read the code to find these requirements. Nitric can gather them all into a specification that can be used to automatically generate the necessary IaC.
236
+
237
+
### Why Nitric?
238
+
239
+
#### 1. **Developer-Centric Workflow**
240
+
241
+
Amazing tools already exist for specifying _how_ to deploy infrastructure, Nitric focuses on _what_ infrastructure is needed. Nitric lets you design your application architecture, independent of the deployment automation tool or target platform. With highly declarative in-app infrastructure requirements.
242
+
243
+
Instead of writing project-specific Terraform, Pulumi or CloudFormation scripts, Nitric centralizes this code and automatically generates the project-specific scripts based on your application's declarations. As we said earlier, your code already defines what the system needs—Nitric just makes that explicit and automates the rest.
244
+
245
+
#### 2. **Making Implicit Requirements Explicit**
246
+
247
+
In a typical application, your code defines its infrastructure needs implicitly—like when you access an S3 bucket or connect to a queue. Nitric makes requirements explicit declarations, ensuring the required cloud resources are provisioned, permissions are configured, and the app is connected to them in a consistent and reliable way.
248
+
249
+
Instead of tracking these dependencies manually, Nitric automates this process. If your app needs storage, a database, or a message queue, Nitric ensures these resources are properly set up and integrated into your app, removing the friction of manual configuration.
250
+
251
+
#### 3. **Cloud-Agnostic and Portable**
252
+
253
+
Nitric decouples your application from the underlying cloud infrastructure. Whether you're using AWS, Azure, GCP, or Kubernetes, Nitric allows you to map your application's requirements to the appropriate services across platforms. This allows your app to run anywhere without the need for platform-specific code to be embedded in the application.
254
+
255
+
This portability is key to future-proofing applications and avoiding lock-in to any one cloud provider or service. Nitric ensures that your app's architecture remains flexible and adaptable, so switching providers or moving between environments (cloud, on-premises, local) becomes seamless.
256
+
257
+
#### 4. **Automated Infrastructure, Best Practices Included**
258
+
259
+
One of the most error-prone aspects of cloud development is managing permissions, configurations, and security policies. Nitric automates this, making security best practices—like least privilege access and proper service configurations easy.
260
+
261
+
This reduces the risk of misconfigurations, inconsistency, security holes, and the burden of having to write boilerplate IaC scripts to handle service permissions. Nitric offloads this work to consistent plugins for each target platform, ensuring your infrastructure is provisioned correctly without adding overhead to your development process.
262
+
263
+
#### 5. **Focus on Application Logic**
264
+
265
+
Nitric's approach allows you to focus on building your application, instead of the scaffolding required to run it in the cloud. By removing the manual steps from the IaC process, Nitric eliminates significant boilerplate and reduces the runtime checking needed to handle configuration errors.
266
+
267
+
This isn't about skipping important cloud knowledge—you still benefit from understanding how your app interacts with the cloud. But by making infrastructure explicit and automating it, Nitric reduces the time spent configuring, debugging, and maintaining cloud services. This gives you more bandwidth to focus on what really matters: your app's features and functionality.
268
+
269
+
#### 6. **Plugin-Based Architecture**
270
+
271
+
Nitric's plugin-based architecture allows you to use the deployment plugins we provide, which use Pulumi or Terraform for deployment, or write your own. This flexibility allows you to use the tools you're comfortable with, while still benefiting from Nitric's infrastructure automation and cloud-agnostic approach.
272
+
273
+
It can also act as a protocol for communication between app development and infrastructure teams, ensuring that the infrastructure requirements are clear and consistent. This ensures the two teams can work independently, with the infrastructure team focusing on the best way to provision the resources, and the development team focusing on building the application.
274
+
275
+
### Conclusion
276
+
277
+
Nitric simplifies the way you build your app—enhancing it with automatic gathering of infrastructure requirements, and decoupling the tools used to deploy that infrastructure. Your code already defines what resources are needed, Nitric just makes that clear, flexible, and portable.
278
+
279
+
Nitric is designed to make cloud development more efficient, secure, and focused on what you're building—not how you're building it. It's a developer-centric layer added to cloud infrastructure automation and streamlines the development process, reduces complexity, and lets you build better applications faster.
0 commit comments