ghcr.io/triggerdotdev/trigger.dev:latest
Fork the repository mentioned above and change the app name
You should fork the repository before starting so you can make changes and commit them. For example, you’ll need to change theapp
property in the fly.toml
file to be something other than app = "trigger-v2-fly-demo"
.
Install and configure the fly.io CLI
- Install the Fly CLI tool:
- Authenticate the CLI:
Create the fly.io app and pg db
- Launch the app:
- Follow the prompts by
fly launch
and make sure to answer them in the following way:
Do NOT get rid of your terminal output, we will need your database connection string shortly.
Gather your secret environment variables
Required
MAGIC_LINK_SECRET
,SESSION_SECRET
andENCRYPTION_KEY
LOGIN_ORIGIN
andAPP_ORIGIN
https://trigger-v2-fly-demo.fly.dev
DIRECT_URL
DATABASE_URL
which was printed to your terminal after the creation step above:
Optional
AUTH_GITHUB_CLIENT_ID
and AUTH_GITHUB_CLIENT_SECRET
- If you plan on logging in with GitHub auth, you’ll need to create a GitHub OAuth app with the following configuration:

- Once you register the application you’ll need to click on the “Generate new client secret” button:

- And then you can copy out the AUTH_GITHUB_CLIENT_ID and AUTH_GITHUB_CLIENT_SECRET:

RESEND_API_KEY
, FROM_EMAIL
and REPLY_TO_EMAIL
We use Resend.com for email sending (including the magic-link signup/login system). They have a generous free tier of 100 emails a day that should be sufficient. Signup for Resend.com and enter the environment vars below
Set the secrets
Call thefly secrets set
command to stage the secrets to be used on first deploy:
Deploy
Now you can deploy to fly. Here we are setting the machine VM size to use 1 dedicated CPU core with 2 GB of memory, but you can runfly platform vm-sizes
to see other options. The below app will cost about $30/month.
Visit and create an account
Once deployed, you should be able to openhttps://<your fly app name>.fly.dev/
in your browser and create an account, either using GitHub or a magic email link.
Initialize your Next.js project
Next you can easily bootstrap your Next.js project to use your self-hosted instance of Trigger.dev. First,cd
into your Next.js project, then run the @trigger.dev/cli init
command to initialize your Next.js project:
Environments & API Keys
page to copy your dev
API key:

Start your dev server
Run your Next.js project dev server withnpm run dev
and then in a new terminal window you will need to run the @trigger.dev/cli dev
command to connect to your Trigger.dev instance and allow it to tunnel to your local Next.js server: