Skip to content

About

Full-stack notes application built with Bun, Hono, Prisma, and React. Implements JWT authentication with rotating refresh tokens, HttpOnly cookies, and indexed token verification for secure, production-style auth flows.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Note Manager

Full-stack notes application demonstrating secure JWT authentication, rotating refresh tokens, and a monorepo architecture built with modern TypeScript tooling.


Screenshots

Overview Editor
Notes overview (dark) Note editor (dark)
Viewer Profile
Note viewer (dark) Profile dashboard (dark)

Stack

Backend

  • Hono
  • Prisma + PostgreSQL
  • JWT (access tokens)
  • Rotating refresh tokens (HttpOnly cookies)

Frontend

  • React + Vite
  • TanStack Router
  • TanStack Form
  • Zustand
  • Zod

Tooling

  • Bun
  • Turborepo
  • TypeScript

Features

  • Secure JWT authentication (short-lived access tokens)
  • Rotating refresh tokens stored in HttpOnly cookies
  • O(1) refresh token verification using indexed lookup hash
  • Protected routes with client-side guards
  • Full CRUD notes functionality
  • Form validation (Zod + TanStack Form)
  • Optimized auth flow (deduplicated refresh, non-blocking logout)
  • Monorepo structure with shared types

Authentication Architecture

  • Access tokens expire in 15 minutes
  • Refresh tokens are:
    • Random 64-byte values
    • Hashed with bcrypt before storage
    • Indexed via SHA-256 lookup hash
    • Rotated on every refresh
    • Revoked on logout
  • Server verifies refresh tokens in constant time using indexed lookup
  • Client stores only:
    • User metadata
    • Access token
  • Refresh token stored as HttpOnly cookie (never accessible to JavaScript)

Performance Optimizations

  • Removed client-side polling wait loops
  • Deduplicated concurrent refresh requests
  • Eliminated dev proxy conflicts
  • Indexed refresh token lookup to avoid full table scans
  • Non-blocking logout flow
  • Resolved Prisma client duplication for consistent performance

Performance & Lighthouse

Current Lighthouse results (production):

Device Performance Accessibility Best Practices SEO
Desktop 100 100 100 100
Mobile 97 100 81* 100

* The remaining Best Practices warnings originate from Cloudflare's JavaScript challenge (/cdn-cgi/challenge-platform/scripts/jsd/main.js) rather than the application or its dependencies.

Lighthouse CLI audits may report significantly lower Performance scores than Chrome DevTools because Cloudflare's JavaScript challenge can add additional scripting time during automated audits. Interactive browser audits more accurately reflect application performance.


Architecture

Monorepo structure:

client/   → React application  
server/   → Hono API  
shared/   → Shared types

Running Locally

  1. Install dependencies:

    bun install
    
  2. Configure environment variables:

    cp .env.example .env
    
  3. Run development server:

    bun run dev
    

Project Focus

This project demonstrates:

  • Production-style authentication patterns
  • Secure token rotation and revocation
  • Proper cookie security practices
  • Clean separation of client and server responsibilities
  • Real-world performance tuning and debugging

About

Full-stack notes application built with Bun, Hono, Prisma, and React. Implements JWT authentication with rotating refresh tokens, HttpOnly cookies, and indexed token verification for secure, production-style auth flows.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages