Building a flexible and iterable application in a short time can be challenging. Well-known clouds like AWS, Azure, and GCP help to deliver scalable web applications with low costs within a few weeks. Choose a managed database, move the application code to Docker containers or back-end functions, and deploy everything on any code changes. That’s what modern application development looks like, right?
In this post, I will describe the most important things needed to develop and ship software at an amazing pace, with a Next.js application written in TypeScript, deployed via Vercel, and backed by a serverless database called FaunaDB. I will explain each of these things in detail, adding a few examples here and there. I highly recommend trying them all. All of them have generous free tiers and can be used by a small developer team of up to three members.
The usage of developer-centric deployment platforms in combination with serverless offerings is summarized as the Jamstack. “J-A-M” means JavaScript, APIs, and Markup. More about the Jamstack can be found at https://jamstack.org/.
Deployment is an implementation detail
The number of services that I can use in a cloud is overwhelming. At this point in time, AWS has 250 different services. I need to define how to connect and set up deployments for my new features, for my non-production environment, and for my production environment
If I am working on a project with multiple developers in parallel, I would love to just pass an URL to my co-worker to share my current feature branch.
Additionally, I need to set up domains and sub-domains, scale the service, wire public endpoints, manage database connections, set up secrets management, etc.
The Vercel platform connects seamlessly with version control systems like GitHub or GitLab. I simply connect my repository and adapt my nameserver hostname setting and I am done.
In my current project, I have defined some handy npm tasks that are used in each build to ensure that our software both works and meets software standards and best practices:
{
"scripts": {
"tsc": "tsc", // check type-safety
"lint": "eslint", // do static code analysis
"lint:ci": "eslint --max-warnings=0",
"lint:fix": "eslint --fix",
"test": "jest --watch", // execute tests
"test:ci": "jest --ci",
"test:coverage": "jest --coverage",
"checks": "npm-run-all lint:ci tsc test:ci",
"dev": "env-cmd next dev", // start local dev environment
"start": "next",
"start-port": "next start -p $PORT",
"build": "next build",
"now-build": "npm-run-all checks build", // CI build
"serve": "next start",
}
}
By default, Vercel runs the now-build
task on every build. This triggers some other tasks that statically check our code, run all tests, and build our software.
Due to the fact that everything just works, I get a lot of deployment platform features out of the box. I benefit from upcoming improvements without them giving me any problems in the future.