A comprehensive full-stack web application for managing programming problems with Google Sheets integration. Built with Node.js/Express backend and Vanilla JavaScript frontend with Bootstrap 5.
- Problem Management: Create, read, update, delete programming problems
- Search & Filter: Advanced search with difficulty filtering and sorting
- Authentication: Secure JWT-based authentication system
- Export Options: Export problems to PDF, Markdown, or copy to clipboard
- Google Sheets Integration: Automatic synchronization with Google Sheets
- Responsive Design: Mobile-first design with Bootstrap 5
- Dark/Light Mode: Theme toggle with persistent settings
- Auto-save: Automatic saving during problem editing
- Real-time Statistics: Dashboard with problem metrics
- Pagination: Efficient handling of large datasets
- Input Validation: Both client-side and server-side validation
- Error Handling: Comprehensive error handling with user feedback
- Keyboard Shortcuts: Quick navigation and actions
- Auto-refresh: Automatic token refresh for security
ProgrammingProblems/
βββ backend/ # Node.js/Express API
β βββ middleware/ # Authentication, validation, error handling
β βββ routes/ # API endpoints
β βββ services/ # Google Sheets integration
β βββ server.js # Main server file
βββ frontend/ # Vanilla JavaScript frontend
β βββ css/ # Custom styles
β βββ js/ # Application modules
β βββ index.html # Main HTML file
βββ README.md # This file
- Node.js 16+ and npm
- Google Cloud Project with Sheets API enabled
- Google Service Account credentials
-
Install Dependencies
cd backend npm install
-
Environment Configuration
cp .env.example .env
Configure the following variables in
.env
:# Server Configuration PORT=3001 NODE_ENV=development # JWT Configuration JWT_SECRET=your-super-secret-jwt-key-here JWT_EXPIRES_IN=24h # Google Sheets API Configuration GOOGLE_SHEET_ID=1q7GSsDZx6MLB8qQoFyEgqWkFzo5K77G34uvhR4XJ-I GOOGLE_SERVICE_ACCOUNT_EMAIL=your-service-account@your-project.iam.gserviceaccount.com GOOGLE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY_HERE\n-----END PRIVATE KEY-----\n" # Authentication ADMIN_USERNAME=admin ADMIN_PASSWORD=admin123 # CORS Settings FRONTEND_URL=http://localhost:3000
-
Google Sheets Setup
- Create a Google Cloud Project
- Enable Google Sheets API
- Create a Service Account
- Download service account credentials
- Share your Google Sheet with the service account email
- Update the
GOOGLE_SHEET_ID
in your.env
file
-
Start Backend Server
npm run dev
The API will be available at
http://localhost:3001
-
Navigate to Frontend Directory
cd frontend
-
Serve Frontend
Option A: Using Live Server (Recommended)
- Install Live Server extension in VS Code
- Right-click on
index.html
and select "Open with Live Server"
Option B: Using Python
python -m http.server 3000
Option C: Using Node.js serve
npx serve -p 3000
-
Access Application Open
http://localhost:3000
in your browser
- Username: admin
- Password: admin123
The system expects the following columns in your Google Sheet:
Column | Field | Description |
---|---|---|
A | Title | Problem title |
B | Description | Problem description |
C | Input Format | Input format description |
D | Output Format | Output format description |
E | Constraints | Problem constraints |
F | Examples | Example inputs/outputs |
G | Difficulty | Easy/Medium/Hard |
H | Tags | Comma-separated tags |
I | Time Limit | Time limit (e.g., "1 second") |
J | Memory Limit | Memory limit (e.g., "256 MB") |
K | Created At | Timestamp |
POST /api/auth/login
- User loginPOST /api/auth/verify
- Token verificationPOST /api/auth/refresh
- Token refresh
GET /api/problems
- Get all problems (with filters)GET /api/problems/:id
- Get specific problemPOST /api/problems
- Create new problemPUT /api/problems/:id
- Update problemDELETE /api/problems/:id
- Delete problemPOST /api/problems/:id/duplicate
- Duplicate problemGET /api/problems/stats/summary
- Get statistics
search
- Search in title, description, tagsfilter
- Filter by difficulty (Easy/Medium/Hard)sort
- Sort by (date_desc, date_asc, title_asc, title_desc, difficulty_asc, difficulty_desc)page
- Page number (default: 1)limit
- Items per page (default: 10, max: 50)
- Mobile-first approach with Bootstrap 5
- Responsive navigation and tables
- Touch-friendly interface
- Optimized for all screen sizes
- Clean, modern design with gradient backgrounds
- Smooth animations and transitions
- SweetAlert2 for elegant notifications
- Bootstrap icons for consistent iconography
- System preference detection
- Manual toggle with persistent storage
- Smooth theme transitions
- All components support both themes
Ctrl/Cmd + D
- DashboardCtrl/Cmd + P
- ProblemsCtrl/Cmd + N
- Create NewCtrl/Cmd + /
- Focus SearchEsc
- Cancel/Close?
- Show help
- Professional formatting with jsPDF
- Includes all problem details
- Difficulty badges with color coding
- Automatic page breaks
- Custom styling and branding
- Clean Markdown formatting
- Code blocks for examples
- Proper heading structure
- Compatible with GitHub/GitLab
- JSON format for easy data transfer
- Complete problem data included
- Browser clipboard API integration
- JWT token authentication
- Request rate limiting
- Input validation and sanitization
- CORS configuration
- Helmet.js security headers
- Environment variable protection
- XSS prevention
- Secure token storage
- Input validation
- HTTPS enforcement (production)
backend/
βββ middleware/
β βββ auth.js # JWT authentication
β βββ errorHandler.js # Global error handling
β βββ validation.js # Input validation
βββ routes/
β βββ auth.js # Authentication routes
β βββ problems.js # Problem CRUD routes
βββ services/
β βββ googleSheets.js # Google Sheets integration
βββ .env.example # Environment template
βββ package.json # Dependencies and scripts
βββ server.js # Main server file
frontend/
βββ css/
β βββ styles.css # Custom styles
βββ js/
β βββ config.js # Configuration and utilities
β βββ auth.js # Authentication management
β βββ api.js # API client and error handling
β βββ ui.js # UI management and themes
β βββ problems.js # Problem management
β βββ export.js # Export functionality
β βββ app.js # Main application coordination
βββ index.html # Single-page application
npm run dev # Start with nodemon (auto-reload)
npm start # Start production server
npm test # Run tests
- ESLint configuration for consistent code style
- Prettier for code formatting
- JSDoc comments for documentation
-
Prepare for Production
# Set NODE_ENV to production NODE_ENV=production
-
Environment Variables Set all required environment variables on your hosting platform
-
Build Command
npm install
-
Start Command
npm start
-
Build Settings
- Build command: Not required (static files)
- Publish directory:
/frontend
-
Update API URL Update
API_BASE_URL
inconfig.js
to point to your deployed backend -
Deploy
- Connect your GitHub repository
- Configure build settings
- Deploy automatically on push
- Update JWT_SECRET to a secure random string
- Set NODE_ENV=production
- Configure CORS for your production domain
- Set up HTTPS (recommended)
- Update API_BASE_URL in frontend config
- Test all functionality in production environment
- Set up monitoring and logging
- Configure backup for Google Sheets data
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
-
Google Sheets API Errors
- Verify service account credentials
- Check if Sheets API is enabled
- Ensure sheet is shared with service account email
-
JWT Token Errors
- Verify JWT_SECRET is set
- Check token expiration settings
-
CORS Errors
- Update FRONTEND_URL in backend .env
- Check CORS configuration in server.js
-
API Connection Failed
- Verify backend is running on correct port
- Check API_BASE_URL in config.js
- Ensure CORS is properly configured
-
Authentication Issues
- Clear browser localStorage
- Check default credentials
- Verify JWT token handling
For development, open browser console and use:
// Check application status
window.debug.status()
// View current configuration
window.debug.config()
// Check authentication status
window.debug.auth()
// Clear all local storage
window.debug.clearStorage()
// Restart application
window.debug.restart()
For support, please create an issue in the GitHub repository or contact the development team.
- Bootstrap team for the excellent CSS framework
- Google for the Sheets API
- SweetAlert2 for beautiful alerts
- jsPDF for PDF generation capabilities
- Express.js and Node.js communities