A comprehensive notice board application for educational institutions with role-based access control (Admin, Staff, and Students).
- Single Login Page: Users select their role and sign in
- Student Registration: Students can create accounts
- Predefined Accounts: Staff and admin accounts are created by administrators
- JWT-based Authentication: Secure token-based authentication
- Admin: Full system access - manage notices, approve/reject submissions, manage staff accounts
- Staff: Create and edit notices, submit for approval
- Students: View approved notices, search and filter, download attachments
- Create & Edit: Staff can create and edit notices
- Approval Workflow: All staff submissions require admin approval
- File Attachments: Support for PDF and other file types via Cloudinary
- Categories: Organized notice categories (Academic, Events, Sports, etc.)
- Search & Filter: Advanced search and filtering capabilities
- Node.js with Express.js
- MongoDB with Mongoose ODM
- JWT for authentication
- Cloudinary for file storage
- Multer for file uploads
- bcrypt for password hashing
- Next.js 14 with TypeScript
- Tailwind CSS for styling
- Axios for API calls
- React Context for state management
{
name: String (required),
email: String (required, unique),
password: String (required, hashed),
studentId: String (optional, unique),
department: String (optional),
roles: [String] (enum: ['admin', 'staff', 'student']),
timestamps: true
}{
title: String (required),
description: String (required),
category: String (enum: predefined categories),
fileUrl: String (Cloudinary URL),
filePublicId: String (Cloudinary public ID),
status: String (enum: ['draft', 'pending_approval', 'published', 'rejected']),
createdBy: ObjectId (ref: User),
approvedBy: ObjectId (ref: User, optional),
approvedAt: Date (optional),
rejectionReason: String (optional),
timestamps: true
}- Node.js (v16 or higher)
- MongoDB (local or Atlas)
- Cloudinary account
git clone <repository-url>
cd campusBulletincd backend
# Install dependencies
npm install
# Create .env file
cp .env.example .env
# Edit .env with your configuration
# Start the server
npm run devcd frontend
# Install dependencies
npm install
# Create .env.local file
echo "NEXT_PUBLIC_API_URL=http://localhost:5000/api" > .env.local
# Start the development server
npm run devcd backend
# Seed initial users (admin, staff, test student)
npm run seedMONGODB_URI=mongodb://localhost:27017/campusBulletin
JWT_SECRET=your_jwt_secret_key_here
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
PORT=5000
NODE_ENV=developmentNEXT_PUBLIC_API_URL=http://localhost:5000/apiAfter running the seed script, you can use these test accounts:
- Admin: admin@campus.edu / admin123
- Staff: staff@campus.edu / staff123
- Student: student@campus.edu / student123
POST /api/auth/admin/login- Admin loginPOST /api/auth/staff/login- Staff loginPOST /api/auth/student/login- Student loginPOST /api/auth/student/register- Student registrationGET /api/auth/me- Get current user profile
GET /api/notices- Get notices (with role-based filtering)GET /api/notices/:id- Get specific noticePOST /api/notices- Create notice (Staff/Admin only)PUT /api/notices/:id- Update notice (Staff own/Admin)DELETE /api/notices/:id- Delete notice (Admin only)PATCH /api/notices/:id/submit- Submit for approval (Staff)PATCH /api/notices/:id/approve- Approve notice (Admin)PATCH /api/notices/:id/reject- Reject notice (Admin)
- Staff creates notice β Status: DRAFT
- Staff submits for approval β Status: PENDING_APPROVAL
- Admin reviews β Status: PUBLISHED or REJECTED
- Students view β Only PUBLISHED notices are visible
campusBulletin/
βββ backend/
β βββ auth/ # Role definitions and permissions
β βββ config/ # Database and Cloudinary config
β βββ controllers/ # Business logic
β βββ middleware/ # Auth and role middleware
β βββ models/ # MongoDB schemas
β βββ routes/ # API endpoints
β βββ scripts/ # Database seeding
β βββ server.js # Main server file
βββ frontend/
β βββ src/
β β βββ app/ # Next.js app router
β β βββ components/ # Reusable components
β β βββ contexts/ # React contexts
β β βββ lib/ # Utilities and API
β β βββ types/ # TypeScript types
β βββ package.json
βββ README.md
# Backend (Terminal 1)
cd backend
npm run dev
# Frontend (Terminal 2)
cd frontend
npm run devcd backend
npm run seed- Password Hashing: bcrypt with salt rounds
- JWT Tokens: Secure authentication
- Role-Based Access: Granular permissions
- Input Validation: Server-side validation
- File Upload Security: Type and size restrictions
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For support and questions, please open an issue in the repository.