Getting StartedCLI Reference

CLI Command Reference

The Aerostack CLI is the bridging layer between your local code and the global edge network. It automates the complex parts of infrastructure coordination and resource provisioning.

Global Installation

curl -fsSL https://get.aerostack.dev | sh

Core Commands

aerostack init

Initializes a new Aerostack project in the current directory.

  • What it does: Creates your aerostack.toml, scaffolds the project structure, and sets up your local development environment.
  • Flags:
    • --template <name>: Choose a starter template (api, api-neon, express, multi-func, etc.).
    • --db <type>: Choose your database backend (d1, neon).
  • Interactive: If flags are omitted, the CLI will prompt you to select your setup.

aerostack dev

Starts the local development server with high-fidelity edge emulation.

  • What it does: Spins up a local runtime that mirrors the production environment. It provides local versions of Database, Cache, and Bucket storage.
  • Why use it: To test your business logic and SDK calls without deploying to the live network.

aerostack login

Authenticates your terminal with the Aerostack Platform.

  • What it does: Uses your Aerostack API key to securely sign you in.
  • Why use it: Required before you can create projects or deploy to production.

aerostack deploy

Packages and deploys your application to the global edge network.

  • What it does: Compiles your code, synchronizes infrastructure configuration, provisions production resources, and uploads your project to the platform.
  • Flags:
    • --env <name>: Specify the environment (production, staging, development).
    • --no-wait: Return immediately after starting the deployment.

aerostack secrets

Manage your encrypted environment variables.

  • What it does: Securely stores API keys, database credentials, and other sensitive data.
  • Sub-commands:
    • aerostack secrets set KEY VALUE
    • aerostack secrets list
    • aerostack secrets delete KEY

Database Commands

aerostack db

Inspect and manage your project’s databases.

  • What it does: Provides direct access to Database or Managed Postgres instances linked to your project.
  • Sub-commands:
    • aerostack db shell: Open an interactive SQL shell.
    • aerostack db migrate: Manage and apply schema changes.

aerostack db:neon create <name>

Provision a new managed Postgres instance on Neon.

  • Flags:
    • --region: Specify the region (default: aws-us-west-2).
    • --add-to-config: Automatically update your aerostack.toml (default: true).

Advanced Commands

aerostack ai <prompt>

Interact with Aerostack’s AI design system from the command line.

  • What it does: Uses natural language to generate code snippets, scaffold modules, or optimize existing logic.
  • Example: aerostack ai "add a stripe checkout webhook"

The aerostack.toml file

This file is the “Source of Truth” for your project. Aerostack uses it to derive your infrastructure configuration.

name = "my-awesome-api"
main = "src/index.ts"
 
# Database binding
[[d1_databases]]
binding = "DB"
database_name = "my-db"
 
# Database binding for Neon PostgreSQL
[[postgres_databases]]
binding = "PG"
connection_string = "$DATABASE_URL" # Injected from environment
⚠️

Manual Changes: While you can edit aerostack.toml manually, we recommend using the CLI commands to ensure consistency and proper validation.