If you’re very beginners to web development and looking for an easy way to build fast, lightweight websites, you might have come across Capri.build. But what exactly is the Capri term ?
Capri is a static site generator (SSG) that lets you build websites using popular frontend frameworks like React, Vue, Svelte, Preact, or SolidJS—without sending unnecessary javascript to the browser.
Unlike the traditional SSGs that we have worked with, Capri follows an "Islands Architecture".
That means your site is static by default but allows selective interactivity only where needed.
By using capri, you can build a static website as if it was a single page app. If you already know how to build an SPA in your choice of frameworks you know everything it takes. You can see which frameworks capri is supported by here.
Capri is a modern static site generator that build static sites with interactive islands.
If you’ve used Next.js, Astro, or 11ty, Capri feels similar but forwards less JavaScript by default, that makes your site even faster.
1. Install Capri
Open your terminal and run below command,
1
npm create capri my-project
Replace my-project with your favourite project name. This sets up a new Capri project.
2. Choose Your Framework
Capri supports multiple frameworks. You can select one during setup, like:
1
npm create capri my-project -- -e react
or
1
npm create capri my-project -- -e vue
3. Install Dependencies
1
2
cd my-project
npm install
4. Run the Development Server
1
npm run dev
This starts a local server where you can preview your site.
What is the "Islands" term?
Most static site generators either,
- Keep everything static means no interactivity
or
- Make everything dynamic (slow performance)
Capri solves this problem by letting you selectively add interactivity only where you need it. These interactive sections are called "Islands"
If you want a static site but need some interactivity, just name your component with .island.
For example: components/
Here, only Counter.island.tsx will have javaScript, while the rest of the page remains pure HTML/CSS.
Capri works flowlessly with Vite. Just add this to your vite.config.ts,
1
2
3
4
5
6
7
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import capri from '@capri-js/react';
export default defineConfig({
plugins: [react(), capri()],
});
This ensures Capri integrates smoothly with Vite.
Capri is a turning point for static site generation[SSG]
It’s fast, lightweight, SEO-friendly, and lets you build interactive websites without unnecessary JavaScript.
If you're looking for an alternative to Next.js, Astro, or 11ty, Capri is worthy for all.
It’s simple enough for beginners yet powerful enough for advanced developers.
So, go ahead and give capri a shot today to build your first super fast website now.