aerostack add
Add a new service or shared library to your project.
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-api
aerostack add function email-worker
aerostack 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
aerostack add lib <name>Creates a shared module at shared/<name>.ts, importable from any service as @shared/<name>.
aerostack add lib auth
aerostack add lib utils
aerostack add lib validatorsUsage in any service:
import { validateToken } from '@shared/auth'
import { formatDate } from '@shared/utils'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 staging
aerostack resources create
# Create for production
aerostack resources create --env productionWhen using aerostack deploy --cloudflare, resource creation runs automatically if resources haven’t been provisioned yet. You can also run it manually before deploying.