Skip to main content
This page documents the complete Astro configuration used in the portfolio site. The configuration is defined in astro.config.mjs at the project root.

Overview

The Astro configuration sets up server-side rendering with Cloudflare, internationalization, experimental font optimization, environment variables, and integrations for code highlighting and sitemap generation.
// astro.config.mjs location
~/workspace/source/astro.config.mjs

Core Configuration

output
string
default:"server"
Specifies the output mode for the site. Set to "server" to enable server-side rendering (SSR).Value: "server"
adapter
function
default:"cloudflare()"
The deployment adapter for SSR. Uses @astrojs/cloudflare adapter for deploying to Cloudflare Pages/Workers.Value: cloudflare()Import: import cloudflare from '@astrojs/cloudflare'
site
string
required
The public URL of your deployed site. Used for generating canonical URLs and sitemaps.Value: "https://lewiskori.com"

Experimental Features

experimental.fonts
array
Experimental font optimization feature that automatically loads and optimizes web fonts.

Environment Variables

env.schema
object
Defines type-safe environment variables with validation and context specifications.

Internationalization (i18n)

i18n
object
Configuration for multi-language support across the site.

Vite Configuration

vite.plugins
array
Vite plugins for build tooling and development server.Plugins:
  • tailwindcss() - TailwindCSS Vite plugin for styling
Import: import tailwindcss from '@tailwindcss/vite'

Integrations

Expressive Code

integrations[0]
expressiveCode
Syntax highlighting integration for code blocks with advanced features.Import: import expressiveCode from 'astro-expressive-code'

Sitemap

integrations[1]
sitemap
Automatic XML sitemap generation for SEO with custom priority rules.Import: import sitemap from '@astrojs/sitemap'

Complete Configuration

import { defineConfig, envField, fontProviders } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
import expressiveCode from 'astro-expressive-code';
import sitemap from '@astrojs/sitemap';
import cloudflare from '@astrojs/cloudflare';

const SITE_URL = 'https://lewiskori.com';

export default defineConfig({
  output: 'server',
  adapter: cloudflare(),
  site: SITE_URL,
  experimental: {
    fonts: [
      {
        provider: fontProviders.google(),
        name: 'Inter',
        cssVariable: '--font-inter',
        fallbacks: ['sans-serif'],
        display: 'swap',
      },
    ],
  },
  env: {
    schema: {
      BEEHIIV_PUBLICATION_ID: envField.string({
        context: 'server',
        access: 'secret',
        default: 'abc',
      }),
      BEEHIIV_API_KEY: envField.string({
        context: 'server',
        access: 'secret',
        default: '',
      }),
      GTM_ID: envField.string({
        context: 'client',
        access: 'public',
        default: '',
      }),
    },
  },
  i18n: {
    defaultLocale: 'en',
    locales: ['en', 'es', 'fr', 'de'],
    routing: {
      prefixDefaultLocale: false,
    },
  },
  vite: {
    plugins: [tailwindcss()],
  },
  integrations: [
    expressiveCode({
      themes: ['aurora-x'],
    }),
    sitemap({
      changefreq: 'weekly',
      priority: 0.7,
      lastmod: new Date(),
      serialize(item) {
        // Custom priority logic...
      },
    }),
  ],
});

Build docs developers (and LLMs) love