Skip to content

Latest commit

Β 

History

History
115 lines (87 loc) Β· 3.25 KB

File metadata and controls

115 lines (87 loc) Β· 3.25 KB

Astro Starter Kit: Basics

An example repository demonstrating Contentstack Launch integration with Astro.

πŸš€ Features Demonstrated

This repository showcases:

  • Server-Side Rendering (SSR) - Dynamic content generation on each request
  • Incremental Static Regeneration (ISR) - Cached content with revalidation
  • Static Site Generation (SSG) - Pre-built static pages
  • API Routes - Server-side API endpoints
  • Cache Control - Different caching strategies and cache purging

��️ Project Structure

/
β”œβ”€β”€ public/
β”‚   └── favicon.svg
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   β”œβ”€β”€ astro.svg
β”‚   β”‚   └── background.svg
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── Welcome.astro
β”‚   β”œβ”€β”€ layouts/
β”‚   β”‚   └── Layout.astro
β”‚   └── pages/
β”‚       β”œβ”€β”€ index.astro              # Demo dashboard
β”‚       β”œβ”€β”€ ssr-demo.astro          # Server-Side Rendering demo
β”‚       β”œβ”€β”€ isr-demo.astro          # Incremental Static Regeneration demo
β”‚       β”œβ”€β”€ ssg-demo.astro          # Static Site Generation demo
β”‚       β”œβ”€β”€ ssr-api-demo.astro      # API routes demo
β”‚       └── cacheTags-purge-demo.astro # Cache purging demo
β”œβ”€β”€ astro.config.mjs                # Astro configuration with Node adapter
β”œβ”€β”€ package.json
└── tsconfig.json

πŸ› οΈ Tech Stack

  • Astro ^5.13.5 - The web framework
  • React ^19.1.1 - UI component library
  • @astrojs/node ^9.4.3 - Node.js adapter for server deployment
  • @astrojs/react ^4.3.0 - React integration
  • TypeScript - Type safety and development experience

πŸš€ Getting Started

Prerequisites

  • Node.js >= 18.0.0
  • npm or yarn

Installation

  1. Clone the repository:
git clone <repository-url>
cd astro-ssr-test
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev
  1. Open your browser and navigate to http://localhost:4321

πŸ“‹ Available Scripts

Command Action
npm install Installs dependencies
npm run dev Starts local dev server at localhost:4321
npm run build Build your production site to ./dist/
npm run preview Preview your build locally, before deploying
npm start Start the production server
npm run astro ... Run CLI commands like astro add, astro check
npm run astro -- --help Get help using the Astro CLI

βš™οΈ Configuration

The project is configured for server-side rendering with the Node.js adapter:

// astro.config.mjs
export default defineConfig({
  output: "server",
  adapter: node({
    mode: "standalone",
  }),
  integrations: [react()],
});

Build for Production

npm run build
npm start

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.