Skip to content

Run Project

After installing ForgeDocs, you can run it locally to see your site in action. This guide covers the three commands you’ll use most often: dev, build, and preview.

From your project folder, run:

Terminal window
npm run dev

You’ll see output like this:

🚀 astro v5.0.0 started in 342ms
┃ Local http://localhost:4321/
┃ Network http://192.168.1.10:4321/

Open your browser and go to:

http://localhost:4321

You should see the ForgeDocs homepage.

The development server:

  • Watches your files — when you save a change, the browser reloads automatically
  • Shows errors — if something breaks, you’ll see it in the terminal and browser
  • Serves your site at localhost:4321 — no build step needed

Keep this server running while you work. Changes appear instantly.

To stop the server, press:

Ctrl + C

You’ll return to your regular terminal prompt.

When you’re ready to deploy, build the production version:

Terminal window
npm run build

This creates a dist/ folder with your optimized site. The build process:

  • Compiles all pages to static HTML
  • Optimizes images
  • Minifies CSS and JavaScript
  • Generates a sitemap
  • Runs Pagefind to build the search index

You’ll see output like:

✓ Completed in 3.21s

The dist/ folder is what you upload to your hosting provider.

Before deploying, you can preview what the production build looks like:

Terminal window
npm run preview

This starts a local server that serves the contents of dist/. Open:

http://localhost:4321

The preview server is faster than the dev server because it’s serving static files — the same way your live site will be served.

Important: The preview server does not watch for file changes. If you edit files, you need to rebuild (npm run build) and restart the preview (npm run preview).

Here’s a quick reference:

Command What it does
npm run dev Start development server at localhost:4321
npm run build Build production site into dist/
npm run preview Preview the production build locally

During development — use npm run dev. Changes appear instantly.

Before deploying — use npm run build. Verify the build completes without errors.

After building — use npm run preview. Check that the production version looks correct.

On your live site — you don’t run any commands. Your hosting provider runs npm run build automatically every time you push changes to GitHub.

Another process is using port 4321. Either stop the other process, or start ForgeDocs on a different port:

Terminal window
npm run dev -- --port 3000

Then open http://localhost:3000.

Try a hard refresh:

  • Windows: Ctrl + Shift + R
  • macOS: Cmd + Shift + R

If that doesn’t work, stop the dev server (Ctrl + C) and restart it.

Check the terminal output for the error message. Common causes:

  • Missing dependency — run npm install again
  • Syntax error in a Markdown or JSON file — check the file mentioned in the error
  • Node.js version too old — verify with node --version

Now that you can run ForgeDocs, let’s set up the project:

→ First Setup

If you want to set up Decap CMS:

→ Decap CMS Local

If you’re stuck: