A comprehensive web-based application for generating bonafide certificates for students with authentication, admin panel, and Firebase backend.
- User Authentication: Secure registration and login system
- Student Dashboard: View and manage bonafide certificate requests
- Certificate Request: Submit requests with complete student information
- Request Status: Track request status (Pending, Approved, Rejected)
- PDF Generation: Download approved certificates as PDF
- Admin Dashboard: View all certificate requests
- Request Management: Approve or reject student requests
- Admin Notes: Add notes to requests during approval/rejection
- User Overview: View all registered users
- Firebase Backend: Firestore database for scalable data storage
- JWT Authentication: Secure token-based authentication
- RESTful API: Well-structured API endpoints
- Responsive Design: Mobile-friendly interface
- Real-time Updates: Instant status updates
- HTML5
- CSS3
- JavaScript (ES6+)
- jsPDF (PDF generation)
- Node.js
- Express.js
- Firebase Admin SDK
- Firestore Database
- JWT (JSON Web Tokens)
- bcrypt (Password hashing)
- Express Validator
- CORS
Bonafide-Generator/
βββ config/
β βββ firebase.js # Firebase Admin SDK configuration
β βββ createAdmin.js # Default admin user creation
βββ middleware/
β βββ auth.js # JWT authentication middleware
βββ models/
β βββ User.js # User model (Firestore)
β βββ BonafideRequest.js # Bonafide request model (Firestore)
βββ routes/
β βββ auth.js # Authentication routes
β βββ bonafide.js # Bonafide request routes
βββ services/
β βββ firestore.js # Firestore service layer
βββ public/
β βββ index.html # Landing page
β βββ login.html # Login page
β βββ register.html # Registration page
β βββ dashboard.html # User dashboard
β βββ admin.html # Admin dashboard
β βββ app.js # PDF generation logic
β βββ firebase-config.js # Firebase client configuration
βββ server.js # Main server file
βββ package.json # Dependencies
βββ firebase.json # Firebase hosting config
βββ .firebaserc # Firebase project config
βββ firestore.rules # Firestore security rules
βββ .env # Environment variables
- Node.js (v14 or higher)
- npm or yarn
- Firebase account
- Firebase CLI
-
Clone the repository
git clone https://github.com/bnithin215/Bonafide-Generator.git cd Bonafide-Generator -
Install dependencies
npm install
-
Set up environment variables
Create a
.envfile in the root directory:# Server Configuration PORT=5000 NODE_ENV=development # Firebase Configuration FIREBASE_API_KEY=your-api-key FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com FIREBASE_PROJECT_ID=your-project-id FIREBASE_STORAGE_BUCKET=your-project.firebasestorage.app FIREBASE_MESSAGING_SENDER_ID=your-sender-id FIREBASE_APP_ID=your-app-id FIREBASE_MEASUREMENT_ID=your-measurement-id # JWT Configuration JWT_SECRET=your-super-secret-jwt-key JWT_EXPIRE=7d # Admin Credentials ADMIN_EMAIL=admin@tkrcollege.edu ADMIN_PASSWORD=admin123
-
Set up Firebase
- Create a Firebase project at Firebase Console
- Enable Firestore Database
- Enable Authentication (Email/Password)
- Copy your Firebase config to the
.envfile - (Optional) Download service account key for production
-
Start the development server
npm start
The application will be available at
http://localhost:5000
On first run, a default admin user is created:
- Email: admin@tkrcollege.edu
- Password: admin123
POST /api/auth/register- Register new userPOST /api/auth/login- User loginGET /api/auth/me- Get current user (Protected)
POST /api/bonafide/request- Submit bonafide request (Protected)GET /api/bonafide/my-requests- Get user's requests (Protected)GET /api/bonafide/all-requests- Get all requests (Admin only)GET /api/bonafide/request/:id- Get single request (Protected)PUT /api/bonafide/approve/:id- Approve request (Admin only)PUT /api/bonafide/reject/:id- Reject request (Admin only)DELETE /api/bonafide/request/:id- Delete request (Protected)
-
Login to Firebase
firebase login
-
Initialize Firebase (if not already done)
firebase init
- Select Hosting and Firestore
- Choose your Firebase project
- Use default settings
-
Deploy
firebase deploy
For detailed deployment instructions, see DEPLOYMENT.md
{
id: "auto-generated",
name: "string",
email: "string",
password: "hashed-string",
role: "user" | "admin",
rollNumber: "string",
department: "string",
course: "string",
fatherName: "string",
dateOfBirth: "string",
createdAt: "timestamp",
updatedAt: "timestamp"
}{
id: "auto-generated",
userId: "user-id",
studentName: "string",
rollNumber: "string",
fatherName: "string",
department: "string",
course: "string",
academicYear: "string",
dateOfBirth: "string",
purpose: "string",
conduct: "string",
status: "pending" | "approved" | "rejected",
adminNotes: "string",
approvedBy: "admin-id",
approvedAt: "timestamp",
pdfGenerated: boolean,
createdAt: "timestamp",
updatedAt: "timestamp"
}- Passwords are hashed using bcrypt
- JWT tokens for authentication
- Firestore security rules for data access control
- Input validation using express-validator
- CORS enabled for controlled access
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
Nithin B
- GitHub: @bnithin215
- TKR College of Engineering & Technology
- Firebase for backend infrastructure
- Express.js community
- All contributors
For support, email admin@tkrcollege.edu or create an issue in the repository.
Made with β€οΈ for TKR College of Engineering & Technology