Skip to content

Getting Started ​

Overview ​

Vegas (Vite + GAS) is a development and build tool that brings a dedicated modern project workflow to the Google Apps Script platform.

  • A development server with a local Apps Script-oriented runtime for supported APIs, powered by Vite.

  • A production build pipeline that produces Apps Script-specific bundles from frontend and server code.

  • Native Apps Script authentication and push commands for sending build artifacts directly to an Apps Script project.

Vegas provides defaults for common project layouts, so many projects can start without custom configuration. See Configuring Vegas for available options.

Vite plugins can be supplied through Vegas configuration, allowing framework integrations and other Vite plugins to participate in the client build.

The reasoning behind the project is explained in detail in the Why Vegas section.

Scaffolding Your First Vegas Project ​

sh
$ npm create vegas@latest
sh
$ pnpm create vegas

Then follow the prompts. create-vegas can install dependencies and start the development server during setup. If you skip those steps, enter the generated project directory (replace vegas-project with its actual name) and run:

sh
cd vegas-project
npm install
npm run dev

Vegas requires Node.js 22.18.0 or newer. The commands above use npm; use your selected package manager if different.

SPA Entry Points ​

Vegas does not require Vite's conventional project-root index.html. SPA entries live under the configured client directory, which defaults to src/client.

Vegas supports two entry styles:

  • Module entries named main.ts, main.tsx, main.js, or main.jsx. Vegas generates the corresponding HTML artifact.
  • Physical .html entries inside the client directory. Vegas keeps their relative HTML paths as build entries.

This allows both generated-host and HTML-first projects while keeping client entry points separate from Apps Script server sources. Nested entries can also represent multiple frontends in one Apps Script project.

See Project Structure for the default layouts and entry-point rules.

Command Line Interface ​

In a scaffolded project, run the provided scripts from the project directory:

sh
npm run dev
npm run build
npm run preview

All create-vegas templates include dev, build, preview, login, and push scripts, but their implementations vary by template. Some templates run type checks before vegas build. The vegas executable is provided by the @vegasjs/vegas project dependency.

See Command Line Interface for the available commands, aliases, root argument, and authentication options.

Pushing to Apps Script ​

Set the Apps Script project ID in vegas.config.ts:

typescript
import { defineConfig } from "@vegasjs/vegas";

export default defineConfig({
  appsScript: {
    scriptId: "your-script-id",
    manifest: {},
  },
});

Authenticate once with a Google Desktop OAuth client JSON file:

bash
npm run login -- ./client-secret.json

Then build and push the project:

bash
npm run build
npm run push

vegas push uploads the authoritative contents of the production build output to the configured Apps Script project.

Released under the MIT License.