A comprehensive full-stack web application for managing university campus activities, events, vendor management, and facility bookings. Built with Express.js, MongoDB, and React for the Habiba GUC university community.
- Overview
- Key Features
- Technology Stack
- Project Structure
- Prerequisites
- Installation
- Environment Setup
- Running the Application
- API Documentation
- Frontend Features
- Database Models
- Authentication & Authorization
- Design System
- Development Guidelines
- Testing
- Deployment
- Troubleshooting
- Contributing
- Team
Brains704 is a sophisticated campus management platform designed to streamline operations for GUC (German University in Cairo). The system provides integrated solutions for:
- Event Management - Create, manage, and track university events
- Workshop Management - Organize workshops with participant tracking
- Vendor Management - Handle vendor applications, documents, and loyalty programs
- Facility Booking - Manage gym sessions, courts, and other facilities
- Polling System - Enable community voting on important decisions
- Document Management - Handle uploads, verification, and storage
- User Registration - Manage student, staff, and vendor registrations
- Bazaar Management - Coordinate bazaar events with QR code tracking
- Multi-role authentication (Student, Staff, TA, Professor, Vendor, Events Office, Admin)
- JWT-based session management with refresh tokens
- Role-based access control (RBAC)
- User profile management and updates
- Create and manage university events with capacity tracking
- Workshop scheduling with automatic participant capacity calculation
- Real-time availability status
- Event ratings and feedback system
- Participant registration and attendance tracking
- Vendor application and verification workflow
- Tax card and logo document uploads
- Loyalty program enrollment and management
- Document verification by Events Office
- Vendor performance tracking
- Gym Sessions - Schedule, edit, and cancel with refund management
- Courts - Book facility courts with availability checking
- Bazaar Management - Coordinate vendor booths with QR code attendance tracking
- Real-time capacity updates
- Events Office creates vendor selection polls
- Students, Staff, TAs, and Professors vote on options
- Real-time vote counting with progress visualization
- Leading vendor highlighting
- Poll status tracking
- Secure document upload and storage
- Multi-file support (images, PDFs, Excel)
- Document verification workflow
- Download and access tracking
- Stripe payment processing
- Transaction history tracking
- Payment status monitoring
- Email notifications for event updates
- QR code delivery via email
- Automated alerts for registrations
- SendGrid integration for reliability
Express.js 4.18.2 - REST API framework
MongoDB 6.3.0 - NoSQL database
Mongoose 6.11.2 - MongoDB ODM
Node.js 18+ - JavaScript runtime
JWT 9.0.2 - Authentication
Stripe 19.3.1 - Payment processing
SendGrid 8.1.6 - Email service
Multer 1.4.5 - File uploads
QRCode 1.5.3 - QR code generation
Nodemailer 7.0.9 - Email sending
React 19.2.0 - UI framework
React Router 7.9.3 - Client-side routing
Tailwind CSS 3.4.18 - Utility-first CSS
Lucide React 0.487 - Icon library
Heroicons 2.2.0 - Premium icons
Chart.js 4.5.1 - Data visualization
Stripe React 5.4.0 - Payment UI
Axios 1.12.2 - HTTP client
Zustand 5.0.8 - State management
React Hot Toast 2.6.0 - Toast notifications
Sonner 2.0.3 - Modern toasts
Brains704/
βββ backend/
β βββ config/
β β βββ db.js # Database configuration
β β βββ multerConfig.js # File upload configuration
β βββ controllers/
β β βββ authController.js # Authentication logic
β β βββ eventController.js # Event management
β β βββ PollController.js # Polling system
β β βββ GymController.js # Facility management
β β βββ DocumentController.js # Document handling
β β βββ WorkshopParticipantController.js
β β βββ [other controllers]
β βββ models/
β β βββ User.js # User schema
β β βββ Event.js # Event schema
β β βββ Workshop.js # Workshop schema
β β βββ Poll.js # Poll schema
β β βββ Vendor.js # Vendor schema
β β βββ Document.js # Document schema
β β βββ [other models]
β βββ routes/
β β βββ authRoutes.js
β β βββ eventRoutes.js
β β βββ PollRoutes.js
β β βββ GymRoutes.js
β β βββ [other routes]
β βββ middleware/
β β βββ protect.js # JWT verification
β β βββ requireRole.js # Role checking
β β βββ requireEventsOffice.js
β βββ services/
β β βββ qrCodeService.js # QR code generation
β βββ uploads/ # File storage directory
β βββ app.js # Express app setup
β βββ package.json
β βββ src/server.js # Server entry point
β
βββ frontend/
β βββ public/
β βββ src/
β β βββ components/
β β β βββ events-office/ # EO-specific components
β β β β βββ BoothSetupPoll.jsx
β β β β βββ GymSessionEditor.jsx
β β β β βββ GymSessionCancellation.jsx
β β β βββ LoadingEmptyStates.jsx
β β β βββ [other components]
β β βββ pages/
β β β βββ EventRegistration.jsx
β β β βββ LoginPage.jsx
β β β βββ GymSchedule.jsx
β β β βββ [other pages]
β β βββ styles/
β β β βββ EOdesignSystem.js # Design tokens & theme
β β βββ services/
β β β βββ api.js # API client
β β βββ hooks/
β β βββ stores/ # Zustand stores
β β βββ App.jsx
β β βββ index.js
β βββ package.json
β βββ tailwind.config.js
β
βββ package.json # Root dependencies
βββ README.md # This file
βββ PROJECT_REQUIREMENTS.xlsx # Specifications
Before you begin, ensure you have the following installed:
- Node.js 18.0 or higher (Download)
- npm 9.0 or higher (comes with Node.js)
- MongoDB 5.0+ (Download or use MongoDB Atlas)
- Git for version control
- A code editor (VS Code recommended)
- Postman (optional, for API testing)
- OS: Windows, macOS, or Linux
- RAM: 4GB minimum
- Disk Space: 2GB minimum
- Internet Connection: Required for npm packages and external APIs
git clone https://github.com/yourusername/Brains704.git
cd Brains704cd backend
npm installcd ../frontend
npm installcd ..
npm installCreate a .env file in the backend/ directory:
# Server Configuration
PORT=5001
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/brains704
# OR for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/brains704
# JWT Authentication
JWT_SECRET=your_super_secret_jwt_key_here_change_in_production
JWT_EXPIRE=7d
REFRESH_TOKEN_SECRET=your_refresh_token_secret_here
# Stripe Payment
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_PUBLIC_KEY=pk_test_your_stripe_public_key
# SendGrid Email
SENDGRID_API_KEY=your_sendgrid_api_key
# Email Configuration (Alternative to SendGrid)
EMAIL_SERVICE=gmail
EMAIL_USER=your-email@gmail.com
EMAIL_PASSWORD=your-app-password
# Google APIs (for calendar integration if needed)
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# File Upload
MAX_FILE_SIZE=5242880 # 5MB in bytes
UPLOAD_PATH=./uploads
# CORS
CORS_ORIGIN=http://localhost:3000Create a .env file in the frontend/ directory:
REACT_APP_API_URL=http://localhost:5001/api
REACT_APP_STRIPE_PUBLIC_KEY=pk_test_your_stripe_public_keyβ οΈ Never commit.envfiles - they contain sensitive information- π For production, use secure secret management tools (e.g., AWS Secrets Manager, HashiCorp Vault)
- π Generate strong JWT secrets: use
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))" - π§ For Gmail, enable "Less Secure App Access" or use App Passwords
- π³ Get Stripe keys from your Stripe Dashboard
cd backend
npm run devExpected output:
β
Server running on http://localhost:5001
β
MongoDB connected
cd frontend
npm startExpected output:
β
Compiled successfully!
Local: http://localhost:3000
On Your Network: http://192.168.x.x:3000
# Build frontend
cd frontend
npm run build
# Start backend in production
cd ../backend
NODE_ENV=production npm startTest that the server is running:
curl http://localhost:5001/api/health
# Response: { "ok": true }http://localhost:5001/api
All protected endpoints require a JWT token in the Authorization header:
Authorization: Bearer <your_jwt_token>
Include the user role header for role-based access:
x-role: <role> # student, staff, professor, vendor, events_office, admin
POST /auth/register # Register new user
POST /auth/login # User login
POST /auth/refresh-token # Refresh JWT token
POST /auth/logout # Logout user
GET /auth/me # Get current user
GET /events # List all events
POST /events # Create event (Admin/EO)
GET /events/:id # Get event details
PUT /events/:id # Update event (Admin/EO)
DELETE /events/:id # Delete event (Admin/EO)
GET /events/:id/registrations # Get event registrations
POST /events/:id/register # Register for event
GET /eo/workshops # List workshops
POST /eo/workshops # Create workshop
GET /eo/workshops/:id # Get workshop details
PUT /eo/workshops/:id # Update workshop
DELETE /eo/workshops/:id # Delete workshop
GET /workshops/:workshopId/participants # Get participants
GET /polls # List all polls
POST /polls # Create poll (EO only)
GET /polls/:pollId # Get poll details
POST /polls/:pollId/vote # Vote on poll
PUT /polls/:pollId # Update poll status
DELETE /polls/:pollId # Delete poll (EO)
GET /gym/sessions # List sessions
POST /gym/sessions # Create session (EO)
GET /gym/sessions/:id # Get session details
PUT /gym/sessions/:id # Update session
DELETE /gym/sessions/:id # Cancel session
POST /gym/sessions/:id/register # Register for session
GET /vendors # List vendors
POST /vendors # Register as vendor
GET /vendors/:id # Get vendor details
PUT /vendors/:id # Update vendor profile
POST /vendors/:id/documents # Upload documents
GET /vendors/:id/documents # Get vendor documents
GET /documents # List documents (Admin/EO)
POST /documents # Upload document
GET /documents/:id # Download document
PUT /documents/:id/verify # Verify document (EO)
PUT /documents/:id/reject # Reject document (EO)
For complete API reference, see API_TESTING_GUIDE.md
The frontend includes a comprehensive design system (EOdesignSystem.js) featuring:
Color Palette:
- π’ Mughal Green (#366B2B) - Primary actions
- π΅ Prussian Blue (#103A57) - Main text and headings
- π¦ Teal (#307B8E) - Secondary accents
- β Citron (#E8F442) - Alerts and urgent actions
- π Tyrian Purple (#6F2DA8) - Premium highlights
Components:
- Buttons (primary, secondary, danger, ghost variants)
- Form inputs with validation states
- Cards with shadows and hover effects
- Alert components (success, error, warning, info)
- Badges for status indicators
- Loading skeletons
- Empty states
Animations:
- Smooth transitions and fade effects
- Hover lift animations
- Slide and scale transforms
- Loading spinners
| Page | Route | Purpose |
|---|---|---|
| Login | /login |
User authentication |
| Sign Up | /signup |
User registration |
| Dashboard | /dashboard |
Main hub for user |
| Events | /events |
Browse and register for events |
| Workshops | /workshops |
Workshop management |
| Gym Schedule | /gym-schedule |
Facility booking |
| Polls | /polls |
Voting interface |
| Vendor Dashboard | /vendor/dashboard |
Vendor management |
| Events Office | /events-office |
Admin controls |
{
firstName: String,
lastName: String,
email: String (unique),
password: String (hashed),
role: Enum ['student', 'staff', 'professor', 'vendor', 'events_office', 'admin'],
studentOrStaffId: String,
phone: String,
dateOfBirth: Date,
department: String,
createdAt: Date,
updatedAt: Date
}{
title: String,
description: String,
startDate: Date,
endDate: Date,
location: String,
capacity: Number,
registeredCount: Number,
status: Enum ['upcoming', 'ongoing', 'completed', 'cancelled'],
createdBy: ObjectId (User),
createdAt: Date,
updatedAt: Date
}{
title: String,
description: String,
date: Date,
location: String,
professor: ObjectId (User),
totalCapacity: Number,
registeredCount: Number,
remainingSpots: Number (virtual),
participants: [{
userId: ObjectId,
status: Enum ['registered', 'attended'],
registeredAt: Date
}],
createdAt: Date
}{
title: String,
description: String,
pollType: String,
options: [{
optionId: ObjectId,
optionText: String,
votes: Number
}],
status: Enum ['active', 'closed'],
votes: [{
userId: ObjectId,
selectedOption: ObjectId,
votedAt: Date
}],
startDate: Date,
endDate: Date,
createdBy: ObjectId,
createdAt: Date
}For complete model documentation, see the backend/models/ directory.
- Login: User sends credentials β Server validates β Returns JWT + Refresh Token
- Protected Routes: Client includes JWT in
Authorization: Bearer <token>header - Token Expiration: When JWT expires, client uses refresh token to get new JWT
- Logout: Server invalidates token and refresh token
| Role | Permissions |
|---|---|
| Student | Register for events/workshops, vote on polls, book facilities |
| Staff | All student permissions + create events |
| Professor | Create/manage workshops, view participant attendance |
| Vendor | Manage vendor profile, upload documents, view loyalty program |
| Events Office | Create/manage all events, verify documents, create polls |
| Admin | Full system access, manage users, view analytics |
- protect.js - Verifies JWT and extracts user info
- requireRole.js - Checks if user has required role
- requireEventsOffice.js - Events Office specific checks
Import tokens in your components:
import {
EOcolors,
EOshadows,
EObuttonStyles,
EOformStyles,
EOcardStyles,
EOalertStyles,
EObadgeStyles,
EOradius,
EOtransitions,
getCitronGlowEffect,
getTyrianGlowEffect,
} from '../styles/EOdesignSystem';// Button with primary style
<button style={EObuttonStyles.primary}>
Click Me
</button>
// Card with shadow and border
<div style={{
...EOcardStyles.base,
padding: '2rem',
borderRadius: EOradius.lg,
boxShadow: EOshadows.lg,
}}>
Content
</div>
// Alert with success styling
<div style={EOalertStyles.success}>
Operation completed successfully!
</div>- Use ES6+ syntax (arrow functions, destructuring, async/await)
- Follow RESTful API design principles
- Use camelCase for variables and functions
- Use PascalCase for components and classes
- Add JSDoc comments for functions
- Keep files under 300 lines when possible
// Variables and functions
const userName = "John";
const calculateTotal = () => {};
// Components
const UserProfile = () => {};
// Constants
const MAX_FILE_SIZE = 5242880;
// Database fields
const firstName = ""; // in schemascomponents/
βββ events-office/ # EO-specific components
βββ common/ # Reusable components
βββ [feature]/ # Feature-specific components
pages/
βββ [role]/ # Role-specific pages
βββ [feature].jsx
services/
βββ api.js # API client
stores/
βββ [feature].js # Zustand stores
- Create feature branch:
git checkout -b feature/feature-name - Commit with clear messages:
git commit -m "Add feature X" - Push to remote:
git push origin feature/feature-name - Create Pull Request with description
Use Postman or curl to test API endpoints:
# Test health endpoint
curl http://localhost:5001/api/health
# Test with authentication
curl -H "Authorization: Bearer <token>" \
-H "x-role: student" \
http://localhost:5001/api/eventsFor comprehensive testing guide, see POSTMAN_TESTING_GUIDE.md
cd frontend
npm test- User registration and login
- Event creation and registration
- Workshop participant tracking
- Poll voting functionality
- Document upload and verification
- Gym session booking and cancellation
- Vendor dashboard operations
- Payment processing (Stripe)
- Email notifications
- Responsive design on mobile/tablet/desktop
# Install Heroku CLI
heroku login
# Create Heroku app
heroku create brains704-backend
# Set environment variables
heroku config:set JWT_SECRET=<your_secret> \
MONGODB_URI=<your_mongodb_uri> \
STRIPE_SECRET_KEY=<your_key>
# Deploy
git push heroku main# Install Vercel CLI
npm i -g vercel
# Deploy
cd frontend
vercel- Provision a server (AWS EC2, DigitalOcean, etc.)
- Install Node.js and MongoDB
- Clone repository and install dependencies
- Configure environment variables
- Set up reverse proxy (Nginx)
- Enable HTTPS with Let's Encrypt
- Set up PM2 for process management
# Using PM2
npm install -g pm2
pm2 start backend/src/server.js --name "brains704-api"
pm2 save
pm2 startupError: Failed to connect to MongoDB
Solution:
- Ensure MongoDB is running:
mongod - Check
MONGODB_URIin.env - Verify network connectivity to MongoDB Atlas (if using cloud)
- Check firewall rules
Error: Invalid token
Solution:
- Ensure
JWT_SECRETis set correctly - Check token hasn't expired
- Verify token format in Authorization header
- Clear browser localStorage and re-login
Access to XMLHttpRequest blocked by CORS policy
Solution:
- Check
CORS_ORIGINmatches frontend URL in.env - Verify backend includes CORS headers
- Restart backend server after changing
.env
Error: Multer configuration error
Solution:
- Create upload directories:
mkdir -p uploads/{documents,vendor-documents} - Check file permissions:
chmod -R 755 uploads - Verify
MAX_FILE_SIZEin.env - Check file type is allowed
Error: SendGrid authentication failed
Solution:
- Verify
SENDGRID_API_KEYis correct - Check email service configuration
- Review SendGrid dashboard for issues
- Test with development email first
Enable detailed logging:
// Backend
process.env.DEBUG = 'brains704:*';
// Frontend
localStorage.setItem('debug', 'brains704:*');We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Code follows style guidelines
- Tests are passing
- No console errors or warnings
- Documentation is updated
- Commit messages are clear
Project: Brains704 - University Campus Management System Course: CSEN 704 - Project University: Habiba German University in Cairo (GUC) Semester: 7th - 2024/2025
- Development Team: Brains704
- Supervision: Course Instructors
This project is licensed under the ISC License - see the LICENSE file for details.
- SETUP_CHECKLIST.md - Initial setup guide
- API_TESTING_GUIDE.md - API reference
- POSTMAN_TESTING_GUIDE.md - Postman collection
- EVENTS_OFFICE_QUICK_START.md - EO features guide
- DESIGN_DOCUMENTATION.md - Design system
- Express.js Documentation
- MongoDB Documentation
- React Documentation
- Tailwind CSS Documentation
- JWT Guide
- Stripe Documentation
- Check the troubleshooting section above
- Review relevant documentation files
- Check GitHub Issues for similar problems
- Contact the development team
- β Multi-role user authentication and authorization
- β Event and workshop management system
- β Real-time capacity tracking
- β Polling and voting system
- β Vendor management with document verification
- β Facility booking (Gym, Courts, Bazaar)
- β Payment processing with Stripe
- β Email notification system with QR codes
- β Document management and storage
- β Responsive design with modern UI
- β Comprehensive API with role-based access
- β Production-ready deployment guide
| Metric | Count |
|---|---|
| Total Models | 19 |
| API Endpoints | 30+ |
| Frontend Components | 50+ |
| Lines of Backend Code | ~5000+ |
| Lines of Frontend Code | ~8000+ |
| Database Collections | 15 |
| User Roles | 6 |
| Features Implemented | 25+ |
# 1. Install dependencies
npm install
cd backend && npm install
cd ../frontend && npm install
# 2. Set up environment
# Create .env files in backend/ and frontend/
# 3. Start MongoDB
mongod
# 4. Run backend (Terminal 1)
cd backend && npm run dev
# 5. Run frontend (Terminal 2)
cd frontend && npm start
# 6. Access the application
# Frontend: http://localhost:3000
# Backend: http://localhost:5001/apiHappy coding! π
For questions or support, refer to the documentation files or contact the development team.