FrogBot and all of its official packages are fully ESM. If you want to use
FrogBot within your own projects, make sure you are writing your scripts in
ESM format or dynamically importing the FrogBot Config.
Run a standalone script
In your FrogBot app, createsrc/seed.ts. Import your config through the app’s @frogbot-config alias and initialize FrogBot with getFrogBot. Its options are listed in Importing it. This example creates a user in the users collection included in a fresh app:
frogbot run <file> [args...] command:
- Loads
.env*files from the current directory using Next.js environment-loading rules before importing your script. You don’t needdotenv. WithNODE_ENVunset, it uses development environment files; setNODE_ENV=productionto use production environment files. - Resolves the file relative to the current directory and runs TypeScript or JavaScript through tsx, including your app’s
@frogbot-configalias. - Passes every argument after the file unchanged to your script in
process.argv.slice(2).process.argv[1]is the absolute script path. - Destroys the cached FrogBot instance and exits with code
0when your script’s top level finishes. Await all work you need to complete, as inawait seed()above; pending timers or background work won’t keep the command running.
[frogbot] run failed: <file> and the error stack, then exits with code 1. A missing file prints a file-not-found message and exits with code 1. Omitting the file prints usage and exits with code 2.