Docs
Core Concepts
Deploying
Vercel

Deploying to Vercel

Vercel is a cloud platform for static sites and Serverless Functions that fits perfectly with Rasengan.js. It enables developers to host websites and web services that deploy instantly, scale automatically, and require no supervision, all with minimal configuration.

In this guide, you will learn how to deploy a Rasengan.js app to Vercel.

Prerequisites

Before you start, You need to:

  • Have a Rasengan.js app ready to deploy. If you don't have one yet, you can create a new project using the create-rasengan CLI.
  • Build you app locally, in order to be sure that there is no error that occurs during the build process. You can do this by running the following command:
terminal
npm run build
  • Prepare your app by defining a serverless function because Rasengan.js need to run on the server side. Rasengan.js provides a simple way to create serverless functions using the Rasengan CLI.

    • Configure your rasengan.config.js file to use the vercel hosting strategy:
    rasengan.config.js
    import { defineConfig } from "rasengan";
     
    export default defineConfig({
      server: {
        production: {
          hosting: "vercel",
        },
      },
    });
    • Then create a new serverless function using the rasengan CLI:
    terminal
    npm run prepare

    This command will generate a new serverless function in the api directory.

    • Finally, you can add new generated files and folders into your git repository:
    terminal
    git add .
    git commit -m "Add serverless function"

Deploying to Vercel

To deploy your Rasengan.js app to Vercel, you need to follow these steps:

  1. Install the Vercel CLI by running the following command:
terminal
npm install -g vercel
  1. Login to your Vercel account by running the following command:
terminal
vercel login
  1. Deploy your app by running the following command:
terminal
vercel
  1. Follow the instructions to deploy your app to Vercel. But, you have to change the following scripts used by vercel to deploy your app:
build command: npm run build
development command: npm run dev
  1. Once the deployment is complete, you will get a URL where your app is hosted.

That's it! Your Rasengan.js app is now deployed to Vercel.

Logo Image