Configuration
Configure your Baeta project in a few simple steps.
Configuration File
Baeta will look for a configuration file named baeta or .baeta in the current working directory, with any of the following extensions:
.ts,.mts.js,.mjs
note
The configuration file must use ESM. If you're using .ts or .js, ensure "type": "module" is set in your package.json, otherwise use the .mts or .mjs extension.
Basic Configuration
1. Define Schema Location
First, specify where your GraphQL schemas are located:
import { defineConfig } from "@baeta/cli";
export default defineConfig({
graphql: {
schemas: ["src/**/*.gql"], // Location of your GraphQL schemas
},
});
2. Add package.json Scripts
{
"scripts": {
"generate": "baeta generate",
"start": "baeta generate --watch --run='node --watch --inspect src/app.ts'"
}
}
These scripts provide:
- generate: Updates GraphQL types and resolvers
- start: Runs development server with automatic restart on changes
tip
If you're using Bun or Deno you can replace start with either:
{
"start:bun": "baeta generate --watch --run='bun --watch --inspect src/app.ts'",
"start:deno": "baeta generate --watch --run='deno --watch --inspect --allow-net --allow-read --allow-env src/app.ts'"
}
tip
Run baeta generate --help for a list of all available commands.
Next Steps
Once configured, you're ready to create your first module.