DocsPluginsShowcaseReleases
npmStar us on GitHub
overviewcreate-bini-appbini-deploybini-routerbini-envbini-nativebini-serverbini-overlaybini-ssgvite plugins↗hono plugins↗

A native React framework for building cross-platform applications from a single codebase.

Resources

  • Documentation
  • Plugins
  • Showcase
  • Releases

Community

  • GitHub Discussions
  • Reddit
  • Discord
  • LinkedIn

More

  • npm
  • GitHub
  • Issues
  • License

© 2026 Bini Cooperation.

bini-ssg

Official

Static site generation for Bini.js. Pre-renders your routes to HTML as part of a single vite build.

Overview

bini-ssg pre-renders your entire application to static HTML during vite build. It expands dynamic paths, crawls internal links, and writes fallback pages for client-only routes.

The output is a fully static site (or a hybrid static/SPA app) that loads instantly and is perfectly optimized for SEO.

Requirements

  • Vite >= 8.0.0
  • bini-router >= 2.0.0 (must already be installed and configured)
  • React 18+, react-dom, and react-router-dom
  • Your index.html must contain an element with id="root"

Install

>_Terminal
$ npm install --save-dev bini-ssg

Quick Start

Register the plugin in your Bini.js config, directly after biniroute():

vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { biniroute } from 'bini-router'
import { biniSSG } from 'bini-ssg'

export default defineConfig({
  plugins: [
    react(),
    biniroute(),
    biniSSG(),
  ],
})

Run your build command (e.g. npm run build). bini-ssg will automatically build the client, build the SSR environment, and pre-render your routes:

>_Terminal
vite v8.3.7 building client environment for production...
✓ 37 modules transformed.
computing gzip size...
dist/.bini/css-map.json         0.17 kB │ gzip:   0.11 kB
dist/index.html                 0.28 kB │ gzip:   0.22 kB
dist/css/layout-CS15oam5.css   11.86 kB │ gzip:   3.27 kB
dist/js/layout-BU0XgUOt.js      0.17 kB │ gzip:   0.16 kB
dist/js/page-CtS8uloZ.js        2.18 kB │ gzip:   0.82 kB
dist/js/index-C6YM5h5n.js     329.03 kB │ gzip: 103.35 kB

✓ built in 299ms
vite v8.3.7 building ssr environment for production...
✓ 12 modules transformed.
computing gzip size...
dist/.bini/server/chunks/layout-DZNjTB3r.js   0.24 kB │ gzip: 0.19 kB
dist/.bini/server/chunks/page-DFH1VqOL.js     2.83 kB │ gzip: 0.91 kB
dist/.bini/server/main.js                    18.97 kB │ gzip: 4.79 kB

✓ built in 96ms
vite v8.3.7 pre-rendering routes for production...
computing gzip size...
dist/index.html  3.21 kB │ gzip: 1.23 kB
dist/404.html    1.75 kB │ gzip: 0.83 kB

✓ built in 164ms

Static Params

Dynamic routes are only pre-rendered if they are reachable by crawling links or if you explicitly list their URLs using staticParams.

Export an async function from your dynamic page that returns an array of parameters:

src/app/blog/[slug]/page.tsx
export async function staticParams() {
  return [
    { slug: 'hello-world' },
    { slug: 'second-post' }
  ]
}

export default function BlogPost() {
  // ...
}

Each object is mapped to the route pattern (e.g., /blog/:slug), and those URLs will be fully pre-rendered.

Opting Out of Prerender

If you have a route that cannot be server-rendered (e.g., it relies heavily on browser APIs at the module scope), you can opt it out.

Export prerender = false from the page. bini-ssg will skip calling the server renderer for this route and will write an empty "shell" page instead. The client app will take over when the page loads.

src/app/admin/page.tsx
export const prerender = false

export default function AdminDashboard() {
  // ...
}
Automatic Fallbacks: If a standard static route throws an error during its render (for example, due to a failed data fetch), bini-ssg automatically catches it and writes a shell page for that route instead of failing the build. The build will only crash if the SSR bundle itself fails to import.
Routes with data exports (like loader or action) are automatically marked as client-only by bini-router and will also receive a shell page.

Link Crawling

bini-ssg scans the HTML of every rendered page for internal <a href> links. If it finds a new link, it queues it and renders it too. This means a /blog page that lists links to all your posts will automatically pre-render every post without needing staticParams.

Dynamic patterns that are never reached by a crawled link get a fallback "shell" page. This is an empty index.html that loads your client-side router, allowing dynamic URLs to still work on static hosts.

Output

dist
index.html
about
index.html
blog
index.html
hello-world
index.html
admin
index.html
404.html
assets
  • index.html - Pre-rendered /.
  • about/index.html - Pre-rendered static route.
  • blog/hello-world/index.html - Pre-rendered dynamic route (via crawl or staticParams).
  • admin/index.html - A "shell" page for a route with prerender = false.
  • 404.html - The not-found page, ready for static hosts.
