SSG Integration
SSG Integration
Use RaisFast as the backend for your Hugo, Astro, Hexo, or any static site generator. Comments, search, auth, ecommerce, and payment — all in one binary.
Static Sites Need a Backend
Static site generators (SSGs) like Hugo, Astro, Jekyll, Hexo, and 11ty are incredibly fast and simple. But they have a fundamental limitation: they only generate static HTML. The moment you need dynamic features, you're stuck.
The Current Approach: Stitch Together 5+ Services
Most SSG users end up assembling a fragmented stack:
Hugo / Astro (static pages)
+ Disqus or Giscus → comments
+ Algolia or DocSearch → search
+ Netlify Forms → form submissions
+ Cloudinary → media management
+ Auth0 or Firebase Auth → user login
+ Stripe → payment
= 5-8 accounts, bills, API keys, and maintenanceThe RaisFast Approach: One Binary
Hugo / Astro (static pages)
+ RaisFast → comments + search + forms + media + auth + payment
= One binary, one data source, one deploymentWhat RaisFast Provides for SSGs
| Feature | How SSG Users Typically Solve It | RaisFast |
|---|---|---|
| Comments | Disqus (ads in free tier) or Giscus (GitHub-dependent) | Built-in comment system, zero ads |
| Search | Algolia (limited free tier) or client-side only | Tantivy full-text search, no limits |
| Forms | Netlify Forms or Formspree (limited submissions) | Unlimited form submissions |
| Auth | Auth0 or Firebase (complex setup) | JWT + OAuth, simple API |
| Media | Cloudinary (paid) or Git-based | Local storage or S3 |
| Ecommerce | No good option for static sites | Cart, orders, products built-in |
| Payment | Stripe integration from scratch | Alipay, WeChat Pay, Stripe built-in |
| Admin UI | Edit Markdown files manually | React admin dashboard |
| API | None | Auto-generated REST API |
| Multi-tenant | Not possible | Domain-based tenant isolation |
Architecture
┌─────────────────────────────────────────┐
│ User Browser │
│ │
│ Static HTML (from Hugo/Astro) │
│ + │
│ Dynamic Data (from RaisFast API) │
│ - Comments widget │
│ - Search bar │
│ - Login / signup │
│ - Shopping cart │
└─────────────┬───────────────────────────┘
│
┌────────┴────────┐
│ │
▼ ▼
CDN/Nginx RaisFast
(static files) (API server)
port 9898
┌─────────────┐
│ SQLite / PG │
│ Auth │
│ Comments │
│ Search │
│ Ecommerce │
│ Payment │
└─────────────┘Quick Start
1. Start RaisFast
curl -fsSL https://raisfast.com/install.sh | sh
raisfast2. Your SSG builds static pages as usual
# Hugo
hugo build
# Astro
astro build3. Connect via API
// Fetch posts from RaisFast during build
const res = await fetch("http://localhost:9898/api/v1/posts");
const posts = await res.json();
// Or use the JS SDK in the browser for dynamic features
import { RaisFast } from "@raisfast/sdk";
const rf = new RaisFast({ baseUrl: "http://localhost:9898/api" });Choose Your SSG
| SSG | Guide | Best For |
|---|---|---|
| Hugo | Hugo + RaisFast → | Tech blogs, docs sites, personal sites |
| Astro | Astro + RaisFast → | Modern content sites, developer blogs |
| Hexo | Hexo + RaisFast → | Chinese tech blogs |
| Any SSG | Comments & Search → | Universal comment and search integration |
Deployment
Both your SSG output and RaisFast can run on the same server:
# Nginx config
server {
listen 80;
# Static files from Hugo/Astro
location / {
root /var/www/static;
try_files $uri $uri/ /index.html;
}
# RaisFast API
location /api/ {
proxy_pass http://127.0.0.1:9898;
}
# RaisFast Admin
location /admin {
proxy_pass http://127.0.0.1:9898;
}
}One server, one RaisFast binary, one Nginx config. That's your complete website stack.
