Skip to content

Repository files navigation

Nazamly πŸŽ“

Node.js Express MongoDB React Vite TailwindCSS

A comprehensive MERN Stack University Campus Management System
Built for the German University in Cairo (GUC)


πŸ“‹ Table of Contents


🎯 Overview

Nazamly is a full-stack web application designed to streamline campus activities and event management at the German University in Cairo. The platform serves multiple user types including students, staff, professors, vendors, and administrators, providing a centralized hub for:

  • πŸ“… Event Management - Create, discover, and register for university events
  • πŸ‹οΈ Gym Sessions - Schedule and book gym classes
  • πŸ€ Sports Courts - Reserve basketball, tennis, and football courts
  • πŸͺ Vendor Services - Booth applications for bazaars and loyalty programs
  • πŸ“Š Polling System - Create and participate in campus polls
  • πŸ’³ Integrated Payments - Wallet system with Stripe integration

✨ Features

πŸŽͺ Events Module

  • Multiple event types: Workshops, Trips, Bazaars, Conferences
  • Event registration with payment support (Wallet/Stripe)
  • QR code generation for external visitors
  • Event ratings, comments, and favorites
  • Attendance certificates (PDF generation)
  • Excel export of registrations

πŸ‹οΈ Gym Module

  • Gym session scheduling and management
  • Multiple session types
  • User registration and capacity management

🏟️ Courts Module

  • Sports court management (Basketball, Tennis, Football)
  • Real-time slot availability checking
  • Court reservation system

πŸͺ Vendor Module

  • Booth applications for bazaars
  • Document uploads (tax cards, company logos)
  • Loyalty program applications
  • Payment processing for booth fees

πŸ“Š Polling & Voting

  • Poll creation by Events Office
  • Secure voting system
  • Results visualization

πŸ’° Wallet & Payments

  • User wallet balance management
  • Stripe integration for card payments
  • Transaction history
  • Refund processing (14-day policy)

πŸ”” Notifications

  • In-app notification system
  • Event reminders via cron jobs
  • Email notifications

πŸ“ˆ Reporting

  • Attendance reports
  • Sales analytics
  • Export to Excel functionality

πŸ› οΈ Tech Stack

Backend

Technology Version Purpose
Node.js 16.x+ Runtime environment
Express.js 5.1.0 Web framework
MongoDB 7.0.0 Database (via Mongoose 8.19.0)
JWT 9.0.2 Authentication
bcrypt 6.0.0 Password hashing
Cloudinary 1.41.3 File/image storage
Stripe 20.0.0 Payment processing
nodemailer 6.10.1 Email service
qrcode 1.5.4 QR code generation
pdfkit 0.17.2 PDF generation (certificates)
xlsx 0.18.5 Excel export
node-cron 4.2.1 Scheduled tasks
helmet 7.1.0 Security headers
Joi 17.11.0 Validation

Frontend

Technology Version Purpose
React 18.2.0 UI library
Vite 7.1.7 Build tool & dev server
React Router DOM 6.20.1 Client-side routing
TailwindCSS 3.4.18 Utility-first styling
Axios 1.6.2 HTTP client
Framer Motion 10.18.0 Animations
React Hook Form 7.49.2 Form handling
Zod 3.22.4 Schema validation
Stripe React 5.4.1 Payment UI components
Leaflet 1.9.4 Interactive maps
Lucide React - Icon library

πŸ‘₯ User Roles

Role Description Email Domain
Student University students @student.guc.edu.eg
Staff University staff members @guc.edu.eg
TA Teaching assistants Admin assigned
Professor Professors, can create workshops Admin assigned
Vendor External companies for bazaars Any email
Admin System administrators Admin created
EventOffice Events office staff Admin assigned

πŸ“ Project Structure

