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

Commit 8e02cbc

Browse files
feat: update node guides with up to date Nitric usage (#700)
1 parent ac31d20 commit 8e02cbc

File tree

9 files changed

+264
-209
lines changed

9 files changed

+264
-209
lines changed

docs/guides/deno/serverless-rest-api-example.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,6 @@ provider: nitric/aws@latest
298298
region: us-east-1
299299
```
300300
301-
### AWS
302-
303301
<Note>
304302
Cloud deployments incur costs and while most of these resource are available
305303
with free tier pricing you should consider the costs of the deployment.

docs/guides/go/realtime-messaging.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,14 @@ nitric stack new dev aws
283283

284284
Edit the stack file `nitric.dev.yaml` and set your preferred AWS region, for example `us-east-1`.
285285

286-
### AWS
286+
```yaml title:nitric.dev.yaml
287+
# The nitric provider to use
288+
provider: nitric/aws@latest
289+
# The target AWS region to deploy to
290+
# See available regions:
291+
# https://docs.aws.amazon.com/general/latest/gr/lambda-service.html
292+
region: us-east-2
293+
```
287294
288295
<Note>
289296
You are responsible for staying within the limits of the free tier or any

docs/guides/nodejs/api-with-nextjs.mdx

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -392,37 +392,43 @@ Pressing `ctrl + a + k` will end the application.
392392
393393
## Deploy to the cloud
394394
395-
### Deploy the Nitric API
395+
At this point, you can deploy what you've built to any of the supported cloud providers. In this example we'll deploy to AWS. Start by setting up your credentials and configuration for the [nitric/aws provider](/providers/pulumi/aws).
396396
397-
Setup credentials and cloud specific configuration:
397+
Next, we'll need to create a `stack file` (deployment target). A stack is a deployed instance of an application. You might want separate stacks for each environment, such as stacks for `dev`, `test`, and `prod`. For now, let's start by creating a file for the `dev` stack.
398398
399-
- [AWS](/providers/pulumi/aws)
400-
- [Azure](/providers/pulumi/azure)
401-
- [GCP](/providers/pulumi/gcp)
399+
The `stack new` command below will create a stack named `dev` that uses the `aws` provider.
402400
403-
Create a stack, which is a deployment target for your application.
404-
405-
```
406-
nitric stack new
401+
```bash
402+
nitric stack new dev aws
407403
```
408404
405+
Edit the stack file `nitric.dev.yaml` and set your preferred AWS region, for example `us-east-1`.
406+
407+
```yaml title:nitric.dev.yaml
408+
# The nitric provider to use
409+
provider: nitric/aws@latest
410+
# The target AWS region to deploy to
411+
# See available regions:
412+
# https://docs.aws.amazon.com/general/latest/gr/lambda-service.html
413+
region: us-east-2
409414
```
410-
? What should we name this stack? todo
411-
? Which provider do you want to deploy with? aws
412-
? Which region should the stack deploy to? us-east-1
413-
```
414415
415-
Then, you can deploy with the `up` command.
416+
<Note>
417+
You are responsible for staying within the limits of the free tier or any
418+
costs associated with deployment.
419+
</Note>
420+
421+
Let's try deploying the stack with the `up` command:
416422
417-
```
423+
```bash
418424
nitric up
419425
```
420426
421-
When the deployment is complete, go to the relevant cloud console to see and interact with the API.
427+
When the deployment is complete, go to the relevant cloud console and you'll be able to see and interact with your application.
422428
423-
To undeploy run the `down` command:
429+
To tear down your application from the cloud, use the `down` command:
424430
425-
```
431+
```bash
426432
nitric down
427433
```
428434

docs/guides/nodejs/expressjs.mdx

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ You can go ahead and open this new project in your editor of choice. You should
4646
├── node_modules
4747
│ ├── ...
4848
├── .gitignore
49-
├── index.js
5049
├── nitric.yaml
50+
├── node.dockerfile
51+
├── node.dockerfile.dockerignore
5152
├── package.json
5253
├── README.md
5354
└── yarn.lock
@@ -150,38 +151,38 @@ This is where the true value of Nitric shines. You don't need to perform any man
150151

151152
To perform the deployment we'll create a `stack`, stacks give Nitric the configuration needed for a specific cloud instance of this project, such as the provider and region.
152153

153-
The new stack command can help you create the stack by following prompts.
154+
The `stack new` command below will create a stack named `dev` that uses the `aws` provider.
154155

155156
```bash
156-
nitric stack new
157+
nitric stack new dev aws
157158
```
158159

159-
This command will create a file named `nitric.dev.yaml`, with contents like this:
160+
Edit the stack file `nitric.dev.yaml` and set your preferred AWS region, for example `us-east-1`.
160161

161162
```yaml title:nitric.dev.yaml
162-
provider: nitric/[email protected]
163-
region: us-east-1
163+
# The nitric provider to use
164+
provider: nitric/aws@latest
165+
# The target AWS region to deploy to
166+
# See available regions:
167+
# https://docs.aws.amazon.com/general/latest/gr/lambda-service.html
168+
region: us-east-2
164169
```
165170
166-
With the stack file in place we can run the deployment:
171+
<Note>
172+
You are responsible for staying within the limits of the free tier or any
173+
costs associated with deployment.
174+
</Note>
175+
176+
Let's try deploying the stack with the `up` command:
167177

168178
```bash
169179
nitric up
170180
```
171181

172-
Go ahead and test your new Express+Nitric app in the cloud, you can start with the API Gateway URL returned by the `up` command.
182+
When the deployment is complete, go to the relevant cloud console and you'll be able to see and interact with your application.
173183

174-
<Note>
175-
When you're done with the cloud deployment you can tear it down using the
176-
`nitric down` command.
177-
</Note>
184+
To tear down your application from the cloud, use the `down` command:
178185

179-
## What's next?
180-
181-
Now that you have the basics down, try exploring other Nitric resources available to enhance your app.
182-
183-
- [Key Value Stores](/keyvalue)
184-
- [Schedules](/schedules)
185-
- [Storage](/storage)
186-
- [Messages](/messaging)
187-
- [Secrets](/secrets)
186+
```bash
187+
nitric down
188+
```

docs/guides/nodejs/fastify.mdx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ You can go ahead and open this new project in your editor of choice. You should
4646
├── node_modules
4747
│ ├── ...
4848
├── .gitignore
49-
├── index.js
5049
├── nitric.yaml
50+
├── node.dockerfile
51+
├── node.dockerfile.dockerignore
5152
├── package.json
5253
├── README.md
5354
└── yarn.lock
@@ -168,40 +169,40 @@ At this point, we can stop the running application and try to deploy it to a clo
168169

169170
This is where the true value of Nitric shines. You don't need to perform any manual cloud deployment activities or add solutions like Terraform to get this project into your cloud environment, Nitric takes care of that for you.
170171

171-
To perform the deployment we'll create a `stack`, stacks give Nitric the config needed for a specific cloud instance of this project, such as the provider and region.
172+
To perform the deployment we'll create a `stack`, stacks give Nitric the configuration needed for a specific cloud instance of this project, such as the provider and region.
172173

173-
The new stack command can help you create the stack by following prompts.
174+
The `stack new` command below will create a stack named `dev` that uses the `aws` provider.
174175

175176
```bash
176-
nitric stack new
177+
nitric stack new dev aws
177178
```
178179

179-
This command will create a file named `nitric.dev.yaml`, with contents like this:
180+
Edit the stack file `nitric.dev.yaml` and set your preferred AWS region, for example `us-east-1`.
180181

181182
```yaml title:nitric.dev.yaml
182-
provider: nitric/[email protected]
183-
region: us-east-1
183+
# The nitric provider to use
184+
provider: nitric/aws@latest
185+
# The target AWS region to deploy to
186+
# See available regions:
187+
# https://docs.aws.amazon.com/general/latest/gr/lambda-service.html
188+
region: us-east-2
184189
```
185190
186-
With the stack file in place we can run the deployment:
191+
<Note>
192+
You are responsible for staying within the limits of the free tier or any
193+
costs associated with deployment.
194+
</Note>
195+
196+
Let's try deploying the stack with the `up` command:
187197

188198
```bash
189199
nitric up
190200
```
191201

192-
Go ahead and test your new Fastify+Nitric app in the cloud, you can start with the API Gateway URL returned by the `up` command.
202+
When the deployment is complete, go to the relevant cloud console and you'll be able to see and interact with your application.
193203

194-
<Note>
195-
When you're done with the cloud deployment you can tear it down using the
196-
`nitric down` command.
197-
</Note>
204+
To tear down your application from the cloud, use the `down` command:
198205

199-
## What next?
200-
201-
Now that you have the basics down, try exploring other Nitric resources available to enhance your app.
202-
203-
- [Key Value Store](/keyvalue)
204-
- [Schedules](/schedules)
205-
- [Storage](/storage)
206-
- [Messages](/messaging)
207-
- [Secrets](/secrets)
206+
```bash
207+
nitric down
208+
```

docs/guides/nodejs/graphql.mdx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,14 @@ nitric stack new dev aws
366366

367367
Edit the stack file `nitric.dev.yaml` and set your preferred AWS region, for example `us-east-1`.
368368

369-
### AWS
369+
```yaml title:nitric.dev.yaml
370+
# The nitric provider to use
371+
provider: nitric/aws@latest
372+
# The target AWS region to deploy to
373+
# See available regions:
374+
# https://docs.aws.amazon.com/general/latest/gr/lambda-service.html
375+
region: us-east-2
376+
```
370377
371378
<Note>
372379
You are responsible for staying within the limits of the free tier or any
@@ -379,7 +386,7 @@ Let's try deploying the stack with the `up` command:
379386
nitric up
380387
```
381388

382-
When the deployment is complete, go to the relevant cloud console and you'll be able to see and interact with your WebSocket application.
389+
When the deployment is complete, go to the relevant cloud console and you'll be able to see and interact with your application.
383390

384391
To tear down your application from the cloud, use the `down` command:
385392

0 commit comments

Comments
 (0)