Skip to content
LucaTommyPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Notebook

A minimal, open-source knowledge base: one search bar, Markdown documents, shared workspaces. React + TypeScript + Vite on the front, Supabase (Postgres + Auth) behind it, deployable on Netlify.

Run it in 5 minutes

  1. Supabase – create a project, open SQL Editor, paste and run supabase/migrations/0001_init.sql, then 0002_no_default_workspaces.sql and 0003_guest_access.sql.
  2. cp .env.example .env.local and fill in the URL + anon key (Project Settings → API).
  3. In Supabase turn on Authentication → Sign In / Providers → Allow anonymous sign-ins (there is no login screen: every browser silently gets a private guest account). Then npm install && npm run dev.
  4. Netlify – push to Git, "Import project". netlify.toml already sets the build, the SPA redirect and security headers. Add the two env vars in site settings.

New users start with an empty slate: the home page walks them through creating a workspace (private or shared), writing a first document and searching for it. Run supabase/migrations/0002_no_default_workspaces.sql too. Teammates join a shared workspace through its invite link (/join/<code>, shown on the workspace page). Because guests live in one browser, use Settings → Export to back up or move your notebook.

Structure

supabase/migrations/0001_init.sql   schema, RLS policies, search/dashboard RPCs
supabase/migrations/0002_*.sql      removes automatic workspaces
src/lib/        supabase client, types, utils
src/auth/       AuthProvider (session), RequireAuth (route guard)
src/theme/      light/dark provider (CSS variables)
src/api/        data access: documents, workspaces, dashboard
src/components/ Layout (sidebar), SearchBar, DocList, TagInput, MarkdownEditor, Modal, Toast, Icon…
src/pages/      HomePage (hub), DocumentPage (read/edit/upload), WorkspacePage, LoginPage
src/AppData.tsx workspaces + categories context

Design notes

  • Search state lives in the URL (/?q=bearing&cat=it-cs&tag=urgent) – shareable and refresh-safe. #urgent in the box adds a tag filter.
  • Two tag kinds: tags (visible, counted on the dashboard) and meta_tags (quiet status flags like urgent, draft, review-needed). Both are searchable.
  • Categories are a table: insert into categories (slug,label) values ('leather','Leather'); adds a drop-down entry, no deploy needed.
  • Storage budget (500 MB): text only, one TEXT column (auto-compressed by Postgres), 300 KB cap per document, and full-text search via an expression index rather than a second stored copy. The home page shows a usage meter.
  • Security: all tables use Row Level Security; the anon key in the browser can only reach rows of workspaces you belong to. Raw HTML in Markdown is not rendered.
  • Titles must be descriptive (2+ words, 8+ chars), enforced in the UI and the database.

Contributing

MIT licensed. Run npm run typecheck before opening a PR. Ideas: document version history, per-workspace roles, Markdown file export, attachments (keep them out of the 500 MB text budget).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages