A comprehensive report management system built with Node.js, Express, Prisma, PostgreSQL, and modern frontend technologies.
- User Authentication & Authorization - Secure login with JWT tokens and role-based access control
- Report Management - Upload, view, approve, and track weekly reports
- Department Management - Organize users into departments with HOD oversight
- Notification System - Real-time notifications for report status changes
- Audit Trail - Complete audit logging for all system activities
- Modern UI/UX - Responsive design with dark/light theme support
- Real-time Updates - Live notifications and status updates
- Advanced Search & Filtering - Powerful search across reports and users
- Analytics Dashboard - Comprehensive analytics and reporting
- File Management - PDF upload with version control and revision tracking
- Comment System - Collaborative feedback on reports
- Profile Management - User profiles with avatar support
- Mobile Responsive - Fully responsive design for all devices
- Multi-role Support - Staff, HOD, Admin, and HR roles
- Department Hierarchy - Organized department structure
- Bulk Operations - Efficient management of multiple reports
- Data Export - Export capabilities for reports and analytics
- System Settings - Configurable system parameters
- Audit Logging - Complete activity tracking
- Security - Password hashing, session management, and CSRF protection
- Node.js - Runtime environment
- Express.js - Web framework
- Prisma - Database ORM
- PostgreSQL - Primary database
- JWT - Authentication tokens
- bcryptjs - Password hashing
- Multer - File upload handling
- Vanilla JavaScript - Modern ES6+ features
- CSS3 - Advanced styling with CSS variables
- Font Awesome - Icon library
- Google Fonts - Typography
- Prisma Migrate - Database migrations
- Nodemon - Development server
- ESLint - Code linting
- Node.js (v16 or higher)
- PostgreSQL (v12 or higher)
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/your-username/enterprise-report-system.git cd enterprise-report-system
-
Install dependencies
cd server npm install
-
Environment Configuration Create a
.env
file in theserver
directory:DATABASE_URL="postgresql://username:password@localhost:5432/report_system" JWT_SECRET="your-super-secret-jwt-key" CLIENT_ORIGIN="http://localhost:5500" UPLOAD_DIR="./uploads" PORT=4000
-
Database Setup
# Generate Prisma client npm run prisma:generate # Run database migrations npm run prisma:migrate # (Optional) Seed the database npm run prisma:seed
-
Start the development server
npm run dev
-
Access the application
- Frontend: http://localhost:5500
- API: http://localhost:4000/api
- Health check: http://localhost:4000/api/health
- Basic user information and authentication
- Role-based access control (STAFF, HOD, ADMIN, HR)
- Department association
- Profile management
- Organizational structure
- HOD assignment
- Staff management
- Weekly report submissions
- Status tracking (DRAFT, SUBMITTED, UNDER_REVIEW, APPROVED, REJECTED)
- File management with version control
- Comments and revisions
- Real-time notifications
- Type-based categorization
- Read/unread status tracking
- Complete activity tracking
- User actions and system events
- Metadata and context preservation
- STAFF - Can submit and view their own reports
- HOD - Can manage department reports and staff
- ADMIN - Full system access and configuration
- HR - User management and department oversight
- JWT token-based authentication
- Password hashing with bcryptjs
- Session management
- CSRF protection
- Input validation and sanitization
POST /api/auth/register
- User registrationPOST /api/auth/login
- User loginPOST /api/auth/logout
- User logoutGET /api/auth/profile
- Get user profilePUT /api/auth/profile
- Update user profilePUT /api/auth/change-password
- Change password
GET /api/reports
- Get all reports (with filtering)POST /api/reports
- Submit new reportGET /api/reports/mine
- Get user's reportsGET /api/reports/:id
- Get specific reportPUT /api/reports/:id/status
- Update report statusPOST /api/reports/:id/comments
- Add commentPOST /api/reports/:id/revisions
- Upload revisionDELETE /api/reports/:id
- Delete report
GET /api/departments
- Get all departmentsPOST /api/departments
- Create departmentPUT /api/departments/:id
- Update departmentDELETE /api/departments/:id
- Delete departmentPOST /api/departments/:id/staff
- Assign staff
GET /api/notifications
- Get user notificationsPUT /api/notifications/:id/read
- Mark as readPUT /api/notifications/mark-all-read
- Mark all as readDELETE /api/notifications/:id
- Delete notification
GET /api/dashboard/analytics
- Get dashboard analyticsGET /api/dashboard/department-performance
- Department metricsGET /api/dashboard/activity
- User activity summary
GET /api/admin/users
- Get all usersPOST /api/admin/users
- Create userPUT /api/admin/users/:id
- Update userDELETE /api/admin/users/:id
- Delete userGET /api/admin/audit-logs
- Get audit logsGET /api/admin/settings
- Get system settingsPUT /api/admin/settings
- Update system settings
- Modern Design - Clean, professional interface
- Responsive Layout - Works on all device sizes
- Dark/Light Theme - User preference support
- Interactive Components - Modals, dropdowns, and animations
- Real-time Updates - Live notifications and status changes
- Intuitive Navigation - Easy-to-use interface
- Keyboard Shortcuts - Power user features
- Search & Filter - Quick data access
- Bulk Actions - Efficient operations
- Error Handling - User-friendly error messages
# Database
DATABASE_URL="postgresql://user:pass@localhost:5432/db"
# Authentication
JWT_SECRET="your-secret-key"
# Server
PORT=4000
CLIENT_ORIGIN="http://localhost:5500"
# File Upload
UPLOAD_DIR="./uploads"
MAX_FILE_SIZE=10485760 # 10MB
# Email (Optional)
SMTP_HOST="smtp.gmail.com"
SMTP_PORT=587
SMTP_USER="your-email@gmail.com"
SMTP_PASS="your-app-password"
- Report submission deadlines
- File size limits
- Notification preferences
- Department configurations
- User management policies
-
Build the application
npm run build
-
Set production environment variables
NODE_ENV=production DATABASE_URL="your-production-database-url" JWT_SECRET="your-production-secret"
-
Run database migrations
npm run prisma:deploy
-
Start the production server
npm start
FROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run prisma:generate
EXPOSE 4000
CMD ["npm", "start"]
The project includes Railway configuration files:
railway.toml
- Railway deployment configurationnixpacks.toml
- Build configuration
- Database query optimization
- Efficient file handling
- Caching strategies
- Pagination for large datasets
- Lazy loading for better UX
- Health check endpoint
- Error logging
- Performance metrics
- Audit trail tracking
- User activity monitoring
# Unit tests
npm test
# Integration tests
npm run test:integration
# End-to-end tests
npm run test:e2e
- API endpoint testing
- Database operation testing
- Frontend component testing
- User workflow testing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow ESLint configuration
- Write comprehensive tests
- Update documentation
- Follow semantic versioning
- Use conventional commits
This project is licensed under the MIT License - see the LICENSE file for details.
- Check the FAQ
- Review Common Issues
- Open an Issue
- Email: support@yourcompany.com
- Documentation: docs.yourcompany.com
- Community: Discord Server
- Express.js - Web framework
- Prisma - Database toolkit
- PostgreSQL - Database
- Font Awesome - Icons
- Google Fonts - Typography
Built with β€οΈ for modern enterprise needs