Thursday, July 21st 2022
Announcing the Build Output API
We believe the Web is an open platform for everyone, and strive to make Vercel accessible and available no matter how you choose to build for the Web.
Today we’re introducing the Build Output API, a file-system-based specification that allows any framework to build for Vercel and take advantage of Vercel’s infrastructure building blocks like Edge Functions, Edge Middleware, Incremental Static Regeneration (ISR), Image Optimization, and more.
This new specification also allows us to bring powerful capabilities to Vercel CLI including:
vercel build: Build a project locally or in your own CI environment
vercel deploy --prebuilt: Deploy a build output directly to Vercel, bypassing the Vercel build system
Update to the latest version of Vercel CLI (
npm i -g vercel) to try these out, and check out the documentation.
Powering new capabilities with Vercel CLI
We’ve added new commands to Vercel CLI to help developers run and debug builds locally, and deploy them to Vercel.
Debug and inspect builds locally
When you build for the Web with frontend frameworks, infrastructure platforms like Vercel need to transform the framework output into a format that the platform can understand.
vercel build, we’ve integrated massive portions of that build system into our open-source CLI, allowing you to build your entire project locally, replicating the results of the Vercel build system.
When you run
vercel build, Vercel will automatically detect your frontend framework and generate a
.vercel/output folder that conforms to the Build Output API spec, containing all the build artifacts needed to deploy your app.
This allows you to debug and inspect builds locally, providing faster iteration loops and increased observability. You can also use the
--debug flag to show additional output data during the build.
Decouple build from deploy
Previously, every Vercel deployment also performed a build. While this is convenient for many use cases, it didn't work well if your company cannot share source code with Vercel or your CI already performed a build.
vercel deploy --prebuilt, the deployment step has been decoupled from the build step. When you’re ready to deploy to Vercel, you can send your prebuilt output from your local machine or CI system without sharing any of your source code with Vercel.
Build native functionality into your own framework
Frameworks like Next.js have been able to utilize Vercel platform features like ISR and Edge rendering through simple configuration options within the framework code.
By opening these capabilities to all frameworks through the Build Output API, we’re giving every framework author the ability to integrate these infrastructure primitives with just as much ease including:
- Edge Functions
- Serverless Functions
- Server-side Rendering (SSR)
- Static Generation
- Image Optimization
- ...and more
All of these features are supported simply by conforming to the Build Output API specification in the
.vercel/output folder. And when you’re ready to deploy, you can use
vercel deploy --prebuilt to skip the build step and upload the
.vercel/output folder directly if needed.
We believe this is a critical step for empowering any developer to create when inspiration strikes and not be limited by their infrastructure.
Supporting all frontend frameworks
We partnered with framework authors to help them adopt the Build Output API for their projects. This has led to some amazing new functionality:
- SvelteKit can now run at the edge with Vercel Edge Functions
- Astro can now run at the edge with Vercel Edge Functions
- Nuxt is working on ISR support
We're incredibly excited to support these open-source creators. To continue investing in frontend frameworks, Vercel now sponsors Svelte, Nuxt, Astro, SolidJS, and more.
Let’s hear from some of the framework authors we worked with to adopt the Build Output API:
Next.js also supports the Build Output API. The Next.js team at Vercel was able to help validate the API design before expanding to the larger framework ecosystem.
Try the Build Output API
The Build Output API enables any framework to take advantage of Vercel's infrastructure building blocks. The following frameworks support the Build Output API today with zero configuration:
If you want to create your own framework, check out the Build Output API documentation or learn more about
vercel build and
vercel deploy --prebuilt.
VP of Developer Experience