A modern, full-stack web application for managing programming questions and their solutions. Built with Node.js, Express, Firebase Firestore, and modern frontend technologies.
- REST API with full CRUD operations
- Firebase Firestore integration for data persistence
- MVC Architecture with proper separation of concerns
- Input validation and comprehensive error handling
- CORS support and security middleware
- Request logging with Morgan
- Responsive design with Tailwind CSS
- Dark/Light mode toggle
- Syntax highlighting with Prism.js
- Search functionality for filtering questions
- Modern animations and micro-interactions
- Mobile-first approach
- Secure admin interface for content management
- Add, edit, delete questions with real-time validation
- Form handling with success/error notifications
- Responsive design optimized for all devices
- Backend: Node.js, Express.js
- Database: Firebase Firestore
- Frontend: HTML5, CSS3, JavaScript (ES6+)
- Styling: Tailwind CSS
- Syntax Highlighting: Prism.js
- Icons: Lucide React
- Build Tools: PostCSS, Autoprefixer
project/
├── server/
│ ├── app.js # Express server setup
│ ├── routes/
│ │ └── questions.js # API routes
│ ├── controllers/
│ │ └── questionsController.js # Business logic
│ └── services/
│ └── firestoreService.js # Database operations
├── public/
│ ├── css/
│ │ └── main.css # Compiled Tailwind CSS
│ └── js/
│ ├── theme.js # Theme management
│ ├── home.js # Homepage functionality
│ ├── question.js # Question detail page
│ └── admin.js # Admin panel logic
├── views/
│ ├── index.html # Homepage
│ ├── question.html # Question detail page
│ └── admin.html # Admin panel
├── src/css/
│ └── tailwind.css # Tailwind source
├── cred.json # Firebase service account key
├── package.json
├── tailwind.config.js
└── postcss.config.js
npm install- Create a Firebase project at https://console.firebase.google.com
- Enable Firestore Database
- Generate a service account key:
- Go to Project Settings > Service Accounts
- Click "Generate new private key"
- Save the JSON file as
cred.jsonin the root directory
Create a .env file or set environment variables:
FIREBASE_SERVICE_ACCOUNT='{your-service-account-json-here}'
PORT=3000npm run build-cssnpm start
# or for development
npm run dev-
Build CSS (watch mode):
npm run build-css
-
Start server (with nodemon):
npm run dev
-
Access the application:
- Homepage: http://localhost:3000
- Admin Panel: http://localhost:3000/admin
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/questions |
Fetch all questions |
| GET | /api/questions/:id |
Fetch single question |
| POST | /api/add-question |
Add new question |
| PUT | /api/questions/:id |
Update question |
| DELETE | /api/questions/:id |
Delete question |
// Firestore collection: "questions"
{
id: "auto-generated-id",
title: "Question Title",
desc: "Detailed question description",
solutions: {
global: "C code using global variables",
function: "C code using functions",
args: "C code using arguments"
},
createdAt: "2025-01-XX",
updatedAt: "2025-01-XX"
}- Grid display of all questions
- Real-time search functionality
- Responsive card layout with hover effects
- Dark/light mode toggle
- Loading and error states
- Tabbed interface for different solution approaches
- Syntax-highlighted code blocks
- Copy-to-clipboard functionality
- Mobile-optimized layout
- Add new questions with validation
- Edit existing questions inline
- Delete questions with confirmation
- Real-time success/error notifications
- Responsive form design
- Modify
src/css/tailwind.cssfor custom styles - Update
tailwind.config.jsfor theme customization - Rebuild CSS with
npm run build-css
- Update
server/services/firestoreService.jsfor schema changes - Modify validation in
server/controllers/questionsController.js
-
Environment Setup:
- Set production Firebase credentials
- Configure proper CORS origins
- Set NODE_ENV=production
-
Build Assets:
npm run build-css
-
Start Server:
npm start
- Fork the repository
- Create a feature branch
- Make changes with proper documentation
- Test thoroughly
- Submit a pull request
This project is licensed under the ISC License.
For issues and questions, please create an issue in the repository or contact the development team.