Nazamly/
β”œβ”€β”€ πŸ“„ package.json              # Root workspace configuration
β”œβ”€β”€ πŸ“„ README.md                 # Project documentation
β”œβ”€β”€ πŸ“„ ATTENDANCE_REPORT_FEATURE.md
β”‚
β”œβ”€β”€ πŸ“‚ backend/
β”‚   β”œβ”€β”€ πŸ“„ package.json
β”‚   β”œβ”€β”€ πŸ“„ README.md             # Backend setup guide
β”‚   β”œβ”€β”€ πŸ“„ PAYMENT_SYSTEM_SUMMARY.md
β”‚   β”œβ”€β”€ πŸ“„ VENDOR_DOCUMENTS_SETUP.md
β”‚   β”œβ”€β”€ πŸ“„ CLOUDINARY_SETUP.md
β”‚   β”œβ”€β”€ πŸ“‚ docs/
β”‚   β”‚   β”œβ”€β”€ API.md               # Complete API documentation
β”‚   β”‚   β”œβ”€β”€ DATA_MODEL.md        # Database schema docs
β”‚   β”‚   └── VENDOR_PAYMENT_FLOW.md
β”‚   β”œβ”€β”€ πŸ“‚ src/
β”‚   β”‚   β”œβ”€β”€ app.js               # Express app configuration
β”‚   β”‚   β”œβ”€β”€ server.js            # Server entry point
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ config/           # Database, Cloudinary, validation
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ constants/        # Roles, statuses, schedules
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ controllers/      # Route handlers (18 controllers)
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ middleware/       # Auth & upload middleware
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ models/           # Mongoose schemas (17 models)
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ routes/           # API route definitions
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ services/         # Business logic layer
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ validators/       # Input validation schemas
β”‚   β”‚   └── πŸ“‚ utils/            # Utility functions
β”‚   └── πŸ“‚ tools/                # Admin & seed scripts
β”‚
└── πŸ“‚ frontend/
    β”œβ”€β”€ πŸ“„ package.json
    β”œβ”€β”€ πŸ“„ index.html
    β”œβ”€β”€ πŸ“„ vite.config.js
    β”œβ”€β”€ πŸ“„ tailwind.config.js
    β”œβ”€β”€ πŸ“‚ docs/                 # Frontend theming guides
    β”œβ”€β”€ πŸ“‚ public/               # Static assets
    └── πŸ“‚ src/
        β”œβ”€β”€ App.jsx              # Main app component
        β”œβ”€β”€ main.jsx             # Entry point
        β”œβ”€β”€ index.css            # Global styles (Tailwind)
        β”œβ”€β”€ πŸ“‚ components/       # Reusable UI components
        β”‚   β”œβ”€β”€ Admin/
        β”‚   β”œβ”€β”€ auth/
        β”‚   β”œβ”€β”€ events/
        β”‚   β”œβ”€β”€ EventsOffice/
        β”‚   └── landing/
        β”œβ”€β”€ πŸ“‚ pages/            # Page components
        β”‚   β”œβ”€β”€ Admin/
        β”‚   β”œβ”€β”€ Events/
        β”‚   β”œβ”€β”€ EventsOffice/
        β”‚   β”œβ”€β”€ Login/
        β”‚   └── Signup/
        β”œβ”€β”€ πŸ“‚ services/         # API service layer
        β”œβ”€β”€ πŸ“‚ hooks/            # Custom React hooks
        └── πŸ“‚ utils/            # Utility functions

πŸš€ Getting Started

Prerequisites

  • Node.js 16.x or higher
  • MongoDB 5.x+ (local installation or MongoDB Atlas)
  • npm or yarn package manager
  • Git

Installation

  1. Clone the repository

    git clone https://github.com/Advanced-Computer-Lab-2025/Nazamly.git
    cd Nazamly
  2. Install all dependencies

    # Install root, frontend, and backend dependencies
    npm run install:all

    Or install manually:

    npm install
    cd frontend && npm install
    cd ../backend && npm install
  3. Set up environment variables

    Create a .env file in the backend/ directory (see Environment Variables)

  4. Start MongoDB

    Ensure MongoDB is running locally or configure your MongoDB Atlas connection string

  5. Run the application

    # Development mode (runs both backend and frontend)
    npm run dev

Running Separately

# Backend only (runs on port 5000)
npm run dev:backend

# Frontend only (runs on port 5173)
npm run dev:frontend

Production Build

# Build frontend for production
npm run build

# Start production server
npm run start:backend

πŸ” Environment Variables

Create a .env file in the backend/ directory with the following variables:

# ═══════════════════════════════════════════════════════════════
# DATABASE
# ═══════════════════════════════════════════════════════════════
MONGO_URL=mongodb+srv://<username>:<password>@cluster.mongodb.net/nazamly

# ═══════════════════════════════════════════════════════════════
# SERVER
# ═══════════════════════════════════════════════════════════════
PORT=5000
NODE_ENV=development
CLIENT_URL=http://localhost:5173

