- proxy.ts: composes Supabase session refresh + next-intl middleware
into a single NextResponse via copyCookies helper. Coarse auth gate
on /dashboard + /admin prefixes redirects unauth users to
/[locale]/sign-in (no ?next= per trimmed plan).
- lib/supabase/session.ts: implements updateSupabaseSession() returning
{ response, user }. Cookies written onto both request.cookies (for
downstream reads) and response.cookies (for browser). PROTECTED_PATH_PREFIXES
exported as the gate list.
- lib/proxy/copy-cookies.ts: small helper that ports Set-Cookie entries
between two NextResponses.
- lib/auth/get-server-session.ts: getServerSession() returning
{ user, role } | null. Derives User type from the factory's return
type so @supabase/supabase-js stays out of allow-listed lib/auth/*
per ESLint no-restricted-imports.
- lib/auth/session-provider.tsx: client-side context exposing user to
client components via useSession() — populated once per request in
the locale layout.
- app/[locale]/layout.tsx: reads user via getUser() outside any
'use cache' scope; wraps children in SessionProvider; explicit
'use cache' warning comment.
BSK (Rewrite)
An educational rewrite of the BSK All-in-One Clinic Management System into a modern web stack.
Original project: lds217/BSK-All-in-One-Clinic-Management-System by @lds217 — a Java/Swing desktop application with a Netty server and SQLite backend, built for small Vietnamese clinics.
This repository is a clean-room reimplementation for learning purposes. No source code is copied from the original; features and data shapes are reimplemented from the upstream README and observable behavior. See NOTICE for full attribution.
Status
Planning phase. See PLAN.md for the architecture and phased roadmap.
Stack
- pnpm + Next.js 16 (App Router) + TypeScript
- Supabase (Postgres + Auth + Storage) — shared across personal projects via schema-per-app
- Upstash Redis + QStash — shared across personal projects via key prefixes
- Vercel for hosting
- shadcn/ui + Tailwind CSS
Important disclaimers
- Educational use only. This codebase is not certified for clinical use and must never be deployed against real patient data. Use synthetic data only.
- No HIPAA / GDPR compliance is implied or attempted on the free-tier infrastructure.
- This is a derivative work for learning; if you are the upstream author and would like additional attribution or removal, please open an issue.
Database
After pnpm db:push, run pnpm db:gen-types to refresh types/supabase-bsk.ts.
License
This repository is licensed under the Apache License 2.0. The original project does not currently carry an explicit license; see NOTICE for the attribution stance.