Fatima Logofatima
Getting Started

Heaven (reloading)

Heaven powers up env runtime reloading.

Restarting a process is really annoying, especially when dealing with slow builds, fatima helps you with that by providing "Heaven", a runtime env reloading solution.

Heaven, runtime reloading

To enable runtime reloading, we will use fatima/heaven with the watch method.

instrumentation.ts
// Here we are using the 'instrumentation' entry hook to watch for changes
export async function register() {
  if (process.env.NEXT_RUNTIME === "nodejs") {
    const { heaven } = await import("fatima/heaven");
 
    heaven.watch();
  }
}

Only during development

heaven.watch() only runs listens for changes if you execute your app with fatima dev, otherwise it will be ignored.

Needs to be executed

If your framework does not support hooks, or for some reason you can't tweak the app entry file, you can't use Heaven runtime reloading.

Watching local changes

Local changes are automatically detected by Heaven, you don't need to do anything.

.env.example

.env.example is ignored by Heaven watch feature, you can use it to document your environment variables.

Watching cloud changes

For watching cloud changes, you need to setup a webhook in your secret manager.

Heaven natively runs on port 15781, but you can explicitly set the heaven option in your fatima.config.ts.

fatima.config.ts
export default config({
  heaven: 15781,
});

This will spin up an endpoint at http://localhost:15781/fatima accepting any HTTP method to trigger a reload.

It is your job to provide the tunneling service, here's a list of services you can use:

For much more, check the Awesome Tunneling repo

After setting up the tunneling you just need to set the webhook URL in your secret manager to the endpoint URL.

My secret manager does not support webhooks

This usually happens with tools that have a secret manager but aren't secret managers themselves: vercel, railway, trigger.dev, etc.

In this case, you can use the fatima reload command to trigger a reload.

fatima reload

You can run this command on a second terminal without stopping your process.

On this page