Skip to content

Latest commit

Β 

History

History
67 lines (50 loc) Β· 2.72 KB

File metadata and controls

67 lines (50 loc) Β· 2.72 KB

VideoNote

A video review app with slick intuitive controls to create timestamped notes on the fly. ✨

Tech Stack

Some additional experimental features are enabled in tailwind.config.js: uniformColorPalette, extendedSpacingScale, extendedFontSizeScale

Setup

  • MongoDB database
  • SMTP email server
  • JWT

Create a .env.local based on the .env.example for local development.

Run it

npm i && npm run dev

API conventions

Routes under pages/api/ use two small higher-order wrappers from utils/auth/withAuthenticatedUser.ts to keep authentication out of the handler bodies:

  • withAuthenticatedUser(handler) β€” required for routes that mutate user data (auth, user, settings, project). The handler receives a third ctx argument with { userDoc, email, newToken }. Missing/invalid tokens short-circuit with 401; missing users short-circuit with 401.
  • withOptionalUser(handler) β€” used by pages/api/note.ts, which allows guest note creation. The handler receives a discriminated ctx: either { isGuest: true, ... null } or the full authenticated context. A token that is present but invalid still 401s β€” there is no silent fallback to the guest branch.

Shared-project access goes through utils/share/sharePassword.ts:

  • hashSharePassword(plaintext) β€” used by pages/api/project.ts when creating or updating a Share document. Returns null for empty input.
  • verifySharePassword(storedHash, candidate) β€” used by pages/api/public_project.ts when reading a shared project. Returns a ShareAccessResult discriminated union: open | passwordRequired | incorrect | ok.

Note write-path goes through utils/note/noteIntake.ts:

  • upsertNote(input, authorId) β€” used by pages/api/note.ts. Creates if _id is not found, updates otherwise. On create also attaches the note id to its Project. Pass null for authorId to skip authorship (guest path).
  • removeDoneProjectNotes(projectId) β€” used by the same handler for the REMOVE_DONE_NOTES action; returns the surviving notes.

All three modules have unit tests under src/__test__/ that exercise behaviour through their public interface.