Was this helpful?
Previousbini-overlay
Nextbini-deploy

On this page

  • Overview
  • Requirements
  • Install
  • Quick Start
  • Static Params
  • Opting Out of Prerender
  • Link Crawling
  • Output
Edit this page on GitHub

bini-ssg

Official

Static site generation for Bini.js. Pre-renders your routes to HTML as part of a single vite build.

Overview

bini-ssg pre-renders your entire application to static HTML during vite build. It expands dynamic paths, crawls internal links, and writes fallback pages for client-only routes.

The output is a fully static site (or a hybrid static/SPA app) that loads instantly and is perfectly optimized for SEO.

Requirements

  • Vite >= 8.0.0
  • bini-router >= 2.0.0 (must already be installed and configured)
  • React 18+, react-dom, and react-router-dom
  • Your index.html must contain an element with id="root"

Install

>_Terminal
$ npm install --save-dev bini-ssg

Quick Start

Register the plugin in your Bini.js config, directly after biniroute():

vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { biniroute } from 'bini-router'
import { biniSSG } from 'bini-ssg'

export default defineConfig({
  plugins: [
    react(),
    biniroute(),
    biniSSG(),
  ],
})

Run your build command (e.g. npm run build). bini-ssg will automatically build the client, build the SSR environment, and pre-render your routes:

>_Terminal
vite v8.3.7 building client environment for production...
✓ 37 modules transformed.
computing gzip size...
dist/.bini/css-map.json         0.17 kB │ gzip:   0.11 kB
dist/index.html                 0.28 kB │ gzip:   0.22 kB
dist/css/layout-CS15oam5.css   11.86 kB │ gzip:   3.27 kB
dist/js/layout-BU0XgUOt.js      0.17 kB │ gzip:   0.16 kB
dist/js/page-CtS8uloZ.js        2.18 kB │ gzip:   0.82 kB
dist/js/index-C6YM5h5n.js     329.03 kB │ gzip: 103.35 kB

✓ built in 299ms
vite v8.3.7 building ssr environment for production...
✓ 12 modules transformed.
computing gzip size...
dist/.bini/server/chunks/layout-DZNjTB3r.js   0.24 kB │ gzip: 0.19 kB
dist/.bini/server/chunks/page-DFH1VqOL.js     2.83 kB │ gzip: 0.91 kB
dist/.bini/server/main.js                    18.97 kB │ gzip: 4.79 kB

✓ built in 96ms
vite v8.3.7 pre-rendering routes for production...
computing gzip size...
dist/index.html  3.21 kB │ gzip: 1.23 kB
dist/404.html    1.75 kB │ gzip: 0.83 kB

✓ built in 164ms

Static Params

Dynamic routes are only pre-rendered if they are reachable by crawling links or if you explicitly list their URLs using staticParams.

Export an async function from your dynamic page that returns an array of parameters:

src/app/blog/[slug]/page.tsx
export async function staticParams() {
  return [
    { slug: 'hello-world' },
    { slug: 'second-post' }
  ]
}

export default function BlogPost() {
  // ...
}

Each object is mapped to the route pattern (e.g., /blog/:slug), and those URLs will be fully pre-rendered.

Opting Out of Prerender

If you have a route that cannot be server-rendered (e.g., it relies heavily on browser APIs at the module scope), you can opt it out.

Export prerender = false from the page. bini-ssg will skip calling the server renderer for this route and will write an empty "shell" page instead. The client app will take over when the page loads.

src/app/admin/page.tsx
export const prerender = false

export default function AdminDashboard() {
  // ...
}
Automatic Fallbacks: If a standard static route throws an error during its render (for example, due to a failed data fetch), bini-ssg automatically catches it and writes a shell page for that route instead of failing the build. The build will only crash if the SSR bundle itself fails to import.
Routes with data exports (like loader or action) are automatically marked as client-only by bini-router and will also receive a shell page.

Link Crawling

bini-ssg scans the HTML of every rendered page for internal <a href> links. If it finds a new link, it queues it and renders it too. This means a /blog page that lists links to all your posts will automatically pre-render every post without needing staticParams.

Dynamic patterns that are never reached by a crawled link get a fallback "shell" page. This is an empty index.html that loads your client-side router, allowing dynamic URLs to still work on static hosts.

Output

dist
index.html
about
index.html
blog
index.html
hello-world
index.html
admin
index.html
404.html
assets
  • index.html - Pre-rendered /.
  • about/index.html - Pre-rendered static route.
  • blog/hello-world/index.html - Pre-rendered dynamic route (via crawl or staticParams).
  • admin/index.html - A "shell" page for a route with prerender = false.
  • 404.html - The not-found page, ready for static hosts.
Was this helpful?
Previousbini-overlay
Nextbini-deploy

On this page

  • Overview
  • Requirements
  • Install
  • Quick Start
  • Static Params
  • Opting Out of Prerender
  • Link Crawling
  • Output
Edit this page on GitHub