Skip to content

Repository files navigation

starter

Starting point for new projects

Getting started

Create .env files

  1. Create .env.alchemy for alchemy specific environment variables.
touch .env.alchemy

Add these values inside. Both are required for Alchemy to work properly.

# I like to gen both of these w/ `openssl rand -base64 32`, don't lose them!
ALCHEMY_STATE_TOKEN="xyz-123"
ALCHEMY_SECRET_PASSWORD="xyz-123"
  1. Create .env.${stage} file for every stage you plan to run app in (including local - which will be the output of the whoami command). These files will be used for environment variables your application(s) need access to.
touch .env.$(whoami)
touch .env.staging
touch .env.production

Modify all apps and infra package.json to include deploy and/or dev scripts

Any app (or infra) that has an alchemy.run.ts file should also contain scripts for deploy, destroy, and dev.

The "base" app name is up to you. I prefer to match this with whatever the name is in my root package.json

"scripts": {
    ...
    "dev": "alchemy dev --app {APP_NAME_HERE}",
    "deploy:staging": "alchemy deploy --app {APP_NAME_HERE} --stage staging",
    "deploy:production": "alchemy deploy --app {APP_NAME_HERE} --stage production",
    "deploy:another-cool-stage": "alchemy deploy --app {APP_NAME_HERE} --stage another-cool-stage",
    "destroy:staging": "alchemy destroy --app {APP_NAME_HERE} --stage staging",
    "destroy:production": "alchemy destroy --app {APP_NAME_HERE} --stage production",
}

Optional: Specify your Alchemy profile

If you have multiple Cloudflare accounts, configure a new profile in alchemy and make sure to configure the app to use said profile

In packages/infra/src/util.ts, modify the createApp() function to use the profile you want.

...
const app = await alchemy(appName, {
    profile: "default", // change me, if you want!
    password: process.env.ALCHEMY_SECRET_PASSWORD,
    stateStore: (scope) => getSharedStateStore(scope),
});
...

Creating new packages

bun turbo gen

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages