Infrastructure
Cloudflare Pages Build Step โ Setup Guide
What this does
Adds a build step to Cloudflare Pages so that every time you push to GitHub,
the site auto-generates `manifest.json` (the file list that powers the sidebar nav)
before deploying. New notes you create will appear in the nav automatically.
One-time setup (takes ~3 minutes)
Step 1 โ Open your Cloudflare Pages project
1. Go to dash.cloudflare.com
2. Click Workers & Pages in the left sidebar
3. Find and click your second-brain project
Step 2 โ Go to Build Settings
1. Click the Settings tab at the top
2. Click Build & Deployments in the left sub-nav
Step 3 โ Edit the build configuration
1. Under Build configurations, click Edit
2. Set Build command to:
```
node generate-manifest.js
```
3. Set Build output directory to:
```
/
```
(that's just a forward slash โ serves the whole repo root)4. Leave Root directory blank unless Cloudflare pre-filled something wrong
5. Click Save
Step 4 โ Trigger a deploy
The new build config won't apply until the next push. Either:
- Make any small change and run `sync.bat`, or
- In Cloudflare Pages, go to Deployments tab and click Retry deployment on the latest one
Step 5 โ Verify it worked
After deploy completes (~60 seconds):
1. Open brain.kaleb.one in a new tab
2. The sidebar should load automatically โ no "manifest missing" error
3. All your files should appear in their sections
How to verify the build ran
In Cloudflare Pages โ Deployments tab โ click any deployment โ View build log
You should see lines like:
```
[manifest] Scanning from: /opt/buildhome/repo
[manifest] Found 42 markdown files
[manifest] Written manifest.json with 42 entries
```
If you see an error like `node: not found`, Cloudflare Pages may need a Node.js version
specified. Add a file named `.nvmrc` to the repo root containing just `20` (or any recent version).
Testing locally (optional)
If you want to test the manifest script before pushing:
1. Open PowerShell or Command Prompt
2. `cd D:\Kaleb\second-brain`
3. `node generate-manifest.js`
4. Check that `manifest.json` was created/updated
You can also open `index.html` in a browser locally โ but note it needs to be served over
HTTP (not `file://`) to fetch `manifest.json`. Use VS Code's Live Server extension
or `npx serve .` from the repo root.
What changes after setup
| Before | After |
|---|---|
| Hardcoded file list in `index.html` | Dynamic โ reads `manifest.json` |
| New files don't appear in nav | New files appear automatically after push |
| Nav dates are fake / hardcoded | Dates come from real git history |
| Must edit JS to add files | Just create the file and sync |
Last updated: 2026-03-31