Complete guide for developing explorar.dev locally.
- Quick Start
- Environment Configuration
- Available Commands
- Architecture Overview
- Testing
- Deployment
- Troubleshooting
npm install
npm run devOpens at http://localhost:3000. The predev script automatically downloads the Python/CPython repository for local testing (this may take a minute on first run).
| File | Purpose | Committed to Git |
|---|---|---|
.env.development |
Development defaults (NODE_ENV=development) |
β Yes |
.env.production |
Production defaults (NODE_ENV=production) |
β Yes |
.env.local |
Personal overrides (highest priority) | β No (gitignored) |
.env.example |
Template showing all available variables | β Yes |
| Variable | Required | Default | Description |
|---|---|---|---|
NEXT_PUBLIC_SITE_URL |
No | https://explorar.dev |
Site URL for metadata |
NEXT_PUBLIC_GUIDES_API_URL |
No | - | AI guides API URL (optional) |
NEXT_PUBLIC_GUIDES_API_KEY |
No | - | AI guides API key (optional) |
All variables are NEXT_PUBLIC_ β there is no backend or server-side configuration.
# Development
npm run dev # Start dev server with Turbopack (runs predev first)
npm run predev # Download Python/CPython repo for local testing
# Building & Deployment
npm run build # Build static export to out/ (runs prebuild first)
npm run prebuild # Download curated repos at build time
npm run clean # Remove build artifacts and downloaded repos
# Code Quality
npm run lint # TypeScript + ESLint + depcheck (0 warnings required)
npm run fix # Auto-fix ESLint, format with Prettier
# Testing
npm test # Run all Playwright tests (requires static build)
npm run test:sanity # Basic functionality tests
npm run test:performance # Core Web Vitals tests
npm run test:seo # SEO validation
npm run test:ui # Interactive test UIThis is a pure frontend application β no backend, no server, no authentication.
Browser
βββ Next.js Static Site (out/)
β βββ Repository Explorer (VS Code-like UI)
β βββ Monaco Editor
β βββ IndexedDB Storage (repos, file cache)
β
βββ Curated Repos β /public/repos/ (pre-downloaded at build time)
β
βββ Arbitrary Repos β GitHub API (unauthenticated, 60 req/hr)
Curated (Static): Pre-downloaded at build time via scripts/download-repos.ts. Files served from /public/repos/[owner]/[repo]/[branch]/. No API calls needed after build.
Arbitrary (Dynamic): User-entered repos downloaded on-demand to IndexedDB via github-archive.ts. Files lazy-loaded when opened.
Tests require a static build:
npm run build
npm testOr target a running dev server:
BASE_URL=http://localhost:3000 npm testBuild and deploy the static out/ directory to any static host (Netlify, Vercel, S3, etc.):
npm run build
# Deploy out/ directoryCurated repos are included in out/repos/ after build.
Symptoms: Opening a repository shows "Repository not downloaded" error.
Why: Curated repos are downloaded during predev/prebuild. The predev script only downloads CPython by default.
Solution:
# Download a specific repository
tsx scripts/download-repos.ts --only=torvalds/linux --depth=1
npm run dev
# Or download all curated repositories
npm run prebuild
npm run devAvailable curated repositories:
torvalds/linuxβ Linux Kernel (v6.1)python/cpythonβ Python (v3.12.0)bminor/glibcβ GNU C Library (glibc-2.39)llvm/llvm-projectβ LLVM (llvmorg-18.1.0)
# List all available repos
tsx scripts/download-repos.ts --listlsof -ti:3000 | xargs kill -9Restart the dev server β environment variables are read at startup.
npm run fix # Auto-fix most issues
npm run lint # Check remaining issues- Architecture Details: Check
CLAUDE.md