README
A lightweight, blazingly fast static site built with Astro that automatically generates beautiful, styled directory listings (similar to Nginx autoindex) for your local files.
Instead of relying on server-side modules to display directory structures, this project scans your asset folders at build time and generates static index.html files for every single directory and subdirectory.
β¨ Features
- Zero JS by Default: Outputs pure, fast static HTML and CSS with minimal JavaScript.
- Recursive Scanning: Automatically discovers all subdirectories and generates indexes for them at build time.
- Smart Sorting: Folders are always listed first, followed by files. Both are sorted alphabetically with full locale/Unicode support for Chinese, French, and other languages.
- Breadcrumb Navigation: Easily trace back to parent directories or the root with intuitive navigation.
- File Type Indicators: Clear Material Design icons to distinguish between directories and files.
- Material Design 3 Theme: Modern dark theme with consistent design language.
- Static & Fast: Pre-rendered pages ensure lightning-fast load times and can be hosted anywhere.
- README Rendering: Automatically detect and render README files in the directory, and can be manually folded.
π οΈ Tech Stack
- Framework: Astro - The web framework for content-driven websites
- Runtime: pnpm / Node.js
- Build Logic: Node.js
fsandpathmodules viagetStaticPaths - Styling: Custom CSS with Material Design 3 design tokens
π Getting Started
Prerequisites
Installation
Clone the repository:
git clone https://github.com/yonzilch/saig.git cd saigInstall dependencies:
pnpm install
π¦ Development & Build
Development Server
Run the development server for live preview with hot reloading:
pnpm dev
Note: The dev server will dynamically generate pages on the fly, which is great for previewing your styling and layout changes.
Adding Your Files
Important: All files you want to index must be placed inside the public/ directory. Astro treats files in public/ as static assets and copies them directly to the build output without processing them.
Simply move your folders (e.g. audio/, image/, video/, css/, js/ and so on) into the public/ folder:
saig/
βββ public/
β βββ audio/
β β βββ song1.mp3
β β βββ song2.mp3
β βββ image/
β β βββ avatar.avif
β β βββ avatar.jpg
β β βββ avatar.webp
β βββ video/
β βββ ...
βββ src/
βββ ...
Production Build
Build the static site for production:
pnpm run build
This command will:
- Scan the
public/directory recursively. - Generate
index.htmlfiles for the root and every subdirectory (e.g.,dist/image/index.html). - Copy all your actual assets into the
dist/folder.
The built site will be available in the dist/ directory.
π Deployment
Once built, the dist/ folder contains your complete static website. You can serve it using any static file server:
- Nginx: Point your
rootdirective to thedist/directory. - Caddy: Run
caddy file-server --root dist - GitHub Pages / Cloudflare Pages / Netlify: Set the build output directory to
dist. - Any Static Host: Upload the contents of
dist/to any static hosting service.
π Project Structure
saig/
βββ public/ # Your static assets (images, videos, etc.)
β βββ audio/
β βββ image/
β βββ video/
βββ src/
β βββ pages/
β β βββ [...path].astro # Dynamic route for directory listings
β β βββ index.astro # Root page
β βββ styles/
β βββ global.css # Global styles with Material Design 3
βββ astro.config.mjs # Astro configuration
βββ package.json
βββ README.md
βββ ...
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Astro - For the amazing web framework
- Material Design - For the design system inspiration
- Nginx autoindex - For the original concept