Local Development
How to set up, run, build, and test the Communitas website locally.
Prerequisites
Section titled “Prerequisites”- Node.js 22.21.0+ — the project pins this version in
.nvmrc - npm — bundled with Node.js, used as the package manager
- Git — for cloning and version control
No other tools, databases, or environment variables are required.
-
Clone the repository
Terminal window git clone git@github.com:communitas-xyz/website.git communitas.xyzcd communitas.xyz -
Install the correct Node version
If you use nvm:
Terminal window nvm installnvm useThis reads
.nvmrcand activates Node 22.21.0. -
Install dependencies
Terminal window npm ciUse
npm ci(notnpm install) for a clean, reproducible install from the lockfile.
Running the dev server
Section titled “Running the dev server”npm run devThe Astro dev server starts at http://localhost:4321/ with hot module replacement. Changes to .astro, .mdx, .ts, and .css files reload automatically.
To expose the server on your local network:
npm run dev -- --host 0.0.0.0The Vite config includes server.tail14a7e5.ts.net in allowedHosts for Tailscale-based remote development. If you access the dev server over a different hostname, add it to vite.server.allowedHosts in astro.config.mts.
Available scripts
Section titled “Available scripts”| Command | What it does |
|---|---|
npm run dev | Start the Astro dev server |
npm run build | Production build to dist/ |
npm run preview | Preview the built site locally |
npm run lint | Run ESLint |
npm run format | Run Prettier (writes changes) |
npm run typecheck | Run TypeScript type-checking (tsc --noEmit) |
npm test | Run Vitest (no tests exist yet) |
Building for production
Section titled “Building for production”npm run buildAstro outputs static HTML, CSS, and JS to dist/. The build includes:
- The standalone landing page (
src/pages/index.astro) - All Starlight documentation pages (from
src/content/docs/) - Pagefind search index
- Sitemap
To preview the built site:
npm run previewRunning checks
Section titled “Running checks”Run all checks before committing:
npm run lint && npm run typecheck && npm run formatThe CI pipeline currently runs only npm run build. Lint, typecheck, and test steps are not yet enforced in CI.
Adding content
Section titled “Adding content”Documentation pages live in src/content/docs/ as .mdx files. The sidebar auto-generates from the directory structure. To add a new page:
- Create a
.mdxfile in the appropriate subdirectory (e.g.,src/content/docs/models/new-model.mdx) - Add frontmatter with at least
titleanddescription - The page appears in the sidebar automatically
See the site architecture doc for how the landing page and docs relate.
Troubleshooting
Section titled “Troubleshooting”Vite rejects the Host header
Section titled “Vite rejects the Host header”If you access the dev server via a hostname not in allowedHosts, Vite returns a 403. Add your hostname to vite.server.allowedHosts in astro.config.mts.
Three.js bundle size warning
Section titled “Three.js bundle size warning”The build emits a warning about a chunk exceeding 500 kB. This is the Three.js bundle used by the landing page visualization. It only loads on the landing page and does not affect documentation page performance.
Type errors in node_modules
Section titled “Type errors in node_modules”LSP may report errors in starlight-theme-black override files (e.g., “Cannot find module ‘virtual:starlight-theme-black-config’”). These are false positives — the virtual modules are resolved at build time by the Starlight plugin, not by the TypeScript language server.