Configuration, plugins and environment
0.1.0-alpha.1.
defineConfig() validates configuration at runtime. The build also validates plain default exports before replacing dist/. Unknown options, invalid types, reserved prerender paths (/, /api, /assets, /__fastang) and conflicting destinations such as /about plus /about/ fail with an explicit error. Prerender paths contain only ASCII letters, digits, underscores, hyphens and slashes; query strings and fragments are not supported.
0.1.0-alpha.3, fastang dev also validates plain configuration exports before loading application plugins or opening the server. Invalid settings stop the current server; the development supervisor keeps watching. Correct and save fastang.config.ts to restart automatically. Development still renders prerender paths on demand; static HTML is generated only during the build.
Register a hook
src/server/plugins.ts with this file. The hook adds a header to every request handled by Fastify.
import type { FastifyInstance } from 'fastify';
export async function configureServer(app: FastifyInstance): Promise<void> {
app.addHook('onRequest', async (_request, reply) => {
reply.header('x-app-name', process.env['APP_NAME'] ?? 'my-fastang-app');
});
}app.register() for Fastify 5 compatible plugins. Install additional plugins in your project: they are not included automatically.
Server variables
PORT=4000 HOST=127.0.0.1 APP_NAME=my-app npm run dev.env files into the Fastify process. PORT must be valid; the default port is 3278 and the default host is 127.0.0.1.
VITE_ variables are intended for the client and can enter the browser bundle. Do not use them for server secrets. Read server variables from process.env in APIs and plugins.
The two configuration files
fastang.config.ts contains explicit prerender URLs and Vercel adapter options. vite.config.ts uses defineFastangConfig() from @fastang/core/vite: this includes Angular compilation, route generation and the server/client boundary.
src/server code, .server.ts files or server runtime APIs into browser components. The bundle check rejects these imports even through another module. Shared types should live in modules that do not load server dependencies.
Development logging
0.1.0-alpha.5, development defaults to warn for both Fastify and Vite during fastang dev. The listening address remains visible. Routine HTTP request/completion logs and successful route-check summaries are omitted; warnings, errors and failed checks remain visible. Production logger configuration is unchanged.
FASTANG_LOG_LEVEL=info or FASTANG_LOG_LEVEL=debug in the process environment when investigating requests. Accepted values are trace, debug, info, warn, error, fatal and silent. Vite maps trace/debug to info and fatal to error. This controls framework loggers, not application console.log calls or package manager output. The startup address is retained even with silent.
fastang check --quiet suppresses only a successful text summary; diagnostics still print, and --json always returns the JSON report. The dev supervisor uses this option for checks before backend restarts. These options are available from 0.1.0-alpha.5.