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

Commit d9b0f6c

Browse files
committed
get build working - switching to new components
1 parent 96625b1 commit d9b0f6c

File tree

93 files changed

+1058
-1165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1058
-1165
lines changed

docs/concepts/cicd.mdx

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -40,42 +40,3 @@ Providers have already been written for a variety of foundational services such
4040
## CI/CD Guides
4141

4242
Nitric has several guides for integrating with popular CI/CD pipelines.
43-
44-
<GuidesGrid>
45-
<Guide
46-
href="/guides/deploying/github-actions"
47-
name="GitHub Actions"
48-
iconClassName={
49-
'fill-zinc-700/50 dark:fill-white/40 dark:group-hover:fill-primary-300/60'
50-
}
51-
customIcon={FaGithub}
52-
description="Use GitHub Actions to deploy your Nitric application."
53-
/>
54-
<Guide
55-
href="/guides/deploying/gitlab-ci"
56-
name="GitLab Actions"
57-
iconClassName={
58-
'fill-zinc-700/50 dark:fill-white/40 dark:group-hover:fill-primary-300/60'
59-
}
60-
customIcon={FaGitlab}
61-
description="Use GitLab CI to deploy your Nitric application."
62-
/>
63-
<Guide
64-
href="/guides/deploying/azure-pipelines"
65-
name="Azure Pipelines"
66-
iconClassName={
67-
'fill-zinc-700/50 dark:fill-white/40 dark:group-hover:fill-primary-300/60'
68-
}
69-
customIcon={SiAzurepipelines}
70-
description="Use Azure Pipelines to deploy your Nitric application."
71-
/>
72-
<Guide
73-
href="/guides/deploying/google-cloud-build"
74-
name="Google Cloud Build"
75-
iconClassName={
76-
'fill-zinc-700/50 dark:fill-white/40 dark:group-hover:fill-primary-300/60'
77-
}
78-
customIcon={SiGooglecloud}
79-
description="Use Google Cloud Build to deploy your Nitric application."
80-
/>
81-
</GuidesGrid>

docs/concepts/comparison/ampt.mdx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ These are the main differences between the two:
1717

1818
To get a deeper understanding of the differences, let's see the same app built in both Nitric and Ampt.
1919

20-
<CodeSwitcher compare>
20+
<Row>
2121

22-
```javascript {{title: 'Nitric', label: 'hello.ts' }}
22+
<Col>
23+
24+
**Nitric**
25+
26+
```typescript file:hello.ts
2327
import { api } from '@nitric/sdk'
2428

2529
const helloApi = api('main')
@@ -31,7 +35,13 @@ helloApi.get('/hello/:name', async (ctx) => {
3135
})
3236
```
3337

34-
```javascript {{title: 'Ampt (Experimental)', label: 'hello.ts' }}
38+
</Col>
39+
40+
<Col>
41+
42+
**Ampt (Experimental)**
43+
44+
```typescript file:hello.ts
3545
import { api } from '@ampt/api'
3646

3747
const helloApi = api('main').router('/hello')
@@ -43,7 +53,9 @@ helloApi.get('/:name', async (event) => {
4353
})
4454
```
4555

46-
</CodeSwitcher>
56+
</Col>
57+
58+
</Row>
4759

4860
## Differences
4961

docs/concepts/comparison/aws-cdk.mdx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ These are the main differences between the two:
1818

1919
To get a deeper understanding of the differences, let's see the same app built in both Nitric and AWS CDK. This simple cloud app uses a Function to retrieve a hello world message using a path parameter.
2020

21-
<CodeSwitcher compare>
21+
<Row>
2222

23-
```javascript {{title: 'Nitric', label: 'hello.ts' }}
23+
<Col>
24+
25+
**Nitric**
26+
27+
```typescript file:hello.ts
2428
import { api } from '@nitric/sdk'
2529

2630
const helloApi = api('main')
@@ -32,7 +36,13 @@ helloApi.get('/hello/:name', async (ctx) => {
3236
})
3337
```
3438

35-
```javascript {{title: 'AWS CDK', label: 'src/index.js'}}
39+
</Col>
40+
41+
<Col>
42+
43+
**AWS CDK**
44+
45+
```javascript file:src/index.js
3646
exports.handler = async function (event = {}) {
3747
const name = event.pathParameters.name
3848

@@ -43,7 +53,7 @@ exports.handler = async function (event = {}) {
4353
}
4454
```
4555

