PlaycademyPlaycademy

Deployment

Deploy your project to staging and production environments

Overview

The playcademy deploy command handles the complete deployment workflow using one command.

The Deployment Process

Deployment process diagram showing developer, CLI, platform API, and edge infrastructure

Quick Start

$ playcademy deploy
$ playcademy deploy --env production

Staging is Default

The CLI deploys to staging by default to prevent inadvertent production deployments.


Prerequisites

Authenticate

Run playcademy login if you haven't already authenticated with your Playcademy account.

Initialize Your Project

Run playcademy init to create your configuration file if you haven't already.

Build Your Project

bun run build # or whatever your build command is
npm run build # or whatever your build command is
pnpm run build # or whatever your build command is
yarn run build # or whatever your build command is

Create Deployment Package

Create a .zip from your dist/ directory.

Using the Vite plugin?

If you're using @playcademy/vite-plugin, the zip file is created automatically during build.


Specifying Build Path

You can specify the build path in three ways:

In Config File

Add buildPath to your playcademy.config.js file:

playcademy.config.js
export default {
    name: 'My Project',
    buildPath: '.playcademy/my-project.zip',
}

Via CLI Flag

Pass the build path as a flag:

Command
$ playcademy deploy --build ./dist/my-project.zip

Interactive Prompt

You will be prompted interactively if buildPath has not been configured and you did not pass the --build flag:

Command
$ playcademy deploy
Output
Current Configuration:  Name:   My Project  Status: Not deployed? Path to project zip file: .playcademy/my-project.zip

Backend Deployment

Backend Deployment Behavior

Deployment behavior is determined by the following factors:

ScenarioBehavior
First deploymentBackend deployed if routes or integrations exist
Subsequent deploymentsBackend deployed only if code changed
Force deploymentUse --force-backend to deploy regardless of changes
Skip backendUse --no-backend to skip backend deployment

Examples:

Command
$ playcademy deploy  # Deploy normally (backend changes included if changes detected)$ playcademy deploy --force-backend  # Force backend deployment (when no changes detected)$ playcademy deploy --no-backend  # Skip backend (only deploy frontend changes)

Backend URLs

After deployment, your backend is available at:

EnvironmentURL Pattern
Staginghttps://your-project-staging.playcademy.gg
Productionhttps://your-project.playcademy.gg

Internal loopback calls

Use your *.playcademy.gg URL for external traffic.

For route-to-route calls inside your own deployment, use c.env.SELF.fetch('/api/...') instead of fetching your public URL.

Learn more in Custom Routes.


Environments

Staging vs Production

The CLI supports two deployment environments:

EnvironmentPurposeDefault
StagingSafe testing environment
ProductionLive deployment for end-users

Deploy to staging:

Command
$ playcademy deploy  # Staging is default

Deploy to production:

Command
$ playcademy deploy --env production

Why Staging First?

Staging allows you to:

  1. Test: Verify project works in production-like environment
  2. Debug: Check backend routes and integrations
  3. Preview: Share with teammates before going live
  4. Iterate: Make changes without affecting live users

Separate Deployments

Staging and production are 100% isolated. Deploying to staging doesn't affect production.


Change Detection

The CLI intelligently detects what changed and only deploys what's necessary.

What Gets Checked

ComponentDetection Method
Frontend buildFile hash comparison
Backend codeSource code hash (config + routes)
Project metadataConfig field comparison

Deployment Scenarios

No changes detected:

 No changes detected in playcademy.config.js
 No changes detected in frontend zip file
 No changes detected in API routes

 Nothing to do

Frontend changed:

Changes detected:

  Frontend
    Build: 85.23 KB 86.12 KB  (↑ 0.89 KB)

 Update My Project to a new version? Yes

Backend changed:

Changes detected:

  Backend
    Custom Routes: 42.34 KB 45.12 KB  (↑ 2.78 KB)

 Update My Project to a new version? Yes

Database Migrations

When your project uses a database integration, playcademy deploy automatically detects schema changes and applies migrations to your remote database.

Schema Strategies

The CLI supports two strategies that match how you work with Drizzle locally:

StrategyHow It WorksBest For
Push (default)Diffs your current schema against a stored snapshot to generate SQL on the flyRapid prototyping, projects that don't need migration history
MigrateReads your committed migration files and applies unapplied ones in orderTeams that want version-controlled, reviewable migration SQL

The strategy is auto-detected based on whether migration files exist (db/migrations/meta/_journal.json), or can be set explicitly:

playcademy.config.js
export default {
    name: 'My Project',
    integrations: {
        database: {
            strategy: 'migrate', // or 'push'
        },
    },
}

Previewing Schema Changes

Use playcademy db diff before deploying to preview the SQL that will be applied:

Command
$ playcademy db diff   # Preview migration SQL$ playcademy deploy    # Deploy with auto-migration

Already using push-mode and want to switch? See Switching from Push to Migrate.


Interactive Prompts

If required information is missing, the CLI prompts you:

Command
$ playcademy deploy
Output
Current Configuration:  Name:   My Project  Status: Not deployed? Path to project zip file: ./dist/project.zip? Deploy this project? Yes

Skipping Prompts

Provide all information via config or flags for non-interactive deployments:

Command
$ playcademy deploy \  --name "My Project" \  --build ./dist/project.zip \  --env staging

Dry Run

Preview what would be deployed without making changes:

Command
$ playcademy deploy --dry-run

Sample output:

Deployment Plan (Dry Run)

  Action:          Create new project
  Deploy Frontend: true
  Deploy Backend:  true
  Build Size:      86.06 KB
  Backend URL:     https://my-project-staging.playcademy.gg/api
  Custom Routes:   2
  Integrations:    Timeback

 Dry run complete

Command Options

Full deployment command reference:

Command
$ playcademy deploy [options]
OptionDescription
-c, --config <path>Path to config file
-n, --name <name>Project display name
-d, --description <desc>Project description
-e, --emoji <emoji>Project emoji icon
-b, --build <path>Path to project zip file
--env <env>Environment (staging or production)
--backendForce backend deployment
--no-backendSkip backend deployment
--force-backendDeploy backend even if no changes
--dry-runValidate without deploying
-v, --verboseShow detailed output
--debugShow debug information

See Commands Reference for complete details.


Secrets Integration

Secrets from your .env file are automatically included in the deployment flow. When you have pending secret changes, they appear alongside other changes in the diff:

Changes detected:

  Frontend
    Build: 85.23 KB 86.12 KB  (↑ 0.89 KB)

  Secrets
    Added: API_KEY
    Updated: DATABASE_URL

? Update My Project to a new version? Yes

 Uploading frontend
 Pushing 2 secrets
 MyGame updated successfully!

Single Confirmation

When you confirm the deployment, secrets are pushed automatically—no separate prompt needed.

Required Secrets

If your project uses integrations that require secrets (like authentication), the CLI validates these before deployment:

┌─ MISSING SECRET: BETTER_AUTH_SECRET
 The auth integration requires BETTER_AUTH_SECRET to be set in .env

 Learn more: https://docs.playcademy.net/platform/integrations/authentication
└─

Add the missing secret to your .env file and redeploy.


Updating Your Project

Made changes? Redeploy anytime:

Command
$ bun run build$ playcademy deploy

Observability

Streaming Logs

After deploying, stream real-time logs from your application:

Command
$ playcademy logs # or cd my-project && playcademy logs
Output
✔ Connected to staging logs for "my-project"  Press ctrl+c to stop10:39:51 AM GET /api/hello 200 OK10:39:52 AM POST /api/validate-answer 200 OK

See playcademy logs for more information.


What's Next?

On this page