A website for sharing LeetCode problem solutions.
leet-share/
├── admin.py # Admin CLI tools
├── requirements.txt # Python dependencies
├── config.js # Frontend configuration
├── firebase.js # Firebase configuration
├── index.html # Main HTML file
├── ui.js # UI logic and event handlers
├── utils.js # Utility functions
├── style.css # Main stylesheet
├── hljs.css # Code highlighting stylesheet
└── README.md # Project documentation
- HTML/CSS/JavaScript - Core web technologies
- Firebase Firestore - Real-time cloud database
- Highlight.js - Code syntax highlighting
- Python3 - Admin CLI tools
- Firebase Admin SDK - Database management and authentication
- C
- C++
- Rust
To add support for additional programming languages, modify admin.py:
ext_to_lang = {
".cpp": "cpp",
".c": "c",
".rs": "rust",
".py": "python", # Add new language
}Also update index.html to load the corresponding highlight.js language file:
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/languages/python.min.js"></script>- Python 3.7 or higher
- Firebase project with Admin SDK credentials
- Node.js (optional, for local development server)
-
Clone the repository
git clone https://github.com/revival0728/leet-share.git cd leet-share -
Set up Python virtual environment
python3 -m venv .venv source .venv/bin/activate # On macOS/Linux # or .venv\Scripts\activate # On Windows
-
Install dependencies
pip install -r requirements.txt
-
Configure Firebase
- Download your Firebase Admin SDK credentials JSON file
- Set the environment variable:
export CERT_JSON_PATH="path/to/leet-share-firebase-adminsdk-*.json"
- Or create a
.envfile:
CERT_JSON_PATH=path/to/leet-share-firebase-adminsdk-*.json -
Initialize the database
python admin.py init
-
Start the web application
- Open
index.htmlin a web browser - Or serve it with a local server:
# Using Python python3 -m http.server 8000 # Using Node.js npx serve .
- Open
Use the admin.py CLI tool to manage the database:
python admin.py --helpYou can deploy this repository on GitHub Pages
This project is licensed under the MIT License - see the LICENSE file for details.