An Alternative to Vercel

In the world of web development, deploying your projects quickly and efficiently is crucial. Vercel, a popular platform, has made this process a breeze for many developers. However, Vercel isn't without its limitations, especially when it comes to API execution time. In this blog post, we'll explore SST as an alternative that offers Infrastructure as Code (IaC) and direct deployment to AWS.

What is Vercel?

Vercel is a cloud platform that streamlines the development and deployment of web applications and websites. It boasts an intuitive interface and offers a range of features, including serverless functions, static site hosting, continuous deployment, global content delivery, and collaboration tools. To add a project to Vercel, follow these simple steps:

  1. Sign in to your Vercel account or create one if you haven't already.
  2. Connect your project's Git repository to Vercel.
  3. Configure your project settings and choose your deployment branch.
  4. Vercel will automatically build and deploy your project.

Vercel's Limitations

API Time Limit

One of Vercel's primary limitations is its 10-second API execution time limit. While this restriction suits many use cases, it can be a significant hindrance for applications that require longer processing times or perform complex computations. If your project involves heavy server-side processing or data crunching that exceeds this time limit, Vercel might not be the ideal choice.

Cost

Vercel's pricing structure is based on usage, and while it can be cost-effective for small to medium-sized projects, it may not be the most budget-friendly option for very large applications or websites with high traffic. The usage-based model can lead to higher costs as your project scales, potentially limiting its affordability for larger endeavors.

No Direct Control Over Infrastructure

Vercel's user-friendly platform abstracts many of the underlying AWS infrastructure details, which simplifies deployment but can limit your ability to fine-tune AWS resources. If you require precise control over your AWS environment or have specific infrastructure configurations in mind, Vercel may not provide the level of customization you need.

An Alternative - SST

SST is a tool designed to simplify the development of serverless applications on AWS. It addresses challenges associated with working directly with AWS Lambda, Amazon API Gateway, and other AWS services by enabling developers to define their infrastructure using AWS CDK, facilitating live testing and debugging with various IDEs, and offering a web-based dashboard for app management.



SST aims to streamline the process of creating and deploying serverless applications, supporting multiple programming languages for Lambda functions and higher-level constructs tailored for serverless development.From the SST docs "SST converts your infrastructure code into a CloudFormation template using AWS CDK" as seen in the figure below.

Cloud Formation Diagram

Figure 1. Diagram from

SST Guide

AWS CloudFormation is a service provided by Amazon Web Services (AWS) that simplifies and automates the process of provisioning and managing AWS resources. It allows developers and system administrators to define their infrastructure as code using templates, typically in YAML or JSON format. A drawback is lengthy templates that require manual definition of even minor resources, and it poses challenges for code reuse. And its use of YAML and JSON can also complicate handling large templates and requires a steep learning curve for resource definition.

That is where AWS CDK comes in. AWS Cloud Development Kit was a project launched in August 2018, that allows you to use modern programming languages like JavaScript or Python, instead of YAML or JSON.

CDK Diagram

Figure 2. Diagram from

SST Guide

SST simplifies serverless app development using higher-level CDK constructs, offering customization and a local development environment, integrating commands like "sst build" and "sst deploy".

SST File Structure

There are two types of file structure when it comes to using SST in a project, Drop-in Mode and Monorepo.

Drop-in Mode

In drop-in mode, SST can be used as part of your frontend app. For example, if you run npm create sst inside a Next.js app, it'll drop a sst.config.ts in your project. This is great if you have a simple Next.js app and you just want to deploy it to AWS with SST. The directory structure in drop-in mode might look like this:

Folder Structure
my-nextjs-app
├─ next.config.js
├─ sst.config.ts
├─ package.json
├─ public
├─ styles
└─ pages

Monorepo

A monorepo setup is recommended as it's the best way to manage a growing project with interconnected parts like the backend, frontend, and infrastructure. In this structure, you can add your frontend to the packages/web/ directory, packages/functions/ are for backend functions, packages/core/ is for any shared business logic, and stacks/ has your infrastructure definitions. The directory structure in monorepo mode might look like this:

Folder Structure
my-sst-app
├─ package.json
├─ sst.config.ts
├─ packages
│  ├─ core
│  │ └─ migrations
│  ├─ functions
│  ├─ graphql
│  └─ web
└─ stacks
Published: Nov 6, 2023
Join my newsletter to stay updated about the latest I'm working on and share resources I've come across.