Configuration options

Rakkas looks for a configuration file named rakkas.config.js (or .ts) in your project root. This file is bundled with esbuild before loading, so you can use modern EcmaScript and TypeScript features.

The configuration file is not needed if you're happy with the defaults.

This file should default export a configuration object or a function that returns one (possibly asynchronously). Supported options are:

PropertyDescriptionDefault value
pageExtensionsFile extensions for pages and layouts["jsx", "tsx"]
pagesDirDirectory that contains pages and layouts relative to /src"pages"
endpointExtensionsFile extensions for endpoints and middleware["js", "ts"]
apiDirDirectory that contains API routes relative to /src"api"
apiRootBase URL for API routes"/api"
trustForwardedOriginSet to true to trust x-forwarded-* headers during development¹false
vite Vite configuration (not all options are supported){}
babel Babel options passed to Vite's React plugin{}

¹See the TRUST_FORWARDED_ORIGIN environment variable for production use.

defineConfig

You can import the defineConfig function from @rakkasjs/cli to ensure TypeScript IDE completion.