46-
```javascript {{title: 'AWS CDK', label: 'lib/hello-stack.ts'}}
56+
```typescript file:lib/hello-stack.ts
4757
import * as cdk from 'aws-cdk-lib'
4858
import { Construct } from 'constructs'
4959
import * as apigateway from 'aws-cdk-lib/aws-apigateway'
@@ -71,7 +81,9 @@ export class HelloWorldStack extends cdk.Stack {
7181
}
7282
```
7383

74-
</CodeSwitcher>
84+
</Col>
85+
86+
</Row>
7587

7688
Nitric offers a simplified, user-friendly way to define APIs with the added benefit of being able to use custom providers for greater control and flexibility, while maintaining cloud neutrality. On the other hand, AWS CDK, with its verbose and explicit syntax, provides deep customization and control specifically within the AWS ecosystem, but might be more complex for beginners.
7789

docs/concepts/comparison/encore.mdx

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,40 @@ These are the main differences between the two:
1717

1818
To get a deeper understanding of the differences, let's see the same app built in both Nitric and Encore.
1919

20-
<CodeSwitcher compare>
20+
<Row>
2121

22-
```go {{title: 'Nitric', label: 'services/hello/main.go' }}
22+
<Col>
23+
24+
**Nitric**
25+
26+
```go file:services/hello/main.go
2327
package main
2428

2529
import (
26-
"fmt"
30+
"context"
2731

28-
"github.com/nitrictech/go-sdk/nitric/apis"
29-
"github.com/nitrictech/go-sdk/nitric"
32+
"github.com/nitrictech/go-sdk/nitric"
33+
"github.com/nitrictech/go-sdk/nitric/apis"
3034
)
3135

3236
func main() {
33-
mainApi, err := nitric.NewApi("main")
34-
if err != nil {
35-
fmt.Println(err)
36-
return
37-
}
37+
api := nitric.NewApi("main")
3838

39-
mainApi.Get("/hello/:name", func(ctx *apis.Ctx) {
40-
params := ctx.Request.PathParams()
39+
api.Get("/hello/:name", func(ctx *apis.Ctx) {
40+
ctx.Response.Body = []byte("Hello " + ctx.Request.PathParams()["name"])
41+
})
4142

42-
ctx.Response.Body = []byte("Hello " + params["name"])
43-
})
44-
45-
if err := nitric.Run(); err != nil {
46-
fmt.Println(err)
47-
}
43+
nitric.Run()
4844
}
4945
```
5046

51-
```go {{title: 'Encore', label: 'hello.go'}}
47+
</Col>
48+
49+
<Col>
50+
51+
**Encore**
52+
53+
```go file:hello.go
5254
package hello
5355

