An interactive web app for learning HTML by building — gamified lessons, mini-games, instant feedback, and Byte, a terminal-style coding companion that reacts to your progress.
Built with Next.js 16 (App Router) · React 19 · TypeScript · TailwindCSS 4 · Framer Motion · Zustand and authenticated with Better Auth (email/password + GitHub).
- Interactive HTML lessons (teach → play → challenge → complete)
- Mini-games and coding challenges with live preview
- Byte — a terminal companion that gives smart hints, fun facts, and mentor tips
- Email/password + GitHub auth via Better Auth
- Progress, streaks, XP, and achievements (persisted locally in the browser)
- Premium glassmorphism UI
- Node.js 20+
- npm
-
Install dependencies:
npm install
-
Configure environment variables. Copy the example and edit as needed:
cp .env.example .env.local
.env.localis git-ignored. The dev defaults work out of the box with a local SQLite database. -
Create the local database tables:
node scripts/init-db.mjs
-
Run the dev server:
npm run dev
Open http://localhost:3000.
Testing note:
.env.localships withNEXT_PUBLIC_DISABLE_AUTH=trueso you can click through the app without signing in. Never enable this in production.
- Server instance:
src/lib/auth.ts - API handler:
src/app/api/auth/[...all]/route.ts(toNextJsHandler) - Client:
src/lib/auth-client.ts(signIn,signUp,signOut,useSession) - Route protection:
src/middleware.ts(checks the Better Auth session cookie) andsrc/components/auth/AuthGuard.tsx
The app uses the Kysely adapter and picks the database by environment:
| Environment | Database | Driver |
|---|---|---|
| Development | SQLite (dev.db) |
better-sqlite3 |
| Production | PostgreSQL | pg |
DATABASE_URL selects the connection. In dev it is file:./dev.db; in production it is a
Postgres connection string (e.g. from Neon/Supabase).
Provision a Postgres database (Neon, Supabase, Railway, etc.) and create the Better Auth tables:
DATABASE_URL=postgres://user:pass@host:5432/db npx tsx scripts/init-db-postgres.mjs(Or paste the SQL from that script into your Postgres console.)
On your host (Vercel / Railway / Fly), set:
| Variable | Example | Notes |
|---|---|---|
BETTER_AUTH_SECRET |
openssl rand -base64 32 output |
Required. Strong random string. |
BETTER_AUTH_URL |
https://your-domain.com |
Server base URL (no trailing slash). |
NEXT_PUBLIC_BETTER_AUTH_URL |
https://your-domain.com |
Client base URL. |
DATABASE_URL |
postgres://... |
Postgres connection string. |
NEXT_PUBLIC_DISABLE_AUTH |
false |
Must be false in production. |
GITHUB_CLIENT_ID |
optional | For GitHub sign-in. |
GITHUB_CLIENT_SECRET |
optional | For GitHub sign-in. |
⚠️ Never setNEXT_PUBLIC_DISABLE_AUTH=truein production — it disables all auth gating.
- Vercel: import the repo, set the env vars above, deploy. (Postgres is required — SQLite does not persist on Vercel's filesystem.)
- Railway / Fly.io / Render: these provide a persistent filesystem, so you can also keep
SQLite if you prefer — just keep
DATABASE_URL="file:./dev.db"and runnode scripts/init-db.mjsas a build/start step.
npm run build
npm run startsrc/
app/ # Next.js App Router pages + API routes
api/auth/[...all] # Better Auth handler
auth/ # login / register pages
lesson/ course/ dashboard/ profile/ settings/ onboarding/
components/
auth/ # AuthGuard, AuthSessionSync
byte/ # Byte terminal companion
brand/ # BrandLogo (uses /logo-icon.svg)
lib/
auth.ts # Better Auth server instance (Kysely adapter)
auth-client.ts # Better Auth React client
store/ # Zustand store (progress, achievements, Byte settings)
data/ # Static course / lesson / challenge content
middleware.ts # Route protection via session cookie
scripts/
init-db.mjs # SQLite table creation (dev)
init-db-postgres.mjs # Postgres table creation (prod)
| Command | Description |
|---|---|
npm run dev |
Start dev server |
npm run build |
Production build |
npm run start |
Start production server |
npm run lint |
ESLint |
MIT