aerostack add
Add a new service or shared library to your project.
Add a service
Section titled “Add a service”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.
aerostack add function payments-apiaerostack add function email-workeraerostack add function auth-webhookGenerated 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') }}Add a shared library
Section titled “Add a shared library”aerostack add lib <name>Creates a shared module at shared/<name>.ts, importable from any service as @shared/<name>.
aerostack add lib authaerostack add lib utilsaerostack add lib validatorsUsage in any service:
import { validateToken } from '@shared/auth'import { formatDate } from '@shared/utils'aerostack resources create
Section titled “aerostack resources create”Provision Cloudflare resources (D1, KV, R2, Queues) defined in your aerostack.toml in your Cloudflare account.
aerostack resources create [flags]| Flag | Default | Description |
|---|---|---|
-e, --env | staging | Target environment |
# Create all resources for stagingaerostack resources create
# Create for productionaerostack resources create --env production