Files
zerobyte/app/server/modules/lifecycle/bootstrap.ts
Nico a4fbe3c8df remove proxy pattern in db and auth (#513)
* refactor: add nitro bootstrap plugin to ensure app is started before first call

* refactor(bootstrap): avoid duplicate event firing

* refactor: extract common setup in initModule function

* refactor: remove proxy pattern for db and auth

Since we migrated away from rr this is not needed anymore as the bundler
correctly split chunks
2026-02-13 21:18:40 +01:00

25 lines
500 B
TypeScript

import { runDbMigrations } from "../../db/db";
import { runMigrations } from "./migrations";
import { startup } from "./startup";
let bootstrapPromise: Promise<void> | undefined;
const runBootstrap = async () => {
runDbMigrations();
await runMigrations();
await startup();
};
export const bootstrapApplication = async () => {
if (!bootstrapPromise) {
bootstrapPromise = runBootstrap();
}
try {
await bootstrapPromise;
} catch (err) {
bootstrapPromise = undefined;
throw err;
}
};