Quickstart
Quickstart
Install
npm install barakopress
Needs Next 16.3.8 or later, React 19 or later, and Node 20.9 or later. Next and React are peer dependencies, so your app's copies are the ones that run.
No consumer build configuration. The package ships compiled JavaScript and type declarations, so
there is no transpilePackages line to add and nothing to configure in next.config.ts. If you are
coming from 0.1.0, which shipped TypeScript sources, you can delete the
transpilePackages: ["barakopress"] line when you upgrade. Leaving it in does no harm, it just does
nothing.
Quick start
One config file, then one route file per route you want. A route file is two or three lines: a Next route is decided by its path, and a package cannot create files in your app.
press.config.ts
import { defineConfig } from "barakopress";
export const config = defineConfig({
site: {
name: "My Blog",
tagline: "Things I wrote",
url: "https://myblog.example",
},
});
That is everything a site on the blog blueprint needs. CMS_URL comes from the environment.
app/page.tsx
import { createBlogIndex } from "barakopress";
import { config } from "@/press.config";
export default createBlogIndex(config);
export const revalidate = 300;
app/blog/[slug]/page.tsx
import { createBlogPost, createPostMetadata } from "barakopress";
import { config } from "@/press.config";
export default createBlogPost(config);
export const generateMetadata = createPostMetadata(config);
export const revalidate = 300;
app/layout.tsx
import "barakopress/styles.css";
export const revalidate stays in your file on purpose. Next reads route segment config from the
file that owns the route and does not reliably follow a re-export, and the caching window is your
decision, not the engine's.