Skip to content

Latest commit

Β 

History

239 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌌 SFAC_HUB

A modern, full-stack MERN application for SFAC (School of Future Academy of Cebu) that provides comprehensive stock management, reservation handling, user management, and a student lost & found posting system with premium UX/UI design.A full-stack MERN application for SFAC that provides stock management, reservation handling, and a student lost & found posting system.


✨ Features

  • πŸ“¦ Stock Management β€” manage and track items in SFAC’s inventory

πŸŽ“ For Students & Teachers- πŸ“ Reservation System β€” students and staff can reserve items seamlessly

  • πŸ“¦ Stock Availability β€” Browse and search available items across multiple categories- πŸ” Lost & Found β€” students can post and browse lost & found items

  • πŸ“ Reservation System β€” Reserve items seamlessly with real-time availability tracking- πŸ” User Authentication β€” secure login & role-based access

  • πŸ” Lost & Found β€” Post and browse lost & found items with image support- 🌐 RESTful API (Express + MongoDB) β€” backend handles stock, reservations, and posts

  • πŸ“Š Personal Dashboard β€” Track reservations, view popular items, and access quick actions- ⚑ Frontend (React + Vite) β€” fast, modern UI with responsive design

  • 🎨 Modern UI/UX β€” Glassmorphism design with smooth animations and responsive layouts- πŸ“Š Real-time Updates β€” reservations and inventory sync instantly

  • πŸš€ Deployment Ready β€” easily deployed via Vercel and Node servers

πŸ‘¨β€πŸ’Ό For Staff

  • πŸŽ›οΈ Staff Panel β€” Dedicated control center for managing all reservations---

  • βœ… Reservation Management β€” View, filter, search, and mark reservations as collected

  • πŸ“ˆ Real-time Stats β€” Dashboard showing total reservations, pending items, and collected items## πŸ› οΈ Tech Stack

  • πŸ” Advanced Filtering β€” Filter by status, sort by date/user/item, dual view modes (cards/table)- MongoDB β€” database

  • πŸ“‹ Detailed Views β€” Comprehensive modal with user info, item details, and timeline- Express.js β€” backend framework

  • React β€” frontend library

πŸ‘‘ For Administrators- Node.js β€” runtime

  • πŸ›‘οΈ Admin Panel β€” Complete user management and system administration- TypeScript β€” safer development

  • πŸ‘₯ User Management β€” View all users with verification status indicators- CSS / Tailwind β€” styling

  • βœ“ User Verification β€” Verify user emails and ID documents

  • πŸ” Security Controls β€” Reset user passwords, delete accounts with confirmation---

  • πŸ” Advanced Search β€” Filter by role, verification status, search by name/email

  • πŸ“Š User Analytics β€” Track verified, partially verified, and unverified users## 🎯 Roadmap

  • βœ… Core stock + reservation system

πŸ” Security & Authentication- βœ… Lost & found module

  • πŸ”‘ JWT Authentication β€” Secure token-based authentication with automatic refresh- ⏳ Admin dashboard for inventory analytics

  • πŸ›‘οΈ Role-based Access Control β€” Admin, Staff, Teacher, and Student roles- ⏳ Notification system for reservations

  • πŸ“§ Email & ID Verification β€” Two-factor verification system- ⏳ File upload support (lost item images)

  • πŸ–ΌοΈ Cloudinary Integration β€” Secure image upload and storage for ID verification

  • πŸ”’ Protected Routes β€” Middleware-based authentication for all sensitive endpoints

⚑ Technical Features

  • 🌐 RESTful API β€” Clean, organized Express.js backend with MongoDB
  • πŸ”„ Real-time Updates β€” Socket.io integration for live data synchronization
  • πŸ“± Responsive Design β€” Mobile-first approach, works on all devices
  • 🎭 Modern CSS β€” Glassmorphism, gradients, animations, and smooth transitions
  • πŸš€ Performance Optimized β€” Built-in performance monitoring and optimization
  • 🌍 Production Ready β€” Deployed on Fly.io (backend) and Vercel (frontend)

πŸ› οΈ Tech Stack

Backend

  • Node.js β€” JavaScript runtime environment
  • Express.js β€” Fast, unopinionated web framework
  • MongoDB β€” NoSQL database with Mongoose ODM
  • Socket.io β€” Real-time bidirectional communication
  • JWT β€” JSON Web Tokens for authentication
  • bcrypt β€” Password hashing and security
  • Cloudinary β€” Cloud-based image management
  • CORS β€” Cross-Origin Resource Sharing
  • Fly.io β€” Backend deployment platform

