{"id":1644,"date":"2020-08-21T11:28:47","date_gmt":"2020-08-21T09:28:47","guid":{"rendered":"https:\/\/blog.besharp.it\/?p=1644"},"modified":"2024-02-02T12:11:08","modified_gmt":"2024-02-02T11:11:08","slug":"how-to-build-a-serverless-backend-with-typescript-nodejs-and-aws-lambda","status":"publish","type":"post","link":"https:\/\/blog.besharp.it\/how-to-build-a-serverless-backend-with-typescript-nodejs-and-aws-lambda\/","title":{"rendered":"How to build a Serverless backend with TypeScript, Node.js, and AWS Lambda."},"content":{"rendered":"\n

On <\/span>Amazon Web Services<\/b> the Serverless computational service par excellence remains Lambda, a must-have service when talking about this paradigm.<\/span><\/p>\n\n\n\n

AWS Lambda allows you to use computational power without worrying about the management of the underlying servers, patches, software updates, or unexpected machine shutdowns. Using this paradigm, we can focus entirely on our application. <\/p>\n\n\n\n

To date, AWS Lambda offers several <\/span>runtime engines<\/b>. Anyway, it is possible to create your own if you need to use a programming language not yet supported by AWS<\/a>.<\/span><\/p>\n\n\n\n

The great aspect is: it\u2019s up to us to choose the technology that best fits our needs when writing AWS Lambda Functions (FaaS): we can choose the programming language we are most familiar with, allowing us to <\/span>reach our goals faster<\/b>.<\/span><\/p>\n\n\n\n

In this article, we will cover <\/span>how to develop a serverless backend quickly and effectively using TypeScript as a programming language<\/b>.<\/span><\/p>\n\n\n\n

The application will leverage Express, a web application framework used for developing web services for Node.js. <\/span>Node.js<\/b> is the runtime environment – already supported by AWS – in which our TypeScript code, compiled in JavaScript, will run on, on Lambda.<\/span><\/p>\n\n\n\n

After the Analysis, the proposed solution will be deployed on our AWS account. This project can be consulted and downloaded from <\/span>GitHub<\/span><\/a>!<\/span><\/p>\n\n\n\n

AWS services involved<\/h2>\n\n\n\n

Let’s start by proposing the architectural scheme<\/strong> of our Serverless application.<\/p>\n\n\n

\n
\"backend<\/figure><\/div>\n\n\n

The code will be released on an AWS Lambda function, whose invocation will only be possible through an API Gateway.<\/span><\/p>\n\n\n\n

Obviously, a Data Source cannot be missing in a backend application. As we aim to take full advantage of the Serverless paradigm, Aurora Serverless will be involved as a relational database to save and retrieve our data.<\/span><\/p>\n\n\n\n

In summary, we are going to use the following cloud services:<\/p>\n\n\n\n