Application that permits user to store everything that he knows, an LLM reviews the data to suggest improvements
node src/index.jsThen open http://localhost:3000.
PowerShell may block npm run dev because of script execution policy. In that case, use:
npm.cmd run devGitHub Pages should be configured with:
- Source:
Deploy from a branch - Branch:
main - Folder:
/docs
The public frontend URL is:
https://epap28.github.io/second-brain/
docs/config.js points the frontend to the hosted API.
The public frontend is hosted by GitHub Pages. The API runs on a Cloudflare Worker, and the app data is stored in Cloudflare D1.
Install Wrangler:
npm.cmd install --save-dev wranglerLog in to Cloudflare:
npx.cmd wrangler loginCreate the free D1 database:
npx.cmd wrangler d1 create second-brain-dbCopy the returned database_id into wrangler.toml, replacing REPLACE_WITH_CLOUDFLARE_D1_DATABASE_ID.
Create the schema:
npm.cmd run d1:schemaAdd the first-admin setup token as a Cloudflare secret:
npx.cmd wrangler secret put SETUP_TOKENIf SETUP_TOKEN is not configured, the Worker can still use the old SECOND_BRAIN_PASSWORD secret as the setup token.
Invite request emails use client-side email actions. Requests are stored in D1, then the app shows links for Gmail, Outlook, the local mail app, and copying the message.
Deploy the Worker:
npm.cmd run worker:deployCloudflare will print a URL like:
https://second-brain-api.<your-subdomain>.workers.dev
Copy that URL into docs/config.js, then commit and push.
Create the first admin account once the Worker is deployed:
$body = @{
email = "your-email@example.com"
password = "your-admin-password"
setupToken = "your-setup-token"
} | ConvertTo-Json
Invoke-RestMethod `
-Method Post `
-Uri "https://second-brain-api.<your-subdomain>.workers.dev/api/auth/setup" `
-ContentType "application/json" `
-Body $bodyThen sign in from the GitHub Pages app with that email and password.
To create invitation codes:
- Sign in as the admin user.
- Open the
Invite requestspanel on the home screen. - Click
Send codeon a pending request. - The code is copied and the app shows Gmail, Outlook, local mail app, and copy-message actions.
- Open one of the email actions, then click
Sendin your email app.
Users create their account from the First-Time Access section with the invitation code and a new password.
git add .
git commit -m "Add user authentication"
git push origin maindata/second-brain.json is ignored for future commits, but if it was already committed to GitHub, remove it from the repository history or at least untrack it before pushing new private data.