This is a web-based user interface for the Go Interview Practice project, providing an interactive environment for solving Go programming challenges.
- Challenge Browser: View all available coding challenges with difficulty indicators.
- In-browser Code Editor: Edit and run Go code directly in your browser with syntax highlighting.
- Test Runner: Run tests against your solution and see results in real-time.
- Learning Materials: Access Go learning materials specific to each challenge to improve your understanding.
- Scoreboard: Track your progress and see how you compare to others.
- Markdown Support: Challenge descriptions and learning materials rendered with full Markdown support.
- Go 1.16 or later
- Web browser (Chrome, Firefox, Safari, Edge)
-
Navigate to the web-ui directory:
cd web-ui
-
Run the web server:
go run main.go
-
Open your browser and visit:
http://localhost:8080
web-ui/
├── main.go # Main server entry point
├── static/ # Static assets
│ ├── css/ # CSS stylesheets
│ │ └── style.css # Custom CSS for the UI
│ └── js/ # JavaScript files
│ └── main.js # Common JavaScript utilities
├── templates/ # HTML templates
│ ├── base.html # Base template with common layout
│ ├── challenge.html # Challenge page with code editor
│ ├── home.html # Home page with challenge list
│ └── scoreboard.html # Scoreboard page for results
└── README.md # This file
The web UI uses Go's html/template
package for server-side rendering, with a base template that defines the common layout and individual content templates for each page type.
- Bootstrap: For responsive UI components
- Ace Editor: For the in-browser code editor
- Marked: For Markdown parsing
- Highlight.js: For syntax highlighting
The web UI exposes the following API endpoints:
GET /api/challenges
: Get all challengesGET /api/challenges/{id}
: Get a specific challengePOST /api/run
: Run code for a specific challengePOST /api/submissions
: Submit a solutionGET /api/scoreboard/{id}
: Get scoreboard for a challenge
- If adding new pages, create a new template in the
templates
directory. - Add any new API handlers in
main.go
. - Add CSS styles to
static/css/style.css
. - Add JavaScript utilities to
static/js/main.js
.
To enable hot-reloading during development, you can use tools like Air:
# Install Air
go install github.com/cosmtrek/air@latest
# Run with hot reloading
air
Contributions to improve the web UI are welcome! Please feel free to submit pull requests or open issues for new features or bug fixes.
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository on GitHub (click the "Fork" button)
- Clone your fork locally:
git clone https://github.com/yourusername/go-interview-practice.git
- Start the web UI as described above
- Choose a challenge from the homepage
- Write your solution in the code editor
- Test your code using the "Run Tests" button
- Submit your solution when tests pass
The web UI will guide you through these steps:
- Save to Filesystem: Click the button to save your solution locally
- Commit and Push:
git add challenge-X/submissions/yourusername/ git commit -m "Add solution for Challenge X by yourusername" git push origin main
- Create Pull Request:
- Go to your fork on GitHub
- Click "Contribute" → "Open pull request"
- Add a descriptive title
- Submit the PR
- Your pull request will be reviewed
- Once merged, your solution appears on the public scoreboard
- You get credit for solving the challenge
- Other developers can learn from your approach
This workflow ensures:
- ✅ Your solutions are properly tracked
- ✅ You contribute to the community
- ✅ Your GitHub profile shows your contributions
- ✅ You appear on the public leaderboards
The web UI provides two ways to submit your solution:
When you click the "Submit Solution" button, your solution will be:
- Tested against the challenge test cases
- Added to the in-memory scoreboard if all tests pass
- Displayed in the challenge scoreboard
This submission is temporary and only exists in the current server session. It doesn't save your solution to the filesystem.
After successfully submitting a solution that passes all tests, you'll see two options:
Click the "Save to Filesystem" button to:
- Automatically create a submission directory in your local repository
- Save your solution to
challenge-X/submissions/yourusername/solution-template.go
- Get a list of Git commands to commit and push your changes
This option creates the actual file structure needed for a GitHub pull request.
If you prefer to manage the file creation yourself, you can:
- Click "Copy Commands" to copy shell commands to your clipboard
- Run these commands in your terminal to create the submission files
- Commit and push the changes using the provided Git commands
After saving your solution to the filesystem (via either method), complete the submission by:
- Committing your changes
- Pushing to your fork
- Creating a pull request to the original repository
This workflow ensures your submission is properly integrated into the project's review system. # go-interview-practice-web-ui