Frontend
Code: app.abhyas.frontend.dev. Live: abhyas.dev.nishko.co (dev) and abhyas.nishko.co (prd, from app.abhyas.frontend.prd).
How it works
- A single-page app built with Next.js and exported as static files (
output: "export"inweb/next.config.mjs). GitHub Pages servesindex.htmland404.html, and both are the same app, so every address loads it and moving around never reloads the page. web/components/App.jschecks sign-in, then routes on the path. Old addresses such as/math/#/progressare rewritten to/math/progress.- Signing in with GitHub (through Supabase) is required, and only invited accounts can sign in.
- Design: Primer React (
@primer/react) and Primer's CSS tokens (@primer/primitives), GitHub's colours. Light theme only for now. - Every page has the same header (abhyas, a ☰ menu with Sources and Sign out, and your avatar) and its own navigation below it.
- One build serves both sites. It carries the public settings of both Supabase projects (
web/.env.dev,web/.env.prd);web/lib/env.jspicks prd on abhyas.nishko.co and dev everywhere else, including localhost. - The header shows the running version from
version.json. On prd it also says when dev has a newer release.
Routes
| Route | What it is |
|---|---|
/ | Dashboard: a practice calendar (minutes practised each day, all disciplines or one), streaks, a card per discipline with its sources and last 14 days, adding a discipline, and recent papers |
/sources/<discipline> | Sources workspace: Overview, Concept (lessons), Practice, Test; manage chapters, topics, tags, book sources and questions. Saved straight to Supabase |
/math/... | Maths practice: build a paper, take it, grade it, track progress (see Mathematics practice) |
Code layout
| Path | What it does |
|---|---|
web/app/ | The page, the 404 page (the same app) and the layout, which loads the design system's styles |
web/components/App.js | Sign-in, routing (with web/lib/nav.js), the page shell |
web/components/Header.js | The design system's header and drawer, with the site's places, sign-out and version |
web/components/SignIn.js | The design system's sign-in screen, with Supabase sign-in |
web/components/dashboard/Dashboard.tsx | The home page: loads the data and lays out the design system's dashboard components |
web/lib/dashboard/data.ts | What the dashboard loads |
web/lib/store.ts | The shared Zustand store (see State Management) |
web/lib/auth.js | Supabase client, sign-in, session, saved records |
web/lib/sources.js | The sources workspace (draws its own HTML) |
web/lib/question-bank.js | A discipline's chapters, topics, sources and questions |
web/lib/math/ | Maths practice: templates, engine (grading, papers), UI |
web/lib/latex.js | LaTeX to HTML; maths typeset by MathJax |
tests/ | node --test tests; tests/fixtures/outline.json is a snapshot of the outline |
Components, styles and colours come from the design system (@nishkodotco/abhyas-design-system, from app.abhyas.design). The site keeps no stylesheets of its own, and npm run check enforces the design system's standards.
Run it locally
scripts/serve.sh # http://localhost:8010 (dev database) cd web && npm test # tests cd web && npm run build # static site in web/out/ cd web && npm run check # the design system's checks cd web && npm update @nishkodotco/abhyas-design-system # take the design system's newest release
Node 22 is needed (the dev container has it).