- Go to https://github.com/new
- Repository name:
CodeVisualizer - Description:
GeeksforGeeks Code Viewer - View and syntax highlight code from CodeJudge - Keep it Public (required for free GitHub Pages)
- DO NOT initialize with README, .gitignore, or license
- Click "Create repository"
Open package.json and replace yourusername with your actual GitHub username:
"homepage": "https://YOUR_GITHUB_USERNAME.github.io/CodeVisualizer",For example, if your username is johndoe:
"homepage": "https://johndoe.github.io/CodeVisualizer",Run these commands in the terminal:
cd /Users/aakashhotchandani/Downloads/Archive_NEW/CodeVisualizer
# Add your GitHub repository as remote (replace YOUR_USERNAME)
git remote add origin https://github.com/YOUR_USERNAME/CodeVisualizer.git
# Push to GitHub
git branch -M main
git push -u origin mainnpm run deployThis will:
- Build your app
- Create a
gh-pagesbranch - Deploy to GitHub Pages
- Go to your repository on GitHub
- Click "Settings" tab
- Scroll to "Pages" in the left sidebar
- Under "Source", select branch:
gh-pages - Click "Save"
Your app will be live at:
https://YOUR_USERNAME.github.io/CodeVisualizer/
It may take 2-5 minutes for the first deployment.
After making changes:
git add .
git commit -m "Your update message"
git push
npm run deployCORS Issue on GitHub Pages: The proxy we set up for local development won't work on GitHub Pages. You have two options:
Update src/App.jsx to use the direct URL for production:
const fetchCode = async () => {
// ... existing code ...
// Use direct URL for production
const apiUrl = import.meta.env.DEV
? `/api/get-status/${codeId}`
: `https://codejudge.geeksforgeeks.org/get-status/${codeId}`;
const response = await fetch(apiUrl);
// ... rest of code ...
};Deploy a simple proxy server on platforms like:
- Vercel
- Netlify Functions
- Cloudflare Workers
The GeeksforGeeks API might work directly from GitHub Pages if they allow cross-origin requests from static sites.
# Local development
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Deploy to GitHub Pages
npm run deploy
# Push code to GitHub
git push- Created GitHub repository
- Updated
homepagein package.json with your username - Added remote origin
- Pushed code to GitHub
- Ran
npm run deploy - Verified GitHub Pages settings
- Accessed your live app
- Tested with a code ID (e.g., HtCPiL7X1P)
Enjoy your deployed app! 🎉