5456
import (
@@ -66,7 +68,9 @@ type Response struct {
6668
}
6769
```
6870

69-
</CodeSwitcher>
71+
</Col>
72+
73+
</Row>
7074

7175
The Nitric example shows an API where HTTP request handling is achieved using `faas.HttpContext`, providing control over the request and response objects. The Encore example demonstrates an API where HTTP request handling is reflected through the function parameters and return types, with defined structs for responses.
7276

docs/concepts/comparison/pulumi.mdx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ Nitric is a framework designed to aid developers in building full cloud applicat
2828

2929
To showcase the power of the abstraction provided by Nitric here is a showcase of a Nitric program with an equivalent Pulumi program with application code.
3030

31-
<CodeSwitcher compare>
31+
<Row>
3232

33-
```javascript {{title: 'Nitric', label: 'handle.ts' }}
33+
<Col>
34+
35+
**Nitric**
36+
37+
```javascript file:handle.js
3438
import * as nitric from '@nitric/sdk'
3539

3640
const bucket = nitric.bucket('my-bucket').allow('read', 'write')
@@ -40,7 +44,13 @@ bucket.on('create', '*', async (ctx) => {
4044
})
4145
```
4246

43-
```javascript {{title: 'Pulumi', label: 'src/index.js'}}
47+
</Col>
48+
49+
<Col>
50+
51+
**Pulumi**
52+
53+
```javascript file:src/index.js
4454
const AWS = require('aws-sdk')
4555

4656
exports.handler = async (event) => {
@@ -51,7 +61,7 @@ exports.handler = async (event) => {
5161
}
5262
```
5363

54-
```javascript {{title: 'Pulumi', label: 'lib/handle-stack.ts'}}
64+
```javascript file:lib/handle-stack.js
5565
import * as pulumi from '@pulumi/pulumi'
5666
import * as aws from '@pulumi/aws'
5767
import * as fs from 'fs'
@@ -143,7 +153,9 @@ export const bucketName = bucket.bucket
143153
export const lambdaFunctionName = lambdaFunction.name
144154
```
145155

146-
</CodeSwitcher>
156+
</Col>
157+
158+
</Row>
147159

148160
<Note>
149161
In the pulumi example we get control over absolutely every facet of our

docs/concepts/comparison/sst.mdx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ These are the main differences between the two:
1818

1919
To get a deeper understanding of the differences, let's see the same app built in both Nitric and SST. The SST App in this example is standalone without the frontend code.
2020

21-
<CodeSwitcher compare>
21+
<Row>
2222

23-
```javascript {{title: 'Nitric', label: 'hello.ts' }}
23+
<Col>
24+
25+
**Nitric**
26+
27+
```javascript file:hello.js
2428
import { api } from '@nitric/sdk'
2529

2630
const helloApi = api('main')
@@ -32,7 +36,13 @@ helloApi.get('/hello/:name', async (ctx) => {
3236
})
3337
```
3438

35-
```javascript {{title: 'SST', label: 'packages/functions/hello.ts'}}
39+
</Col>
40+
41+
<Col>
42+
43+
**SST**
44+
45+
```javascript file:packages/functions/hello.ts
3646
import { ApiHandler, usePathParam } from 'sst/node/api'
3747

3848
export const handler = ApiHandler(async (evt) => {
@@ -45,7 +55,7 @@ export const handler = ApiHandler(async (evt) => {
4555
})
4656
```
4757

48-
```javascript {{title: 'SST', label: 'stacks/hello-stack.ts'}}
58+
```javascript file: stacks/hello-stack.ts
4959
import { StackContext, Api } from 'sst/constructs'
5060

5161
export function API({ stack }: StackContext) {
@@ -61,7 +71,9 @@ export function API({ stack }: StackContext) {
6171
}
6272
```
6373

64-
</CodeSwitcher>
74+
</Col>
75+
76+
</Row>
6577

6678
One key difference between Nitric and SST examples is while Nitric allows defining the API route handler inline which streamlines and simplifies the code, SST separates the route definition and the handler into different files for modularity. Another difference is that Nitric is cloud-neutral while SST is designed specifically for AWS.
6779

docs/concepts/comparison/terraform.mdx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ Nitric is a framework designed to aid developers in building full cloud applicat
2626

2727
To showcase the power of the abstraction provided by Nitric here is a showcase of a Nitric program with an equivalent Terraform configuration with application code.
2828

29-
<CodeSwitcher compare>
29+
<Row>
3030

31-
```javascript {{title: 'Nitric', label: 'handle.ts' }}
31+
<Col>
32+
33+
**Nitric**
34+
35+
```javascript file:handle.js
3236
import * as nitric from '@nitric/sdk'
3337

3438
const bucket = nitric.bucket('my-bucket').allow('read', 'write')
@@ -38,7 +42,13 @@ bucket.on('create', '*', async (ctx) => {
3842
})
3943
```
4044

41-
```javascript {{title: 'Terraform', label: 'src/index.js'}}
45+
</Col>
46+
47+
<Col>
48+
49+
**Terraform**
50+
51+
```javascript file:src/index.js
4252
const AWS = require('aws-sdk')
4353

4454
exports.handler = async (event) => {
@@ -49,7 +59,7 @@ exports.handler = async (event) => {
4959
}
5060
```
5161

52-
```hcl {{title: 'Terraform', label: 'main.tf'}}
62+
```hcl file:main.tf
5363
terraform {
5464
required_providers {
5565
aws = {
@@ -167,7 +177,9 @@ output "lambda_function_name" {
167177
}
168178
```
169179

170-
</CodeSwitcher>
180+
</Col>
181+
182+
</Row>
171183

172184
<Note>
173185
In the Terraform example we get control over absolutely every facet of our

docs/concepts/comparison/winglang.mdx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ Both options are extremely productive, it's up to you which approach you prefer.
1414

1515
## Code Comparison
1616

17-
<CodeSwitcher compare>
17+
<Row>
1818

19-
```javascript {{title: 'Nitric', label: 'hello.js' }}
19+
<Col>
20+
21+
**Nitric**
22+
23+
```javascript file:hello.js
2024
import { api } from '@nitric/sdk'
2125

2226
const helloApi = api('far-away-galaxy-api')
@@ -26,7 +30,13 @@ helloApi.get('/', async ({ req, res }) => {
2630
})
2731
```
2832

29-
```javascript {{title: 'Wing', label: 'hello.w'}}
33+
</Col>
34+
35+
<Col>
36+
37+
**Wing**
38+
39+
```javascript title:hello.w
3040
bring cloud;
3141

3242
let api = new cloud.Api();
@@ -39,4 +49,6 @@ api.get("/", inflight (request: cloud.ApiRequest): cloud.ApiResponse => {
3949
});
4050
```
4151

42-
</CodeSwitcher>
52+
</Col>
53+
54+
</Row>

0 commit comments

Comments
 (0)