# ═══════════════════════════════════════════════════════════════
# AUTHENTICATION (JWT)
# ═══════════════════════════════════════════════════════════════
JWT_SECRET=your-super-secret-jwt-key
JWT_EXPIRES_IN=1h
JWT_REMEMBER_ME_EXPIRES_IN=30d

# ═══════════════════════════════════════════════════════════════
# EMAIL VALIDATION
# ═══════════════════════════════════════════════════════════════
PASSWORD_MIN_LENGTH=8
PASSWORD_MAX_LENGTH=128
STUDENT_EMAIL_DOMAIN=@student.guc.edu.eg
STAFF_EMAIL_DOMAIN=@guc.edu.eg

# ═══════════════════════════════════════════════════════════════
# CLOUDINARY (File Uploads)
# ═══════════════════════════════════════════════════════════════
CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret
MAX_FILE_SIZE_MB=5

# ═══════════════════════════════════════════════════════════════
# STRIPE (Payments)
# ═══════════════════════════════════════════════════════════════
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_PUBLISHABLE_KEY=pk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxx
STRIPE_CURRENCY=egp

# ═══════════════════════════════════════════════════════════════
# RATE LIMITING
# ═══════════════════════════════════════════════════════════════
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100

# ═══════════════════════════════════════════════════════════════
# EMAIL (SMTP) - Optional
# ═══════════════════════════════════════════════════════════════
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password

πŸ”Œ API Overview

The backend exposes a RESTful API. Here's an overview of the main endpoint categories:

Authentication /api/auth

Method Endpoint Description
POST /signup User registration
POST /login User login
POST /logout User logout
GET /verify-email/:token Email verification

Events /api/events

Method Endpoint Description
GET / Get all events
POST / Create event
GET /:eventId Get event by ID
PATCH /:eventId/archive Archive event
POST /:eventId/qr Generate QR code
GET /:eventId/export Export registrations

Registrations /api/registrations

Method Endpoint Description
POST /:eventId/register Register for event
DELETE /:eventId/cancel Cancel registration
GET /my-registrations User's registrations
POST /:eventId/rate Rate an event

Gym /api/gym

Method Endpoint Description
GET /sessions Get gym sessions
POST /sessions Create session
POST /sessions/:sessionId/register Register for session

Courts /api/courts

Method Endpoint Description
GET / Get all courts
GET /:courtId/available-slots Get available slots
POST /:courtId/reserve Reserve court

Vendor /api/vendors

Method Endpoint Description
GET /bazaars Get upcoming bazaars
POST /applications Apply for booth
POST /loyalty-program/apply Apply to loyalty program

Admin /api/admin

Method Endpoint Description
GET /signup-requests View signup requests
PATCH /signup-requests/:id Approve/reject requests
PATCH /users/:userId/block Block/unblock user

Payments /api/payments

Method Endpoint Description
POST /stripe/create-intent Create payment intent
POST /stripe/finalize Finalize payment

πŸ“– For complete API documentation, see backend/docs/API.md


πŸ“š Documentation

Document Location Description
Backend README backend/README.md Backend setup guide
API Documentation backend/docs/API.md Complete API reference
Data Models backend/docs/DATA_MODEL.md MongoDB schema docs
Vendor Payment Flow backend/docs/VENDOR_PAYMENT_FLOW.md Payment workflow
Payment System backend/PAYMENT_SYSTEM_SUMMARY.md Payment implementation
Cloudinary Setup backend/CLOUDINARY_SETUP.md Image upload config
Frontend Theming frontend/docs/ Theme and font guides

πŸ“œ Scripts

Root Level

Script Command Description
dev npm run dev Run both backend and frontend
dev:backend npm run dev:backend Run backend with nodemon
dev:frontend npm run dev:frontend Run Vite dev server
build npm run build Build frontend for production
install:all npm run install:all Install all dependencies

Backend Tools

# Create admin user
node backend/tools/create_admin_user.js

# Create test user
node backend/tools/create_test_user.js

# Seed courts data
node backend/tools/seed_courts.js

πŸ‘¨β€πŸ’» Contributors

This project was developed as part of the Advanced Computer Lab course at the German University in Cairo (GUC).


πŸ“„ License

This project is developed for educational purposes as part of the GUC curriculum.


Made with ❀️ at German University in Cairo

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages