Self-Hosted Deploys

What Is Self-Hosted Deployment?

By default, NetLaunch deploys your site to its shared Firebase Hosting infrastructure (<name>.web.app). With self-hosted deployment, you can deploy to your own Firebase project instead. You get the same simple CLI and dashboard workflow, but the site is hosted entirely under your Firebase account with your own billing, quotas, and domain settings.

Prerequisites

Before setting up self-hosted deploys you need:

  1. A Firebase project — create one at console.firebase.google.com
  2. Firebase Hosting API enabled — go to your project's Hosting page in the Firebase console and click "Get Started" to enable it
  3. A service account key — a JSON credentials file that grants NetLaunch permission to deploy to your project

Step-by-Step Setup

1. Generate a Service Account Key

  1. Go to the Firebase console and select your project
  2. Navigate to Project Settings (gear icon) > Service accounts
  3. Click Generate new private key
  4. Save the downloaded JSON file securely (e.g., ./service-account.json)

Important: This file contains sensitive credentials. Never commit it to source control. Add it to your .gitignore.

2. Save the Config via CLI

# Save locally (used for CLI deploys from this machine)
netlaunch config set --file ./service-account.json

# Save locally AND sync to server (used for dashboard deploys too)
netlaunch config set --file ./service-account.json --sync

3. Save the Config via Dashboard (alternative)

  1. Go to Settings in the NetLaunch dashboard
  2. Find the Self-Hosted Config section
  3. Upload your service account JSON file
  4. Click Save

Config saved through the dashboard is stored server-side and applies to both dashboard and CLI deploys (when synced).

4. Deploy

Once configured, deploy as usual:

netlaunch deploy -s my-app -f ./dist.zip

NetLaunch detects your self-hosted config and deploys to your Firebase project instead of the shared infrastructure.

How Deploy Resolution Works

When you run netlaunch deploy, the CLI determines where to deploy using this priority order:

Priority Source Description
1 (highest) --hosted flag Forces deploy to NetLaunch hosting, ignoring all self-hosted config
2 Server config Config synced to NetLaunch server (set via --sync or dashboard)
3 Local config Config saved locally at ~/.netlaunch/firebase-config.json
4 (default) NetLaunch hosting Default shared hosting if no self-hosted config exists

CLI Examples

# Set up self-hosted config (local only)
netlaunch config set -f ./service-account.json

# Set up self-hosted config (local + server)
netlaunch config set -f ./service-account.json --sync

# Check current config
netlaunch config show

# Deploy (automatically uses self-hosted config)
netlaunch deploy -s my-app -f ./dist.zip

# Force deploy to NetLaunch hosting (bypass self-hosted config)
netlaunch deploy -s my-app -f ./dist.zip --hosted

# Remove self-hosted config (revert to NetLaunch hosting)
netlaunch config remove

Dashboard Instructions

Uploading Config

  1. Sign in to the NetLaunch dashboard
  2. Open Settings from the avatar menu
  3. Scroll to Self-Hosted Config
  4. Click Upload Service Account JSON and select your key file
  5. Click Save to store the config on the server

Deploying

Once a server-side config is saved, all deployments from the dashboard automatically use your Firebase project. No extra steps needed when creating a new deployment or redeploying.

Removing Config

To stop deploying to your own project, go to Settings > Self-Hosted Config and click Remove. Future deploys will go to NetLaunch shared hosting.