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
#### A quick-start kit to Build REST API's using Typescript, AWS Lambda & SAM CLI.
6
+
7
+
8
+
By running single command, you will get a `production-ready`[TypeScript](https://typescriptlang.org) lambda application and fully configured on your machine. Our goal is to provide you with a very cool, opinionated architecture. It will provide you with things like generic functionalities for the [lambda](https://docs.aws.amazon.com/lambda/) function and cool request handling support with [Amazon API Gateway](https://aws.amazon.com/api-gateway/), [AWS CloudFormation](https://aws.amazon.com/cloudformation/), and [Amazon DynamoDB](https://aws.amazon.com/dynamodb/).
9
+
10
+
It makes things very easy when the question comes with build, and deploy. It has a strong focus on making sure everything is developer-friendly.
* SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
20
+
* Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) optional.
21
+
22
+
23
+
## Quick Installation
24
+
25
+
To create a project, simply run:
26
+
27
+
```bash
28
+
npx ts-lambda-kit <project-name>
29
+
```
30
+
31
+
or
32
+
33
+
```bash
34
+
npm init ts-lambda-kit <project-name>
35
+
```
36
+
37
+
#### 🥇 Cool! You are ready to make your amazing product.
38
+
#### 🎯 I know you liked it. Please, give a star to the [repository](https://github.com/DevSazal/ts-lambda-kit.git)
3
39
<br />
40
+
41
+
## Architecture
4
42
This project contains source code and supporting files for a serverless application that you can deploy with the SAM CLI. It includes the following files and folders.
5
43
6
44
-`src` - Code for the application's Lambda function written in TypeScript.
@@ -10,21 +48,11 @@ This project contains source code and supporting files for a serverless applicat
10
48
11
49
The application uses several AWS resources, including Lambda functions and an API Gateway API. These resources are defined in the `serverless.yaml` file in this project. You can update the template to add AWS resources through the same deployment process that updates your application code.
12
50
13
-
## Deploy the sample application
51
+
## Developer Guide
14
52
15
-
The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
53
+
install `awscliv2`, `aws-sam-cli`, `nodejs 18` (and `make` only for macOS and Linux) on your machine and ensure that your aws iam account is configured. the configuration profile should be located at `~/.aws/config`, access credentials should be located at `~/.aws/credentials`.
16
54
17
-
To use the SAM CLI, you need the following tools.
18
-
19
-
* SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
20
-
* Node.js - [Install Node.js 18](https://nodejs.org/en/), including the NPM package management tool.
21
-
* Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) optional.
22
-
23
-
#### setup note
24
-
25
-
install `awscliv2`, `aws-sam-cli`, `nodejs 18` (and `make` only for macOS and Linux) on your machine and ensure that your aws iam account configured. the configuration profile should be located at `~/.aws/config`, access credentials should be located at `~/.aws/credentials`.
26
-
27
-
To build and deploy your application for the first time, run the following in your shell using `makefile`:
55
+
To build and deploy your application for the first time, run the following commands in your shell using `makefile` (only for macOS and Linux):
28
56
29
57
```bash
30
58
make i
@@ -47,7 +75,7 @@ You can find your API Gateway Endpoint URL in the output values displayed after
47
75
Build your application with the `make build` command.
48
76
49
77
```bash
50
-
typescript-aws-lambda-serverless-restapi-kit$ make build
78
+
ts-lambda-kit$ make build
51
79
```
52
80
53
81
The SAM CLI installs dependencies defined in `package.json`, compiles TypeScript with esbuild, creates a deployment package, and saves it in the `.aws-sam/build` folder.
@@ -57,14 +85,14 @@ Test a single function by invoking it directly with a test event. An event is a
57
85
Run functions locally and invoke them with the `sam local invoke` command.
58
86
59
87
```bash
60
-
typescript-aws-lambda-serverless-restapi-kit$ sam local invoke {lambda-function-name} --event events/event.json
88
+
ts-lambda-kit$ sam local invoke {lambda-function-name} --event events/event.json
61
89
```
62
90
63
91
The SAM CLI can also emulate your application's API. Use the `sam local start-api` to run the API locally on port 3000.
64
92
65
93
```bash
66
-
typescript-aws-lambda-serverless-restapi-kit$ sam local start-api
The SAM CLI reads the application template to determine the API's routes and the functions that they invoke. The `Events` property on each function's definition includes the route and method for each path.
@@ -90,7 +118,7 @@ To simplify troubleshooting, SAM CLI has a command called `sam logs`. `sam logs`
90
118
`NOTE`: This command works for all AWS Lambda functions; not just the ones you deploy using SAM.
91
119
92
120
```bash
93
-
typescript-aws-lambda-serverless-restapi-kit$ sam logs -n {lambda-function-name} --stack-name typescript-aws-lambda-serverless-restapi-kit --tail
121
+
ts-lambda-kit$ sam logs -n {lambda-function-name} --stack-name typescript-aws-lambda-serverless-restapi-kit --tail
94
122
```
95
123
96
124
You can find more information and examples about filtering Lambda function logs in the [SAM CLI Documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-logging.html).
@@ -100,8 +128,8 @@ You can find more information and examples about filtering Lambda function logs
100
128
Tests are defined in the `__tests__` folder in this project. Use NPM to install the [Jest test framework](https://jestjs.io/) and run unit tests.
typescript-aws-lambda-serverless-restapi-kit$ npm run test
131
+
ts-lambda-kit$ npm install
132
+
ts-lambda-kit$ npm run test
105
133
```
106
134
107
135
## Cleanup
@@ -117,3 +145,7 @@ make destroy
117
145
See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to SAM specification, the SAM CLI, and serverless application concepts.
118
146
119
147
Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/)
0 commit comments