Skip to content

IMBeniamin/NoteCalc

Repository files navigation

Note Calc

Note Calc is a collaborative Python notepad + calculator built for fast technical thinking.
It combines a code editor, inline computation, and real-time sharing in a single web app.

Why this project

Most tools force a tradeoff between "note-taking" and "calculation". Note Calc is built to do both:

  • Write plain-English context and Python logic in one place
  • Execute and inspect outputs without leaving the editor
  • Share, review, and iterate with collaborators in real time

Core capabilities

  • Guest mode on / with an instant demo note (no login required)
  • Python execution in-browser via Pyodide
  • Inline line-level calculation results
  • Authenticated note persistence in Supabase
  • Auto-save workflow for authenticated notes
  • Rich note metadata (tags, pin, important flag, related date)
  • Smart note discovery (filtering, sorting, and search ranking)
  • Real-time collaborative editing + live collaborator presence
  • Share controls:
    • private notes
    • link-based read access
    • link-based edit access
    • email-based read/edit access
  • Role-aware access model (owner, shared_read, shared_edit, public_read, public_edit)

Quality and automation

  • Unit/integration test suite with Vitest + Testing Library for core modules:
    • auth flows and redirect safety
    • notes/profile API adapters and hooks
    • editor preferences store
    • collaboration session behavior
    • Pyodide runner/intellisense integration points
  • Browser-level Playwright coverage for notepad guest workflows:
    • /notepad loads editor shell and key controls
    • guest draft persistence behavior in local storage
  • CI workflow in .github/workflows/ci.yml enforces:
    • lint
    • coverage tests
    • production build
    • notepad browser tests

Product routes

  • / guest editor + app entry
  • /login email OTP and optional OAuth sign-in
  • /auth/callback auth token/code exchange
  • /notepad/:noteId owned or shared note by ID
  • /shared/:shareToken token-based shared note access
  • /about product overview

Tech stack

  • Frontend: React 19, TypeScript, Vite
  • Routing/Data: TanStack Router, TanStack Query
  • UI: Mantine
  • Editor: Monaco
  • Python runtime: Pyodide (web worker)
  • Collaboration: Yjs + Supabase Realtime channel sync
  • Backend: Supabase (Postgres, Auth, RLS, RPC)
  • Deploy target: Cloudflare Pages

Security and data model

Supabase migrations in supabase/migrations/ define:

  • notes and note_shares tables
  • row-level security (RLS) policies for owner/shared/public access
  • RPC-based access functions for:
    • guest draft import
    • listing accessible notes
    • secure note reads by ID or share token
    • secure note updates with permission checks
    • share management and public access control

Local development

1. Prerequisites

  • Node.js 20+
  • pnpm
  • A Supabase project

2. Install dependencies

pnpm install

3. Configure environment

Create a local .env (or copy from .env.example) and set:

VITE_SUPABASE_URL=...
VITE_SUPABASE_ANON_KEY=...
VITE_SUPABASE_OAUTH_PROVIDERS=google,github # optional, comma-separated

4. Run database migrations

Run SQL files in supabase/migrations/ in chronological order:

  1. 20260210_notes_backend.sql
  2. 20260213_fix_note_shares_rls_recursion.sql
  3. 20260214_allow_anon_link_edit.sql
  4. 20260217_optimize_rls_and_fk_indexes.sql

5. Configure Supabase Auth

In Supabase Auth URL settings:

  • Local site URL: http://localhost:5173
  • Local redirect URL: http://localhost:5173/auth/callback
  • Production site URL: your deployed domain
  • Production redirect URL: https://<your-domain>/auth/callback

6. Start the app

pnpm dev

7. Browser test prerequisites (Playwright)

Install Playwright browser binaries:

pnpm exec playwright install chromium

On Linux CI/containers, install system dependencies when needed:

pnpm exec playwright install --with-deps chromium

Scripts

  • pnpm dev start local dev server
  • pnpm build type-check + production build
  • pnpm lint run ESLint
  • pnpm test run unit/integration tests
  • pnpm test:watch run tests in watch mode
  • pnpm test:coverage run tests with coverage reports (coverage/)
  • pnpm test:e2e run browser tests for notepad flows (Playwright)
  • pnpm test:e2e:headed run browser tests with visible browser
  • pnpm check run lint + coverage + production build
  • pnpm preview preview production build locally
  • pnpm pages:deploy build and deploy to Cloudflare Pages via Wrangler

Deployment notes (Cloudflare Pages)

  • Ensure VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY are set in Pages environment variables
  • Keep SPA fallback enabled so routes like /notepad/:id and /shared/:token resolve to index.html
  • Keep Supabase redirect URLs in sync with deployed domains

License

This repository is licensed under the Note Calc Non-Commercial License v1.0 (LICENSE).

  • Non-commercial use, modification, and redistribution are allowed
  • Commercial/profit-generating use requires explicit written permission from the copyright holder

About

Real time notepad calculator powered by python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors