Skip to content

aerostack add

Add a new service or shared library to your project.

Terminal window
aerostack add function <name>

Creates a new Worker service at services/<name>/index.ts and registers it in aerostack.toml. Each service is an independent entry point that can be deployed separately.

Terminal window
aerostack add function payments-api
aerostack add function email-worker
aerostack add function auth-webhook

Generated file: services/payments-api/index.ts

import { Aerostack } from '@aerostack/sdk'
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const sdk = new Aerostack({ env })
// Your payments-api logic here
return new Response('Hello from payments-api')
}
}

Terminal window
aerostack add lib <name>

Creates a shared module at shared/<name>.ts, importable from any service as @shared/<name>.

Terminal window
aerostack add lib auth
aerostack add lib utils
aerostack add lib validators

Usage in any service:

import { validateToken } from '@shared/auth'
import { formatDate } from '@shared/utils'

Provision Cloudflare resources (D1, KV, R2, Queues) defined in your aerostack.toml in your Cloudflare account.

Terminal window
aerostack resources create [flags]
FlagDefaultDescription
-e, --envstagingTarget environment
Terminal window
# Create all resources for staging
aerostack resources create
# Create for production
aerostack resources create --env production