Good Code Bad Code is a read-only learning library for developers who want to improve their code review instincts by comparing side-by-side examples.
Each lesson shows a focused Good Code sample next to a Bad Code sample, then explains what to review, why the issue matters, and what habit to carry into future reviews.
Most code review advice is abstract: "write clean code", "avoid side effects", "prefer good naming". This project makes those ideas visible through small, realistic examples that readers can inspect by themselves.
The first version is an Example Library, not a quiz platform or interactive grader. Bad Code can still run; it exists to make a review issue easier to spot.
Current UI snapshots from the example library:
Home page:
Track page:
Lesson page:
- Side-by-side Good Code and Bad Code comparisons
- 18 tracks with 10 lessons per track
- Lessons for languages, frameworks, runtimes, tools, and styling systems
- English and Thai lesson copy
- Thai-translated code comments for supported lesson sweeps
- Syntax highlighting with Shiki
- Previous and next lesson navigation
- SEO metadata, sitemap, robots.txt, and Open Graph image
- Static export ready for Cloudflare Pages
- Support footer with Buy Me a Coffee
Current tracks:
- HTML
- CSS
- JavaScript
- TypeScript
- React
- Next.js
- Node.js
- Express
- SQL
- Python
- PHP
- Java
- Git
- FastAPI
- Django
- Go
- Docker
- Tailwind CSS
- Next.js 16 App Router
- React 19
- TypeScript
- Tailwind CSS 4
- MDX
- Shiki
- Node test runner
Install dependencies:
npm installRun the development server:
npm run devOpen:
http://localhost:3000npm run dev
npm run build
npm run lint
npm run test:contentnpm run build creates a static export because next.config.ts uses:
output: "export"The static output is written to out/.
app/ App Router routes, metadata routes, layout
components/ UI components for home, tracks, lessons, language, footer
content/ MDX lessons organized by track
content/lesson-registry.ts
lib/content/ Lesson loading, navigation, schema, code comment helpers
lib/i18n/ Language state and Thai translations
lib/seo.ts Shared SEO, canonical URL, sitemap helpers
public/ Icons, favicon assets, support logo
tests/content/ Content, registry, i18n, SEO, icon, and UI contract tests
docs/content-guidelines.md
CONTEXT.mdA Review Lesson belongs to one Track and includes:
- Title, order, summary, tags, and takeaways
- Good Code sample
- Bad Code sample
- Review notes written in MDX
- Thai localized copy in
lib/i18n/translations.ts - Optional Thai code comment translations matched to the English comment order
When adding or editing lessons, read:
CONTEXT.mdfor project vocabularydocs/content-guidelines.mdfor lesson, code comment, and Thai copy guidelines
- Add the MDX file under
content/<track>/. - Export
metadatawithtrack,order,summary,tags,takeaways,goodCode, andbadCode. - Register the lesson in
content/lesson-registry.ts. - Add Thai copy in
lib/i18n/translations.ts. - Run:
npm run test:contentThe content tests check lesson counts, contiguous ordering, MDX compilation, translation coverage, code comment coverage, SEO helpers, icons, and shared UI contracts.
The project is configured for static hosting.
Recommended Cloudflare Pages settings:
Framework preset: Next.js (Static HTML Export)
Production branch: main
Build command: npm run build
Build output directory: out
Root directory: /Set this environment variable in production:
NEXT_PUBLIC_SITE_URL=https://your-domain.comThis controls canonical URLs, sitemap URLs, robots.txt, and Open Graph image URLs.
The app includes:
metadataBase- title templates
- canonical URLs
- Open Graph metadata
- Twitter card metadata
- generated
/sitemap.xml - generated
/robots.txt - generated
/opengraph-image - favicon and web manifest assets
If the project helps you, you can support the creator here:
- Keep content changes focused by track when possible.
- Commit completed track sweeps separately.
- Prefer clear review signals over long explanations inside code comments.
- Keep Thai copy natural for Thai developers; do not force literal translations for common technical terms.