Frontend

  • React β€” Component-based UI library
  • TypeScript β€” Type-safe JavaScript
  • Vite β€” Next-generation frontend build tool
  • React Router β€” Client-side routing
  • Tailwind CSS β€” Utility-first CSS framework
  • Custom CSS β€” Glassmorphism and modern design patterns
  • Socket.io Client β€” Real-time client integration
  • React Loading Indicators β€” Elegant loading states
  • Vercel β€” Frontend deployment platform

Database Models

  • User Model β€” Authentication, roles, verification, ID storage
  • Product Model β€” Inventory items with categories and stock tracking
  • Reservation Model β€” Booking system with status management
  • User Post Model β€” Lost & found posts with images
  • User Token Model β€” Refresh token management

πŸ“ Project Structure

SFAC_HUB/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── cloudinary.js         # Cloudinary configuration
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ admin.controller.js   # Admin operations
β”‚   β”‚   β”œβ”€β”€ staff.controller.js   # Staff operations
β”‚   β”‚   β”œβ”€β”€ user.controller.js    # User authentication & profile
β”‚   β”‚   β”œβ”€β”€ product.controller.js # Product management
β”‚   β”‚   └── post.controller.js    # Lost & found posts
β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   β”œβ”€β”€ auth.admin.js         # Admin authentication
β”‚   β”‚   β”œβ”€β”€ auth.staff.js         # Staff authentication
β”‚   β”‚   β”œβ”€β”€ auth.login.js         # Login middleware
β”‚   β”‚   └── auth.token.js         # Token verification
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ user.model.js         # User schema
β”‚   β”‚   β”œβ”€β”€ product.model.js      # Product schema
β”‚   β”‚   β”œβ”€β”€ product.reservation.model.js  # Reservation schema
β”‚   β”‚   β”œβ”€β”€ user.post.model.js    # Post schema
β”‚   β”‚   └── user.token.model.js   # Token schema
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ admin.route.js        # Admin endpoints
β”‚   β”‚   β”œβ”€β”€ staff.route.js        # Staff endpoints
β”‚   β”‚   β”œβ”€β”€ user.route.js         # User endpoints
β”‚   β”‚   └── protected.route.js    # Protected endpoints
β”‚   β”œβ”€β”€ server.js                 # Express server & Socket.io
β”‚   β”œβ”€β”€ Dockerfile               # Container configuration
β”‚   └── fly.toml                 # Fly.io deployment config
β”‚
└── frontend/sfac-hub/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   β”œβ”€β”€ Header.tsx              # Reusable header with logout
    β”‚   β”‚   β”œβ”€β”€ Footer.tsx              # Reusable footer
    β”‚   β”‚   └── PerformanceDashboard.tsx # Performance monitoring
    β”‚   β”œβ”€β”€ pages/
    β”‚   β”‚   β”œβ”€β”€ LandingPage.tsx         # Public landing page
    β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx           # User dashboard
    β”‚   β”‚   β”œβ”€β”€ StockAvailability.tsx   # Browse items
    β”‚   β”‚   β”œβ”€β”€ MakeReservation.tsx     # Reserve items
    β”‚   β”‚   β”œβ”€β”€ Reservations.tsx        # User reservations
    β”‚   β”‚   β”œβ”€β”€ LostAndFound.tsx        # Lost & found
    β”‚   β”‚   β”œβ”€β”€ StaffPanel.tsx          # Staff control center
    β”‚   β”‚   β”œβ”€β”€ AdminPanel.tsx          # Admin control center
    β”‚   β”‚   β”œβ”€β”€ About.tsx               # About page
    β”‚   β”‚   └── login/
    β”‚   β”‚       β”œβ”€β”€ LoginLanding.tsx    # Login page
    β”‚   β”‚       └── RegistrationPage.tsx # Registration
    β”‚   β”œβ”€β”€ utils/
    β”‚   β”‚   β”œβ”€β”€ apiService.ts           # API client with token refresh
    β”‚   β”‚   β”œβ”€β”€ ProtectedLayout.tsx     # Protected route wrapper
    β”‚   β”‚   β”œβ”€β”€ socket.ts               # Socket.io client
    β”‚   β”‚   β”œβ”€β”€ performanceMonitor.ts   # Performance tracking
    β”‚   β”‚   └── imageOptimization.ts    # Image optimization
    β”‚   β”œβ”€β”€ App.tsx                     # Main app & routing
    β”‚   └── main.tsx                    # React entry point
    β”œβ”€β”€ vite.config.ts               # Vite configuration
    β”œβ”€β”€ tailwind.config.js           # Tailwind configuration
    └── vercel.json                  # Vercel deployment config

πŸš€ Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • MongoDB database
  • Cloudinary account (for image uploads)

Environment Variables

Backend (.env)

