In ES modules, you can use await at the top level without wrapping in an async function.
// In a .mjs file or type="module"
const config = await loadConfig();
const db = await connectDB(config);
export { db };
The module waits for setup before exporting.