alchemy()
The main entry point for creating Alchemy applications. Creates an application scope with the given name and options, managing resources with proper secret handling and lifecycle management.Signature
Parameters
string
required
The name of the application. Used as the root scope identifier and for generating physical resource names.
AlchemyOptions
Configuration options for the application scope.
'up' | 'destroy' | 'read'
default:"'up'"
Determines whether resources will be created/updated or deleted.
'up': Create or update resources'destroy': Delete resources'read': Read-only mode, no changes made
string
default:"process.env.USER"
Name to scope the resource state under (e.g.
.alchemy/{stage}/..).string
A passphrase to use to encrypt/decrypt secrets. Required if using
alchemy.secret() in this scope.boolean
default:"false"
Determines if resources should be simulated locally (where possible). Automatically set to
true if ran with alchemy dev or --dev flag.boolean
default:"false"
Determines if local changes to resources should be reactively pushed to the local or remote environment. Automatically set to
true if ran with alchemy dev, alchemy watch, or --watch flag.boolean
default:"false"
Apply updates to resources even if there are no changes.
boolean
default:"false"
Whether to create a tunnel for supported resources.
boolean
default:"false"
If true, will not print any Create/Update/Delete messages.
boolean
default:"true"
If true, will prune resources that were dropped from the root stack.
'sequential' | 'parallel'
default:"'sequential'"
The strategy to use when destroying resources.
StateStoreType
A custom state store to use instead of the default file system store.
boolean
default:"false"
Whether to adopt resources if they already exist but are not yet managed by your Alchemy app.
boolean
default:"false"
Skip decrypting secrets and treat them as undefined. Requires
--force to be enabled. Useful for recovering from lost encryption passwords.string
default:"process.cwd()"
The root directory of the project.
string
The Alchemy profile to use for authorizing requests.
boolean
default:"false"
Whether to stop sending anonymous telemetry data to the Alchemy team. You can also opt out by setting the
DO_NOT_TRACK or ALCHEMY_TELEMETRY_DISABLED environment variables.Returns
Scope
A Scope instance representing the root application scope. See Scope API for available methods and properties.
CLI Arguments
Thealchemy() function automatically parses the following CLI arguments:
--destroy: Setsphaseto"destroy"--read: Setsphaseto"read"--quiet: Suppresses log output--stage <name>: Sets the stage name--localor--dev: Enables local development mode--watch: Enables watch mode--force: Forces resource updates--tunnel: Enables tunneling for supported resources--adopt: Enables resource adoption--erase-secrets: Erases secrets (requires--force)
Environment Variables
The following environment variables are recognized:ALCHEMY_PASSWORD: Default password for secret encryptionALCHEMY_STAGE: Default stage nameSTAGE: Alternative stage name (lower priority)USERorUSERNAME: Default stage name if not otherwise specifiedDO_NOT_TRACKorALCHEMY_TELEMETRY_DISABLED: Disable telemetry
Examples
Basic Usage
With Explicit Options
Multiple Stages
Local Development
Related
- alchemy.run() - Run a function in a new scope
- alchemy.destroy() - Destroy resources
- alchemy.secret() - Create encrypted secrets
- Scope - Scope API reference