From my perspective, the JAMstack is specially appealing to developers with a frontend background. We can now deploy backend services without needing a deep understanding of server-side architecture, scalability, or even caching.
With that in mind, I have started a new project create-netlify-ts. My point with this project is leverage the self-documenting aspect of TypeScript to lower the barrier for Lambda-Functions even more.
How ❓
Well, by using the self-documenting aspect of TypeScript. On strongly typed code (and luckily with an IDE properly configured), your methods will whisper to you what they need.
But, adding TypeScript to a NodeJS adds a new layer of complexity. Node doesn't get types, so the simplicity of writin a .js file and pushing so it's ✨magically✨ live on Netlify goes away.
In comes netlify-lambda to add a build step to your Netlify Function. I wrote a small tutorial on getting this running.
But even if you know this setup inside-out and backwards, it is a bit annoying to make it every.single.time.
I know that feeling. So I made something.
Faster than instant noodles 🥡
With a simple command in your terminal:
# if you use Yarn
yarn create netlify-ts
# if you use NPM
npx create-netlify-ts
A new project is bootstrapped for you, ready to be deployed on Netlify Functions with another simple command.
The boilerplate is a bit more than the minimum requirements for a working Netlify Function. It can give you some opinionated coding style (very little), and also brings the request and response types, so you can easily write the logic of your service without ever alt-tabbing away from the IDE.
I have got a problem - tried spinning up local server with netlify dev and netlify lamda serve. In both of them, I am not able to run the compiled functions. Can you tell what am I missing?
this is actually great - saved my time for boilerplate