- app/[locale]/(app)/layout.tsx: Server gate — getServerSession()
redirects unauth users (defense in depth) and signs out + redirects
the authed-but-no-role edge case. Renders AppShell with user/role/locale.
- app/[locale]/(app)/admin/layout.tsx: second gate via requireRole;
non-admin → /[locale]/dashboard (not 404 — avoids confirming routes).
- app/[locale]/(app)/dashboard/page.tsx: placeholder showing email +
role badge.
- lib/auth/role-menu.ts: ROLE_MENU mapping per AppRole → MenuItem[]
with href + i18n labelKey + lucide icon.
- lib/auth/require-role.ts: server helper for the admin gate.
- components/app-shell/{app-shell,sidebar,sign-out-button,locale-switcher}.tsx:
Server-rendered shell + sidebar that reads ROLE_MENU[role]; client
locale switcher (native <select> fallback) and sign-out (<form action>
with useFormStatus pending UX).
- components/ui/{badge,separator}.tsx: shadcn primitives.
- messages/{vi,en}.json: nav.*, app.*, dashboard.* keys (parity).
Gating chain: proxy.ts redirects unauth → /sign-in for /dashboard +
/admin prefixes; (app) layout enforces session+role; (app)/admin layout
additionally enforces role === 'admin'.
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.