An interactive, Codedex-style learning platform for C++ programming built with Next.js and React.
- π 37 Examples organized into 7 learning categories
- π£ Step-by-Step Walkthroughs with detailed explanations for each line of code
- π‘ Concept Learning with explanations of key programming concepts
- π¨ Syntax Highlighting for easy code readability
- π± Responsive Design that works on all devices
- β‘ Fast Performance with static site generation
- π― Difficulty Levels to guide learners through content progressively
- Hello World π - Learn the basics of printing output
- Variables π¦ - Understand data types and declarations
- Conditionals π - Control program flow with if/else
- Loops π - Repeat code with for and while loops
- Vectors π - Work with dynamic arrays
- Functions βοΈ - Organize code with reusable functions
- Classes & Objects ποΈ - Learn object-oriented programming
- Framework: Next.js 15+
- Language: TypeScript
- Styling: Tailwind CSS
- Code Highlighting: Highlight.js
- Deployment: GitHub Pages (Static Export)
- Node.js 18+ and npm
# Clone the repository
cd cpp-learning-hub
# Install dependencies
npm install
# Run development server
npm run devThe site will be available at http://localhost:3000/cpp-learning-hub
npm run buildThis creates a static export in the /out directory that can be deployed to GitHub Pages.
- Push the repository to GitHub
- Go to Settings β Pages
- Set the source to "GitHub Actions"
- Deploy using the provided workflow
cpp-learning-hub/
βββ app/ # Next.js app directory
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
β βββ globals.css # Global styles
β βββ category/ # Category listing pages
β β βββ [id]/page.tsx # Dynamic category pages
β βββ example/ # Example detail pages
β βββ [id]/page.tsx # Dynamic example pages
βββ components/ # Reusable React components
β βββ Header.tsx
β βββ CategoryCard.tsx
β βββ ExampleCard.tsx
β βββ CodeHighlight.tsx # Syntax highlighting
β βββ StepWalkthrough.tsx # Step-by-step guide
β βββ ConceptExplainer.tsx # Concept explanations
βββ public/
β βββ data/ # Generated JSON data
β β βββ categories.json
β β βββ examples.json
βββ scripts/
β βββ parse-examples.js # Script to parse C++ examples
βββ package.json
The scripts/parse-examples.js script reads C++ files from the cpp-101-main directory and extracts:
- Code content
- Metadata (title, description, difficulty)
- Step-by-step explanations
- Related concepts
Each example contains:
{
id: string;
title: string;
description: string;
code: string;
concepts: string[];
difficulty: 'Beginner' | 'Intermediate' | 'Advanced';
steps: Array<{ line: number; explanation: string }>;
}Users can:
- Browse examples by category
- View syntax-highlighted code
- Follow step-by-step walkthroughs
- Learn programming concepts
- Understand code line-by-line
Edit scripts/parse-examples.js and add to the EXPLANATIONS object:
const EXPLANATIONS = {
'your-file.cpp': {
title: 'Your Title',
description: 'Your description',
concepts: ['Concept1', 'Concept2'],
difficulty: 'Beginner',
steps: [
{ line: 5, explanation: 'Explanation of line 5' },
// More steps...
]
}
};Then run: npm run parse
Edit components/ConceptExplainer.tsx and add to CONCEPT_EXPLANATIONS:
const CONCEPT_EXPLANATIONS = {
'Your Concept': {
description: 'What this concept means',
example: 'int x = 5; // example code'
}
};Edit tailwind.config.js and app/globals.css to customize colors and appearance.
- Images are automatically optimized
- Code is split into separate chunks
- CSS is minified in production
- Static files are cached efficiently
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
npm run dev -- -p 3001rm -rf .next
npm run devnode scripts/parse-examples.js
npm run devContributions are welcome! Please:
- Add detailed explanations for examples
- Improve existing walkthroughs
- Fix typos or clarify concepts
- Add new examples to the cpp-101 directory
Licensed under the MIT License - see LICENSE file for details.
- Examples from Codedex's cpp-101
- Built with Next.js
- Styled with Tailwind CSS
- Code highlighting with Highlight.js
For issues and questions:
- Open an issue on GitHub
- Check the Codedex community
- Visit the C++ Learning Hub documentation
Happy Learning! π