PORT=5000
USERS_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
JWT_REFRESH_SECRET=your_refresh_secret
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret

Frontend (.env)

VITE_API_URL=http://localhost:5000

Installation

  1. Clone the repository
git clone https://github.com/whenzer/SFAC_HUB.git
cd SFAC_HUB
  1. Install backend dependencies
cd backend
npm install
  1. Install frontend dependencies
cd ../frontend/sfac-hub
npm install
  1. Start development servers

Backend:

cd backend
npm start

Frontend:

cd frontend/sfac-hub
npm run dev
  1. Access the application

πŸ“Š API Endpoints

Authentication

  • POST /api/user/register β€” Register new user
  • POST /api/user/login β€” User login
  • POST /api/user/logout β€” User logout
  • POST /api/user/refresh β€” Refresh access token

Protected Routes

  • GET /protected/dashboard β€” Get dashboard data
  • GET /protected/user β€” Get user profile

Staff Routes (Staff & Admin only)

  • GET /api/staff/reservations β€” Get all reservations
  • PUT /api/staff/reservations/:id/collect β€” Mark as collected

Admin Routes (Admin only)

  • GET /api/admin/users β€” Get all users
  • PUT /api/admin/users/verify/:userId β€” Verify user
  • PUT /api/admin/users/reset-password/:userId β€” Reset password
  • DELETE /api/admin/users/delete/:userId β€” Delete user
  • POST /api/admin/createproduct β€” Create new product

🎨 Design System

Color Palette

  • Admin Panel: Pink/Purple gradient (#f093fb β†’ #f5576c)
  • Staff Panel: Blue/Purple gradient (#667eea β†’ #764ba2)
  • Success: #10b981
  • Warning: #f59e0b
  • Error: #ef4444
  • Info: #3b82f6

UI Patterns

  • Glassmorphism: Frosted glass effect with backdrop blur
  • Card-based Layout: Elevated cards with hover animations
  • Gradient Backgrounds: Dynamic multi-layer gradients
  • Smooth Transitions: Cubic-bezier easing for all animations
  • Responsive Grid: Auto-fit grid layouts for all screen sizes

πŸ”’ Security Features

  • Password Hashing: bcrypt with salt rounds
  • JWT Tokens: Access tokens (15min) + Refresh tokens (7 days)
  • Automatic Token Refresh: Seamless token renewal
  • Role-based Middleware: Endpoint protection by role
  • Input Validation: Server-side validation for all inputs
  • CORS Protection: Whitelisted origins only
  • Secure Image Upload: Cloudinary with transformation

🌐 Deployment

Backend (Fly.io)

cd backend
fly deploy

Frontend (Vercel)

cd frontend/sfac-hub
vercel --prod

Live URLs:


πŸ“ User Roles & Permissions

Feature Student Teacher Staff Admin
Browse Stock βœ… βœ… βœ… βœ…
Make Reservations βœ… βœ… βœ… βœ…
Lost & Found βœ… βœ… βœ… βœ…
View Reservations Own Own All All
Collect Items ❌ ❌ βœ… βœ…
Staff Panel ❌ ❌ βœ… βœ…
User Management ❌ ❌ ❌ βœ…
Create Products ❌ ❌ ❌ βœ…
Admin Panel ❌ ❌ ❌ βœ…

🎯 Completed Features

  • βœ… Full authentication system with JWT
  • βœ… Role-based access control
  • βœ… Stock management and browsing
  • βœ… Reservation system with status tracking
  • βœ… Lost & found module with image uploads
  • βœ… Staff panel with reservation management
  • βœ… Admin panel with user management
  • βœ… Real-time updates with Socket.io
  • βœ… Responsive design for all devices
  • βœ… Performance monitoring dashboard
  • βœ… Automatic token refresh
  • βœ… Cloudinary image integration
  • βœ… Production deployment (Fly.io + Vercel)

🚧 Future Enhancements

  • πŸ“§ Email notifications for reservations
  • πŸ“± Push notifications for item availability
  • πŸ“Š Advanced analytics and reporting
  • πŸ“¦ Bulk operations for admin
  • πŸ”” Real-time notification system
  • πŸŒ™ Dark mode toggle
  • πŸ“₯ Export data to CSV/PDF
  • πŸ” Advanced search with filters
  • 🎫 QR code generation for reservations
  • πŸ“ˆ Inventory forecasting

πŸ‘₯ Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License.


πŸ™ Acknowledgments

  • SFAC (School of Future Academy of Cebu)
  • React & Vite communities
  • MongoDB & Express.js documentation
  • Tailwind CSS team
  • Cloudinary for image hosting

Built with ❀️ for SFAC

About

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages