An interactive, locally-runnable web application for learning PostgreSQL through hands-on exercises with real database instances.
- Interactive Exercises: Write SQL queries against real PostgreSQL databases
- Adaptive Evaluation: Skill assessment that adjusts to your level
- Progress Tracking: Track completed lessons, skill rating, and learning streaks
- Personalized Learning: Get recommendations based on your weak areas
- Offline-Ready: Works locally after initial setup
- Node.js 18 or higher
- Docker Desktop
- 2GB free disk space
-
Clone and Install
git clone <repository-url> cd learn-pg npm run setup
The setup script will:
- Install all dependencies
- Build the PostgreSQL Docker image
- Start the PostgreSQL container
- Initialize the database
-
Start the Application
npm start
This will start both the backend (port 3000) and frontend (port 5173).
-
Open Your Browser
http://localhost:5173
learn-pg/
├── packages/
│ ├── shared/ # Shared TypeScript types
│ ├── backend/ # API server (Fastify + Node.js)
│ └── frontend/ # Web UI (React + Vite)
├── curriculum/
│ ├── topics/ # Lesson content and exercises
│ ├── evaluation/ # Evaluation question banks
│ └── OUTLINE.md # Curriculum structure
├── docker/ # PostgreSQL configuration
├── scripts/ # Setup and utility scripts
└── data/ # SQLite database (created on first run)
npm start- Start development serversnpm run setup- Initial setup (run once)npm run reset-progress- Clear user progressnpm run reset-db- Reset PostgreSQL databasenpm run build- Build for productionnpm run typecheck- Check TypeScript types
- Browse Topics: View all available topics organized by difficulty level
- Read Lessons: Learn concepts through clear, structured lessons
- Complete Exercises: Practice with hands-on SQL exercises
- Get Feedback: Receive instant validation and helpful suggestions
- Track Progress: Monitor your skill level and completed exercises
- Take adaptive evaluations to assess your skill level
- Questions adjust difficulty based on your performance
- Get personalized weak area identification
- Track skill rating from 1 (Fledgling DBA) to 10 (Vacuum Philosopher)
- View completed exercises and time spent
- See your current skill level and streak
- Review weak areas that need improvement
- Get recommended lessons based on your performance
The curriculum covers 6 topics across 4 difficulty levels:
Level 1 - Foundations:
- PostgreSQL Basics - Data types, basic queries, and table operations
Level 2 - Intermediate:
- Caching and Prepared Statements - PostgreSQL's caching mechanisms and prepared statement usage
- Advanced SQL Queries - Window functions, CTEs, subqueries, and complex data analysis
Level 3 - Advanced:
- Query Planner Internals - How PostgreSQL plans and optimizes queries
- PostgreSQL Statistics - How statistics are collected and used for query planning
Level 4 - Expert:
- Operational Health Monitoring - Monitoring and maintaining PostgreSQL in production
See CURRICULUM_GUIDE.md for instructions on adding new topics, lessons, and exercises.
See CLAUDE.md for a detailed architectural overview.
GET /api/curriculum/topics- Get all topicsGET /api/curriculum/topics/:topicId- Get specific topicGET /api/curriculum/lessons/:lessonId- Get lesson contentGET /api/curriculum/lessons/:lessonId/exercises- Get exercises for a lesson
POST /api/exercises/:exerciseId/setup- Initialize exercise environmentPOST /api/exercises/:exerciseId/submit- Submit SQL query for validationGET /api/exercises/:exerciseId/hints- Get hints for an exercise
GET /api/progress- Get user progressPATCH /api/progress- Update user progressGET /api/progress/weak-areas- Get identified weak areas
POST /api/evaluation/start- Start new evaluation sessionGET /api/evaluation/:sessionId/next- Get next questionPOST /api/evaluation/:sessionId/answer- Submit answerPOST /api/evaluation/:sessionId/complete- Complete evaluation
Container won't start:
docker-compose -f docker/docker-compose.yml logsReset container:
npm run reset-dbProgress not saving:
Check that data/ directory exists and is writable.
PostgreSQL connection errors: Ensure Docker is running and container is healthy:
docker ps
docker exec learn-pg-postgres pg_isready -U learnpgIf ports 3000 or 5173 are in use, you can change them:
- Backend: Set
PORTenvironment variable - Frontend: Edit
vite.config.ts
- Frontend: React 18, TypeScript, TailwindCSS, React Query, Monaco Editor
- Backend: Node.js, Fastify, TypeScript
- Databases: SQLite (progress), PostgreSQL 16 (exercises)
- DevOps: Docker, Docker Compose
npm test --workspacesnpm run build- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details
For issues and questions:
- Open an issue on GitHub
- Check existing issues for solutions
- Review TROUBLESHOOTING.md for common problems
- Additional curriculum topics (advanced optimization, replication)
- More exercise types (schema design, query debugging)
- Visual query plan explorer
- Learning analytics and insights
- Multi-user support
- Export/import progress
