Type something to search...

Astrolock write

astrolock write

astrolock write

Starts a development server with live reload for rapid iteration while building your site.

Usage

astrolock write

What It Does

The development server:

  1. Starts local server on http://localhost:4321
  2. Watches for changes to content and configuration
  3. Live reloads browser when files change
  4. Shows detailed errors to help debug issues
  5. Fast rebuilds only changed files
$ astrolock write

Starting Astrolock development server...

βœ“ Configuration loaded
βœ“ Processing content...
βœ“ Server started

  πŸš€ Server running at http://localhost:4321

  Press Ctrl+C to stop

[11:23:15] Content updated: blog/my-post.md
[11:23:15] Page regenerated in 234ms
[11:23:15] Browser reloaded

Live Reload

When you change files, the browser automatically reloads:

What Triggers Reload

  • βœ… Content files (.md, .mdx)
  • βœ… Configuration files (config/*.json)
  • βœ… Style files (CSS)
  • βœ… JavaScript files

What Doesn’t Trigger Reload

  • ❌ Media files in public/ (requires manual refresh)
  • ❌ .env files (requires server restart)

Tip

For media file changes, do a hard refresh: Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (Mac).

Development Workflow

# 1. Start dev server
astrolock write

# 2. Open browser
# Visit http://localhost:4321

# 3. Edit content
# Open content/blog/my-post.md in your editor

# 4. Save file
# Browser automatically reloads with changes

# 5. Check changes
# No need to refresh - it's automatic!

# 6. Stop server when done
# Press Ctrl+C

Development vs Production

Featurewrite (Dev)build (Prod)
Build time3-5s8-15s
OptimizationMinimalFull
Source mapsYesNo
Hot reloadYesNo
Error detailVerboseMinimal

Info

Use write for active development, build for final testing and deployment.

Port Configuration

The server uses port 4321 by default. If busy, it tries 4322, 4323, etc.

$ astrolock write

Port 4321 is in use, trying 4322...

  πŸš€ Server running at http://localhost:4322

Troubleshooting

Error: Cannot find module 'astro'

Fix: Install dependencies:

cd /path/to/astrolock
yarn install

Memory Usage

  • Small sites: ~200MB
  • Medium sites: ~400MB
  • Large sites: ~800MB

Build Speed

  • Initial build: 3-5s
  • Incremental rebuilds: 100-500ms
  • Full page reload: 200-300ms
# With Docker
docker run -p 4321:4321 -v $(pwd):/site astrolock write

Stopping the Server

Press Ctrl+C in the terminal:

Stopping development server...
βœ“ Server stopped gracefully

Best Practices

  1. Keep server running while editing - don’t restart for each change
  2. Use multiple terminals - one for server, one for editing
  3. Hard refresh for media - Ctrl+Shift+R after adding images
  4. Monitor terminal - watch for errors and warnings

See Also

Tip

Keep astrolock write running while editing - it automatically reloads your browser!