Skip to main content
The RobTop Games Web project uses Astro as its core framework with TypeScript for type safety. This guide covers all configuration options and project setup.

Astro Configuration

The project’s main configuration is defined in astro.config.mjs:
astro.config.mjs
// @ts-check
import { defineConfig } from "astro/config";

export default defineConfig({
  devToolbar: {
    enabled: false,
  },
  // Habilitar colecciones de contenido
});

Dev Toolbar

The Astro dev toolbar is disabled by default for a cleaner development experience.
devToolbar: {
  enabled: false,
}
To enable it during development, set enabled: true.

Content Collections

The project supports Astro content collections for managing blog posts and structured content. This is enabled by default.

TypeScript Configuration

The project uses Astro’s strict TypeScript configuration:
tsconfig.json
{
  "extends": "astro/tsconfigs/strict",
  "include": [".astro/types.d.ts", "**/*"],
  "exclude": ["dist"]
}

Strict Mode

The project extends Astro’s strict TypeScript configuration, which enables:
  • Strict null checks
  • Strict function types
  • No implicit any
  • All other strict type-checking options

Include Patterns

  • .astro/types.d.ts - Auto-generated Astro types
  • **/* - All source files in the project

Excluded Directories

  • dist/ - Build output directory

Project Structure

gd-web/
├── src/
│   ├── components/      # Reusable Astro components
│   ├── content/        # Content collections (blog posts)
│   ├── layouts/        # Page layouts
│   └── pages/          # Route pages
├── public/
│   └── assets/         # Static assets (CSS, JS, images)
│       ├── bootstrap/  # Bootstrap framework files
│       ├── css/        # Custom stylesheets
│       ├── fonts/      # Custom fonts (Pusab)
│       ├── img/        # Images
│       └── js/         # JavaScript files
├── astro.config.mjs    # Astro configuration
├── tsconfig.json       # TypeScript configuration
└── package.json        # Dependencies and scripts

Package Configuration

The project is configured as an ES module with the following key settings:
package.json
{
  "name": "gd-web",
  "type": "module",
  "version": "0.0.1"
}

Dependencies

  • astro ^5.12.9 - The core Astro framework

Dev Dependencies

  • prettier ^3.6.2 - Code formatting
  • prettier-plugin-astro ^0.14.1 - Astro-specific formatting

Development Scripts

Development Server

npm run dev
Starts the Astro development server with hot module reloading. Typically runs on http://localhost:4321.

Build Production

npm run build
Builds the site for production. Output is generated in the dist/ directory.

Preview Build

npm run preview
Preview the production build locally before deploying.

Format Code

npm run format
Formats all files using Prettier with Astro plugin support.

Astro CLI

npm run astro
Access the Astro CLI directly for advanced commands.

Environment Setup

Prerequisites

  • Node.js 18+ or 20+
  • npm or pnpm package manager

Installation

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Start the development server:
    npm run dev
    
The project uses ES modules ("type": "module"). Ensure all JavaScript files use ES module syntax (import/export) instead of CommonJS (require/module.exports).

Build Output

When you run npm run build, Astro generates:
  • Static HTML files for all pages
  • Optimized CSS and JavaScript bundles
  • Compressed assets
  • Output directory: dist/
The build process:
  1. Compiles TypeScript to JavaScript
  2. Processes Astro components to HTML
  3. Bundles and minifies assets
  4. Optimizes images
  5. Generates static routes

Advanced Configuration

Adding Site URL

For production deployment, add your site URL:
astro.config.mjs
export default defineConfig({
  site: 'https://www.robtopgames.com',
  devToolbar: {
    enabled: false,
  },
});

Custom Output Directory

astro.config.mjs
export default defineConfig({
  outDir: './build',
  devToolbar: {
    enabled: false,
  },
});

Base Path

For deployment to a subdirectory:
astro.config.mjs
export default defineConfig({
  base: '/subdirectory',
  devToolbar: {
    enabled: false,
  },
});

Build docs developers (and LLMs) love