Issue #12 – Type safety end to end – Vercel on the edge
TypeScript, static typing, has been increasing in popularity in the web development world, at the time of writing this, tRPC, at TypeScript project, is the second most trending on GitHub.
End to end type safety is more of a developer experience kind of problem, it is better to detect errors pre-compilation, and during development, than at runtime. That means less time debugging, and we can take it a step further and say less time writing unit tests.
What does end to end type safety mean? It means that you have a single source of truth across your application for your types. Generally, this would come from your database schema.
Enter tRPC. How does tRPC fit in any of this? tRPC allows us to develop and consume type safe APIs, without schemas or code generation. You can write your endpoint as types and the client gets access to these types, all thanks to the power of Typescript and React Query. During development, if at any point we change our endpoint types, the client can detect these changes, thus less time trying to figure out where to handle all this. In contrast to achieve this sort of feat with GraphQL, you might end up chaining it with other libraries, however, tRPC is not a 1:1 replacement for GraphQL.
Since GraphQL is designed as a language-agnostic specification for implementing APIs, it doesn’t take full advantage of the power of a language like TypeScript
Vercel recently came out with the Edge Runtime, a runtime that is designed to be leveraged by other frameworks. The Edge Runtime is currently in the experimental phase for NextJS, with promises of fast startups and low latency, this is surely one to get excited about.
designed to help framework authors adopt edge computing and provide open-source tooling built on Web standards
This is for usage at framework level and not at application code level. When your framework is built on the Edge Runtime, at a production level, your framework gets to choose the optimal infrastructure for you.
One point to consider is that in production, Edge Runtime uses Javascript V8 Engine and not Nodejs.
If your application has some NodeJS APIs that it depends on, moving towards the Edge Runtime might not be the right move
You can go through this Getting Started to learn more:
Amazon Elastic Compute Cloud (EC2) allows you to pick and choose your virtual hardware based on your specific project requirements. You can customize everything, from the processor to the operating system.
The Elastic in EC2 refers to the virtual server’s elasticity, meaning it is entirely up or down-scaleable depending on demand. This adaptability and access to on-demand virtual hardware make it ideal for hosting cloud native & enterprise applications.
Some services exclusive to AWS are:
The AWS EC2 free tier includes 750 hours of Linux and Windows t2.micro instances each month for a year! Additionally, there are five ways to pay your instances; On-Demand, Savings Plans, Reserved Instances & Spot Instances. You can also pay for a dedicated physical server. Read more about EC2 pricing here.
Microservices Data Design Patterns
Neeraj Kushwaha discusses some great data design patterns when working with microservices.
A natural language processor that converts English to RegEx!
PocketBase is a single file backend built for SaaS & mobile applications. It’s open source and integrates with your favorite javascript frontend stack! Dart integration coming soon.