Vercel supports Ruby on Rails applications in two ways: you can deploy your existing Rails HTTP server as a container image on Vercel Functions, or you can run Rails as a headless backend API with a modern frontend on Vercel.
Copy link to headingPattern 1: Deploy a Rails server as a container image
Vercel Functions support deploying any HTTP server — including a full Rails application — from a `Dockerfile.vercel` or `Containerfile.vercel`. This means you can bring your existing Rails app to Vercel without restructuring it as a headless API.
To get started:
- Add a
Dockerfile.vercel(orContainerfile.vercel) to the root of your project. - Configure your Rails server to listen on
$PORT(the default is80). - Push to your connected Git repository — Vercel builds the image, stores it in the Vercel Container Registry, and deploys it on Fluid compute with autoscaling and Active CPU pricing.
Every git push produces a preview deployment automatically.
See the container images documentation and the changelog announcement for full details.
Copy link to headingPattern 2: Rails as a headless backend API
Vercel also supports using your Ruby on Rails application as an API for a modern frontend deployed on Vercel. Developers often want to keep Rails for backend logic and APIs while adopting React or another modern framework for their UI — a headless architecture makes this possible.
With this approach, your Rails application stays in place as the backend, and your frontend on Vercel connects to it with zero-configuration support for 35+ frontend frameworks.
Copy link to headingBenefits of decoupling
Vercel helps you build and deploy the fastest frontends for your Rails applications. You can deploy your site with zero configuration to the best frontend infrastructure.
- Develop: Connect to your favorite APIs, databases, and content management systems.
- Preview: Integrate with any GitHub, GitLab, or Bitbucket repository for instant continuous deployment.
- Ship: Deploy your site to every edge node worldwide for the fastest sites. Static files, Vercel Functions, the CDN, and more.
Further, by moving to a modern frontend framework like Next.js, you can reduce the load on your backend through Incremental Static Regeneration, saving you money on server-side compute.
Copy link to headingMigrating to Vercel
You can migrate your existing domain and DNS to Vercel with zero downtime.
Vercel has been designed for incremental adoption. You can continue using your existing Ruby on Rails frontend and take over new pages on Vercel as needed. By starting small and incrementally adding more pages, you can prevent derailing feature work by avoiding a complete rewrite.
- The first strategy is to configure your server or proxy such that everything under a specific subpath points to Vercel. For example, your existing website might be at
example.com, and you might configure your proxy such thatexample.com/storeserves your new frontend on Vercel. - The second strategy is to create your new frontend on Vercel which points to the root URL of your domain. Then, you can use rewrites to have some subpaths proxied to your existing app.
If you are using Next.js, learn about incrementally adopting Next.js for more details.