Back End Deep Dive
Behind this website's sleek user interface lies a cutting-edge serverless backend optimized for efficiency, resilience and scale. Here's an inside look at the tech powering it.
Fully Serverless with Next.js
I built the entire backend using Next.js so this is 100% serverless. This means no managing, patching or scaling servers.
Serverlessness provides accurate cost tracking and massive scalability. You only pay for what you use. Resources scale up or down to match traffic.
I can focus on rapid feature development rather than backend ops and maintenance. This speed is a huge advantage.
Next.js for Static Site Generation
I built the site using Next.js, which allowed us to pre-render most pages as static HTML. This means pages load near instantly without needing a ton of client-side JavaScript.
Next.js also enables server side rendering. This allows us to dynamically generate certain pages while still appearing static to search engines. Overall, Next.js optimization helps the content rank higher on page speed scores.
For example, the "Matterport Tours in Temecula" article is indexed by Google. When users search that term, Google surfaces the relevant content.
PlanetScale Serverless Database
For the database, I selected PlanetScale. This fully-managed MySQL platform is optimized for serverless.
PlanetScale provides unlimited scalability and built-in high availability. They handle all database management and ops work.
Again, no servers to manage here either. The database effortlessly scales to support the site usage.
AWS Step Function-Like Workflows with Inngest (without the heavy-ness)
For orchestrating (if/then routing, retries, and sequencing) the serverless functions, I used Inngest - an open source serverless orchestration service written in TypeScript (similar to AWS Step Functions).
Inngest brings AWS step function-like capabilities directly into our codebase. I can create complex workflows using simple async/await syntax.
A key benefit is Inngest's typed events system. I define events and their payloads as TypeScript interfaces. This ensures correctness (and fewer headaches trying to remember events) as I build out workflows.
When adding new workflow steps, TypeScript alerts me if I try to send invalid events. Events always have the right shape.
Inngest also seamlessly integrates with the Next.js serverless functions. There's no worrying about function versions or permissions.
Overall, Inngest allows us to confidently build reliable, scalable workflows in a typed, testable way.
Built for Failure Resilience
In serverless, failures happen. Network requests time out. Services go down. Ingest mitigates this.
Each step in a workflow is isolated. If one fails, I just retry that step without breaking everything.
This makes this system reliable and robust. I can also easily respond to failures programmatically.
Overall, this serverless backend tech provides a lean, agile foundation to build on.