Skip to content

Getting started

You need an Nx workspace. If you already have one, skip the first step. Compatibility lists the supported versions.

Terminal window
pnpm dlx create-nx-workspace@latest acme --preset=ts --pm=pnpm
cd acme
Terminal window
pnpm add -Dw @geekvetica/nx-astro
pnpm exec nx g @geekvetica/nx-astro:init

-w adds the package to the workspace root. If pnpm stops with ERR_PNPM_IGNORED_BUILDS, choose which install scripts may run with pnpm approve-builds, then run the command again.

init registers the plugin in nx.json and installs Astro if the workspace has none. The init reference lists what it changes.

Terminal window
nx g @geekvetica/nx-astro:application my-app

This creates apps/my-app with one page and five targets. Every file and option is in the application reference.

Start the development server. It listens on port 4321, unless the Astro config sets another one:

Terminal window
nx dev my-app

Build the site into dist/apps/my-app:

Terminal window
nx build my-app

Serve the built site:

Terminal window
nx preview my-app

Run the build again without a change and Nx restores the result from its cache.

Type checking needs @astrojs/check:

Terminal window
pnpm add -Dw @astrojs/check
Terminal window
nx check my-app
nx-astro 3.2.0 · MIT Developed by