Skip to content

Extend an Abstract Stack

Open in ChatGPTOpen in Claude

The framework’s stacks are abstract classes you extend. axs add stack scaffolds a subclass for you, but the shape is simple enough to write by hand: subclass the abstract stack and supply its project hooks.

An ApiStack subclass supplies two hooks — the route list and the registry resources that resolve {{token}} env values:

export class AppApiStack<T extends BaseEnvConfig> extends ApiStack<T> {
protected getLambdaConfigs(): ApiLambdaConfig[] {
return apiLambdaConfigs;
}
protected buildRegistryResources(): Omit<BuildRegistryProps, "stage"> {
// Read ARNs from SSM (written by DataStack) and register handles so
// lambda env tokens like {{dynamodb.mainTable.tableName}} resolve.
return { app: { corsAllowedOrigins: this.envConfig.corsAllowedOrigins?.join(",") ?? "" } };
}
}

A DataStack subclass passes its config arrays through super:

export class AppDataStack<T extends BaseEnvConfig> extends DataStack<T> {
constructor(scope: Construct, id: string, props: DataStackProps<T>) {
super(scope, id, { ...props, tables });
}
}
Terminal window
axs add stack api

See the axs add stack reference — it prints the exact bin/app.ts wiring snippet too.

© 2026 Axis Tech. Powered by axis-tech.co.