Tech Stack · JavaScript

Astro

Content-first web framework that ships static HTML with zero JavaScript by default.

What it is

Astro renders pages to plain HTML at build time. Interactive JavaScript is opt-in per component, which makes it a good fit for blogs and docs. aigrama.net itself is built with Astro: posts are Markdown/MDX in a content collection, validated by a Zod schema, and deployed as static files.

CLI commands

Command What it does
npm create astro@latest Scaffold a new project
npm run dev Dev server with hot reload on http://localhost:4321
npx astro check Type-check .astro and .ts files
npm run build Production build into dist/
npm run preview / npx astro preview Start the local preview server for dist/
npx astro preview stop Stop a running Astro preview server
npx astro preview status Check if an Astro preview server is running
npx astro add mdx Add an official integration

When to use npm vs npx: Use npm run <script> for shortcuts defined in your project’s package.json (dev, build, preview, check). Use npx <command> to run a CLI binary directly — either a locally installed one with extra subcommands/flags (like npx astro preview stop or npx astro add mdx) or a one-off tool without installing it globally.

Content collections in one snippet

// src/content.config.ts
import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';

const blog = defineCollection({
  loader: glob({ pattern: '**/index.{md,mdx}', base: './src/content/blog' }),
  schema: z.object({ title: z.string(), pubDate: z.coerce.date() }),
});

export const collections = { blog };

Query with getCollection('blog') and render with render(entry) from astro:content.

Posts using Astro

Architecture • 11 min read Reader level: Intermediate

What you'll learn

  • How an Astro static blog is structured, from content to build
  • How content collections, layouts, and styling fit together
  • How the site connects to Google Analytics, comments, and the domain
  • How the static build is deployed
Architecture of the Aigrama Technical Web Blog

A detailed tutorial explaining how the Astro-based Aigrama blog works, including content flow, layouts, deployment, analytics, comments, and domain integrations.

#astro#mdx#architecture#google-analytics