Skip to main content

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js version 18.0.0 or higher
  • npm (comes with Node.js)
  • Git for version control

Installation

1. Clone the Repository

git clone https://github.com/abisai7/chapinismos.git
cd chapinismos

2. Install Dependencies

Install all project dependencies using npm:
npm install
This will install the following key dependencies:
  • Astro (v5.18.0) - Static site framework
  • Tailwind CSS (v4.2.1) - Styling
  • @astrojs/vercel (v9.0.4) - Vercel adapter
  • @astrojs/sitemap (v3.7.0) - Sitemap generation
  • Lucide icons for UI elements
  • Custom fonts (Baloo 2, Alice)

Running the Development Server

Start Development Mode

To start the local development server with hot reload:
npm run dev
Or alternatively:
npm start
Both commands run astro dev and start the development server at:
http://localhost:4321

Hot Module Replacement (HMR)

The development server includes hot reload functionality:
  • Astro components (.astro files) reload automatically on save
  • Styles update instantly without page refresh
  • Scripts are reloaded on change
  • Content changes reflect immediately

Development Features

Internationalization (i18n)

The project supports two locales:
  • Spanish (es) - Default locale (Guatemala)
  • English (en)
Access the development site with locale prefixes:
  • Spanish: http://localhost:4321/es/
  • English: http://localhost:4321/en/

Prefetching

The development environment includes hover-based prefetching:
  • Links are prefetched on hover for faster navigation
  • Prefetch strategy: hover
  • Not enabled for all links (selective prefetching)

Vite Configuration

The project uses Vite for building with:
  • CSS code splitting for optimized loading
  • esbuild minification for fast builds
  • Vendor chunk splitting for better caching
  • Tailwind CSS via Vite plugin

Preview Production Build

To preview the production build locally:
npm run build
npm run preview
This builds the static site and serves it locally to test production behavior.

Troubleshooting

Port Already in Use

If port 4321 is already in use, you can specify a different port:
npm run dev -- --port 3000

Node Version Issues

Ensure you’re using Node.js 18.0.0 or higher:
node --version
If you need to upgrade, consider using nvm (Node Version Manager):
nvm install 18
nvm use 18

Module Not Found Errors

If you encounter module errors after pulling updates:
rm -rf node_modules package-lock.json
npm install

Cache Issues

Clear Astro’s cache if you experience unexpected behavior:
rm -rf .astro
npm run dev

Build Errors

If the development server fails to start:
  1. Check Node.js version meets the requirement (>=18.0.0)
  2. Verify all dependencies are installed correctly
  3. Clear cache directories (.astro, node_modules/.vite)
  4. Check for TypeScript errors in your code
  5. Review the terminal output for specific error messages

Available Scripts

All npm scripts available for development:
CommandDescription
npm run devStart development server
npm startAlias for npm run dev
npm run buildBuild production site
npm run previewPreview production build
npm run formatFormat code with Prettier
npm run format:checkCheck code formatting
npm run lintLint code with ESLint
npm run lint:fixFix linting issues automatically

Next Steps

Build docs developers (and LLMs) love