Skip to content

This is an expressJS server build for deploying a fullstack nextJS application & database to vercel & supabase

License

Notifications You must be signed in to change notification settings

spark-engine-opensource-projects/Automated-NextJS-deployer-to-vercel-and-supabase

Repository files navigation

Project Deployment Server

This project provides an automated deployment solution for a Next.js project using Vercel and Supabase. The solution includes an Express server that handles the deployment process, integrates with Vercel, manages environment variables, and executes SQL on Supabase.

Table of Contents

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Node.js and npm installed on your machine. You can install them here.
  • An account with Vercel and Supabase.
  • An ngrok account for tunneling.

Installation

To install the project, follow these steps:

  1. Clone this repository:

    git clone https://github.com/spark-engine-opensource-projects/Automated-NextJS-deployer-to-vercel-and-supabase.git
    cd Automated-NextJS-deployer-to-vercel-and-supabase
  2. Create a .env file in the root directory and add your NGROK_AUTH_KEY:

    NGROK_AUTH_KEY=your-ngrok-auth-key
  3. Install the required dependencies by running the bash script:

    chmod +x ./run.sh
    ./run.sh
  4. The script will automatically install necessary packages and start the server.

Usage

Once the server is running, it will listen on port 3000 and establish an ngrok tunnel.

To deploy a project, you can send a POST request to the /deploy endpoint with the necessary structure data.

Project Structure

Here's a brief overview of the project structure:

.
├── Deploy.js                # Handles deployment to Vercel and Supabase
├── server.js                # Express server to manage deployment
├── start-server.js          # Script to start the server and ngrok
├── setup-and-start.sh       # Bash script to install dependencies and start the server
├── package.json            

Environment Variables

The following environment variables need to be set in your .env file:

NGROK_AUTH_KEY: Your ngrok authentication token.

Endpoints

POST /deploy This endpoint triggers the deployment process.

Request Body: A JSON object with the following structure:

{
  "structure": {
    "files": [],
    "packageJson": "",
    "jsConfigCode": "",
    "nextConfigJs": "",
    "postcssConfig": "",
    "tailwindConfig": "",
    "globalsCss": "",
    "envVariables": [],
    "sqlCode": "",
    "keys": {
      "SUPABASE_DB_URL": "",
      "VERCEL_TOKEN": ""
    },
    "projectName": "your-project-name"
  }
}

Response: Returns 200 if the deployment was successfully started, otherwise 500 with error details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This is an expressJS server build for deploying a fullstack nextJS application & database to vercel & supabase

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published