Ampt lets developers rapidly build, deploy, and scale JavaScript/TypeScript apps in the cloud without complicated configs or managing infrastructure.
In this quick lesson we're going to learn:
- What is Ampt
- How does it simplify our development workflow by configuring and provisioning infrastructure for us
- How to install @ampt/cli
- How to create a new Ampt project by choosing a TypeScript express API template
- How to iterate on a newly created API by taking advantage of Ampt's fast feedback loop.
Transcript
According to AMPed landing page, it is the fastest way to get things done in the cloud. The whole idea is that AMPed lets developers rapidly build, deploy, and scale JavaScript applications in the cloud
without messing with complicated configs, managing infrastructure, logging into AWS console, and so on. So the whole promise is that we are going to get all the power of the cloud with none of the complexity. And this small example shows AMPed developer experience.
So we can see that we can import many modules from AMPed SDK, including HTTP. We can use well-known frameworks and libraries, such as Express.
And with a single line, AMPed is going to figure out what kind of infrastructure does it need to provision in the cloud for us to get the server up and running. So again, we don't have to think about the cloud. The only thing that we need to think about is what kind of behavior we want to implement. Here's another example.
Suppose that we have some kind of business logic that we would like to execute every hour. So we can import tasks from AMPed SDK. And if I scroll down a little bit, we can see that we can create an instance of a task and have it execute every hour.
And again, AMPed is going to provision, configure, and figure out how exactly do we run a task every hour using AWS. The only part that we are actually responsible for is our custom business logic. With all of that, let's get started.
First of all, we need to go ahead and install the AMPed command line interface. Once this is done, I'm going to go ahead and run AMPed. And this is going to open a new browser tab, which we can see over here. So I'm going to go ahead and click on Confirm. And now we need to sign in. So I'm going to sign in with Google.
And my device is now connected to AMPed. So I'm going to create a new directory for my project, which I'm going to call my Egghead AMPed API. I'm going to cd into it and run the AMPed command again. Do you want to create a new app? Yes, I do. And we have a number of templates to choose from. So there are templates for JavaScript.
There are templates for TypeScript, Fastify, Koa, Hono, many frameworks like Astro, Next.js, Remix, Angular, so many to choose from. I'm going to go ahead and choose the TypeScript API Express and hit Enter. Next, enter a name for your app. I'm going to go ahead with my Egghead AMPed API.
After a while, we can see that AMPed has generated a brand new app for us. And we can see our app in the dashboard over here. So let me go ahead and click on that link. And here we can see the overview of our app. So we have an active sandbox, which is deployed to AWS in the US East 1 region. And currently, there isn't much happening here.
But we can see that we can use schedules and tasks and events and storage and many other things in our AMPed applications. So let's go to the code editor to see what exactly was deployed to AWS. So this is the project that was generated for us.
And if I open up the index.ts file, we can see that this file is creating an express server. We are also importing HTTP module from AMPed SDK. Over here, we are defining three different routes. So there's a route for hello, greet slash name. There's also a post submit.
And over here, we are passing the express app to AMPed in order for it to do its magic. Let's go back to the terminal for a second. Here we can see that AMPed has provisioned a personal sandbox for us.
A sandbox is your own personal development workspace that automatically syncs and deploys changes from your local environment into the cloud in under a second. Let's give it a shot. So I'm going to go ahead and copy that. And I'm going to test the hello route. So it should respond with a 200 and a message hello from the public API.
So let me just go ahead and hit that. API slash hello. And here it is. Hello from the public API. So I'm going to modify it to hello, egghead, friends from the public API. I've saved those changes. We can see that AMPed has successfully updated our code in a few seconds.
And if I hit this endpoint again, we can see that those changes were deployed. And for the record, this part of the video is not edited. Let me just go ahead and add some more characters over here. Save. Go ahead. Hit this endpoint again. And we can see that our code changes were already deployed into the cloud.
So in addition to getting all of our infrastructure configured for us in AWS cloud, we also get a very fast feedback loop.