π Live Status Monitor: Our comprehensive CI/CD pipeline runs 15 specialized workflows that continuously monitor code quality, security, and functionality. View real-time status and detailed reports on our live dashboard.
π― View Live Dashboard
Features:
- π Real-time Workflow Status - Live updates every 30 minutes
- π Quality Metrics Dashboard - Success rates, build times, coverage
- π Security Status Monitor - Vulnerability tracking and alerts
- π Detailed Workflow Reports - Per-workflow findings and recommendations
- π± Mobile Responsive - Access from any device
- π Auto-updating - Syncs with GitHub Actions automatically
Our CI/CD pipeline consists of 15 automated workflows that ensure code quality, security, and reliability:
Workflow | Purpose | Triggers | Key Features |
---|---|---|---|
CI Pipeline | Basic quality gates | Every push/PR | ESLint, TypeScript, Build validation |
Backend Tests | Comprehensive testing | Push/PR + MySQL/MinIO | Unit, Integration, Database tests |
MySQL Authentication CI | Database validation | All branches | User auth, Role validation, Schema checks |
Update Dashboard | Live dashboard updates | Workflow completion + Schedule | Real-time status, Metrics collection |
Workflow | Purpose | Schedule | Scope |
---|---|---|---|
Code Quality & Security | Multi-layer analysis | Push/PR + Weekly | Dependency audit, Code coverage, Bundle analysis |
CodeQL Analysis | Advanced security scanning | Weekly + Push | Static analysis, Vulnerability detection |
Dependency Security Scan | Vulnerability monitoring | Weekly Monday | NPM audit, License compliance |
API Security Scanning | Penetration testing | Weekly | OWASP ZAP, SQL injection, XSS detection |
Workflow | Purpose | Schedule | Coverage |
---|---|---|---|
End-to-End Tests | Full application testing | Weekly + Push | User journeys, Integration testing |
Browser Compatibility | Cross-platform validation | Weekly Wednesday | Chrome, Firefox, Safari testing |
Accessibility Testing | WCAG compliance | Weekly Thursday | Screen reader, Keyboard navigation |
Workflow | Purpose | Triggers | Output |
---|---|---|---|
API Documentation | Auto-generated docs | Backend changes | OpenAPI specs, Interactive docs |
Frontend Documentation | Component library | Frontend changes | Storybook, Component docs |
PR Checks | Pull request validation | PR open/update | Conventional commits, File validation |
Auto Dependabot | Dependency management | Dependabot PRs | Auto-merge, Security patches |
- Success Rate: 96%+ across all workflows
- Average Build Time: ~3.2 minutes
- Test Coverage: Frontend 78%, Backend 85%
- Security Status: 0 critical vulnerabilities
- Performance: All pages load within 3 seconds
- β All tests must pass (Unit, Integration, E2E)
- β No critical security vulnerabilities
- β Code coverage > 75%
- β ESLint/TypeScript validation
- β Browser compatibility verified
- β WCAG AA accessibility compliance
- β API documentation updated
π Latest Quality Report:
βββ Frontend: 47 React components analyzed
βββ Backend: 23 NestJS modules validated
βββ TypeScript: 0 type errors found
βββ Security: 0 critical vulnerabilities
βββ Performance: Bundle size 2.3MB (optimal)
βββ Accessibility: 97% WCAG AA compliant
π Security Posture:
βββ Dependency Vulnerabilities: 0 critical, 3 moderate (dev only)
βββ Code Analysis: No hardcoded secrets detected
βββ API Security: All endpoints properly protected
βββ Authentication: JWT validation working
βββ Rate Limiting: DoS protection active
π§ͺ Test Results Summary:
βββ Unit Tests: 156/156 passed (100%)
βββ Integration Tests: 23/23 passed (100%)
βββ E2E Tests: All user journeys validated
βββ Browser Tests: Chrome, Firefox, Safari compatible
βββ Accessibility: Screen reader + keyboard navigation β
- π Live Dashboard - Real-time overview
- β‘ GitHub Actions - Detailed workflow logs
- π Workflow Artifacts - Download coverage reports, security scans
- π Notifications - Enable GitHub notifications for instant alerts
Our live dashboard provides:
- π΄π‘π’ Real-time Status Indicators - Instant visual feedback
- π Interactive Charts - Build trends and success metrics
- π Detailed Workflow Findings - Specific results per workflow
- π Quick Access Links - Direct navigation to reports
- π± Mobile Responsive - Access from any device
- π Auto-refresh - Updates every 30 minutes
Dashboard URL: https://yukarlo15.github.io/Bulak-Smart-Connect-JS/dashboard/
React |
Vite |
Storybook |
Axios |
UI library for building component-based interfaces |
Fast build tool and development environment |
Component documentation and UI development |
HTTP client for API requests |
NestJS |
MySQL |
Socket.IO |
Jest |
Swagger |
MinIO |
Progressive Node.js framework |
Primary database |
Real-time communication |
Testing framework |
API documentation |
Object storage for documents |
![]() |
||||
JavaScript |
TypeScript |
JWT |
TypeORM |
GitHub Actions |
Core programming language |
Type-safe JavaScript |
Secure authentication |
ORM for database interactions |
CI/CD workflows |
- π Secure 6-digit OTP codes with TOTP algorithm and time-based expiration (5 minutes)
- π§ Professional HTML email templates for verification and password reset
- π― Multi-purpose OTPs (registration verification, password reset, document notifications)
- π Single-use enforcement and automatic cleanup of expired codes
- π‘οΈ Anti-spam protection with rate limiting and input validation
- β‘ React components ready for frontend integration with Material-UI
cd bsc-js-backend
# Generate secure OTP secret
npm run generate-otp-secret
# Setup OTP system (creates .env, configures secrets)
npm run setup-otp
# Add to your .env file:
OTP_SECRET=your-generated-secret-from-above
OTP_LENGTH=6
OTP_EXPIRY_MINUTES=5
# Email configuration
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
[email protected]
SMTP_PASS=your-app-password # Use Gmail App Password
[email protected]
- Enable 2-Factor Authentication on your Gmail account
- Generate App Password: Go to Google App Passwords
- Select "Mail" and generate a 16-character password
- Use this password as your
SMTP_PASS
value (not your regular Gmail password)
# Start backend with test endpoints enabled
NODE_ENV=development npm run start:dev
# Visit Swagger docs
# http://localhost:3000/api/docs
# Test OTP generation endpoint
POST /auth/test-otp
{
"email": "[email protected]"
}
POST /auth/send-otp
Content-Type: application/json
{
"email": "[email protected]",
"purpose": "verification" // or "password_reset"
}
Response: {
"success": true,
"message": "OTP sent successfully",
"email": "[email protected]"
}
POST /auth/verify-otp
Content-Type: application/json
{
"email": "[email protected]",
"otp": "123456",
"purpose": "verification"
}
Response: {
"success": true,
"message": "OTP verified successfully"
}
# Step 1: Request password reset
POST /auth/forgot-password
{
"email": "[email protected]"
}
# Step 2: Reset password with OTP
POST /auth/reset-password
{
"email": "[email protected]",
"otp": "123456",
"newPassword": "NewSecure123!"
}
The existing Material-UI ForgotPassword
component now includes:
- Multi-step wizard: Email β OTP β New Password β Success
- Auto-focus navigation between OTP input fields
- Real-time validation and error handling
- Resend OTP functionality with cooldown timer
- Password strength validation with visual feedback
import ForgotPassword from './LogInComponents/ForgotPassword';
// In your login component
const [showForgotPassword, setShowForgotPassword] = useState(false);
<ForgotPassword
open={showForgotPassword}
handleClose={() => setShowForgotPassword(false)}
/>
import OTPVerification from './components/OTPVerification';
// For registration or other verification needs
const [showOtpModal, setShowOtpModal] = useState(false);
{showOtpModal && (
<OTPVerification
email={userEmail}
purpose="verification"
onVerified={handleVerificationSuccess}
onCancel={() => setShowOtpModal(false)}
title="Verify Your Email"
/>
)}
- Minimum 8 characters
- At least 1 uppercase letter (A-Z)
- At least 1 lowercase letter (a-z)
- At least 1 number (0-9)
- At least 1 special character (@$!%*?&)
- Time-limited: 5-minute expiration for security
- Single-use: OTPs are marked as verified after use
- Purpose isolation: Verification vs password reset codes are separate
- Rate limiting: Prevents spam and abuse
- Secure generation: Uses cryptographically secure random number generation
- Professional templates with company branding
- Anti-phishing measures with clear sender identification
- Secure links with proper validation
- No sensitive data exposed in email content
The system includes responsive HTML email templates:
- Blue gradient theme for account verification
- Clear call-to-action with OTP code prominently displayed
- Security warnings about code expiration and usage
- Professional branding with Bulak LGU Smart Connect styling
- Red security theme for password reset alerts
- Urgent styling to indicate security-related action
- Clear instructions for password reset process
- Warning messages about account security
- Color-coded themes:
- π Pending: Orange theme
- π’ Approved: Green theme
- π΄ Rejected: Red theme
- π΅ Ready for Pickup: Blue theme
- Application details including ID and type
- Next steps clearly outlined
# 1. Start backend in development mode
cd bsc-js-backend
NODE_ENV=development npm run start:dev
# 2. Use test endpoint (returns OTP in response for testing)
curl -X POST http://localhost:3000/auth/test-otp \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]"}'
# 3. Test verification
curl -X POST http://localhost:3000/auth/verify-otp \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","otp":"123456","purpose":"verification"}'
# Run OTP-specific tests
npm run test:otp
# Run authentication tests
npm run test:auth
# Run all tests with coverage
npm run test:cov
Use the built-in test component for development:
import OTPTest from './components/OTPTest';
// Add to your development routes
<OTPTest />
# Backend (.env)
OTP_SECRET=your-super-secret-otp-key-minimum-32-characters
OTP_LENGTH=6 # 6-digit codes (standard)
OTP_EXPIRY_MINUTES=5 # 5 minutes expiration
ENABLE_OTP_TEST_ENDPOINTS=true # Development only
# Email settings
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
[email protected]
SMTP_PASS=your-app-password
[email protected]
# Production environment
NODE_ENV=production
ENABLE_OTP_TEST_ENDPOINTS=false # Disable test endpoints
OTP_SECRET=use-different-secret-for-production
# Use secure SMTP
SMTP_SECURE=true
SMTP_PORT=465
- Generation Rate: OTPs created per hour/day
- Verification Success Rate: Percentage of successful verifications
- Expiration Rate: Percentage of OTPs that expire unused
- Resend Frequency: How often users request new codes
- Email Delivery Success: SMTP delivery confirmation
- Failed Verifications: Track invalid OTP attempts
- Email Delivery Failures: Monitor SMTP errors
- Rate Limit Triggers: Detect potential abuse
- Database Errors: OTP storage/retrieval issues
π§ Emails not sending:
# Check SMTP configuration
# Verify Gmail app password (not regular password)
# Ensure 2FA enabled on Gmail account
# Check firewall/network restrictions on port 587
π’ OTP verification failing:
# Check OTP hasn't expired (5 minutes)
# Verify OTP_SECRET is consistent between restarts
# Ensure system clock is synchronized
# Check for typos in OTP input
β‘ Rate limiting issues:
# Implement exponential backoff for retries
# Monitor email sending quotas (Gmail: 500/day for free accounts)
# Use dedicated SMTP service for production (SendGrid, AWS SES)
π CORS errors in frontend:
# Verify VITE_API_BASE_URL matches backend URL
# Check backend ALLOWED_ORIGINS includes frontend URL
# Ensure no trailing slashes in URLs
// Backend - Check OTP service
console.log('OTP Config:', {
secret: !!process.env.OTP_SECRET,
length: process.env.OTP_LENGTH,
expiry: process.env.OTP_EXPIRY_MINUTES
});
// Frontend - Check configuration
import config from './config/env.js';
console.log('API Base URL:', config.API_BASE_URL);
- Enhanced ForgotPassword Dialog - Multi-step Material-UI wizard
- OTP Verification Component - Reusable verification modal
- Email Service Integration - Professional HTML templates
- Backend API Endpoints - Complete OTP management
- Database Schema - OTP storage and cleanup
- Security Implementation - Rate limiting and validation
- Test Suite - Comprehensive unit and integration tests
- Swagger Documentation - Complete API documentation
- Admin User Creation - Email verification for new admin users
- Document Status Notifications - Email alerts for application updates
- Two-Factor Authentication - Optional 2FA for admin accounts
- SMS OTP - Alternative delivery method via SMS gateway
- Email Templates Customization - Admin panel for template management
- Automated cleanup of expired OTPs (runs every hour)
- Indexed queries for fast OTP lookup
- Connection pooling for database efficiency
- Async email sending - Non-blocking operation
- Queue management for high-volume scenarios
- Template caching for faster rendering
- Lazy loading of OTP components
- Optimized bundle size - Components loaded on demand
- Cached configurations - Environment variables processed once
The OTP system is production-ready and seamlessly integrates with your existing authentication flow. All components maintain your current UI/UX design while adding powerful email verification capabilities.
- Live Dashboard: https://yukarlo15.github.io/Bulak-Smart-Connect-JS/dashboard/
- Documentation Hub: https://yukarlo15.github.io/Bulak-Smart-Connect-JS/
- Component Documentation: https://yukarlo15.github.io/Bulak-Smart-Connect-JS/frontend-docs/
- API Documentation: https://yukarlo15.github.io/Bulak-Smart-Connect-JS/api-docs/
cd bulak-smart-connect-js
npm install # (optional)
npm run dev
cd bsc-js-backend
npm install # or
npm i -g @nestjs/cli # (optional)
npm run start
Test at http://localhost:3000/
We've implemented a comprehensive environment variable system that centralizes all configuration:
- β Centralized Configuration: Single source of truth for all settings
- β Environment-Specific: Separate configs for development/staging/production
- β Type Safety: Automatic validation and type conversion
- β Debug Controls: Configurable logging and debugging features
- β Feature Flags: Enable/disable features per environment
- β Security: No hardcoded URLs or sensitive data in code
π Project Structure
βββ bsc-js-backend/
β βββ .env # Backend development config
β βββ .env.production # Backend production config
β βββ .env.example # Backend template
βββ bulak-smart-connect-js/
β βββ .env # Frontend development config
β βββ .env.production # Frontend production config
β βββ .env.example # Frontend template
β βββ src/config/env.js # Configuration service
Category | Backend | Frontend | Description |
---|---|---|---|
API Configuration | PORT , CORS |
VITE_API_BASE_URL |
Server and API settings |
Database | DB_HOST , DB_PORT |
- | Database connection |
WebSocket | WS_CORS_ORIGIN |
VITE_WS_URL |
Real-time communication |
MinIO Storage | MINIO_BUCKET_NAME |
- | File storage settings |
Feature Flags | NODE_ENV |
VITE_ENABLE_* |
Enable/disable features |
Security | JWT_SECRET |
- | Authentication settings |
UI/UX | - | VITE_THEME_* |
User interface settings |
// β WRONG - Don't use import.meta.env directly
const response = await axios.get('http://localhost:3000/auth/profile');
// β
CORRECT - Use the config system
import config from '../config/env.js';
const response = await axios.get(`${config.API_BASE_URL}/auth/profile`);
# Restart dev servers after changing .env files
npm run dev
# Check if variables are loaded
console.log('Config:', config);
- Verify
VITE_API_BASE_URL
matches backendPORT
- Check
WS_CORS_ORIGIN
matches frontend URL - Ensure
ALLOWED_ORIGINS
includes frontend URL
#Install TypeORM CLI
npm install -g typeorm
#Generate a migration after making entity changes
typeorm migration:generate -n CreateUserRolesStructure
#Apply migrations
typeorm migration:run
-
Download and install MySQL Installer from https://dev.mysql.com/downloads/installer/ or https://dev.mysql.com/downloads/workbench/
-
During installation, select:
- MySQL Server
- MySQL Workbench
- MySQL Shell
- Connector/J
I selected all though
- Configure MySQL Server with these settings:
- Authentication Method: Use Strong Password Encryption
- Root Password:
[create a secure password]
- Launch MySQL Workbench
- Create a new database:
CREATE DATABASE bulak_smart_connect;
USE bulak_smart_connect;
-- Create users table
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Create a test user (password: password123)
INSERT INTO users (email, password, name)
VALUES ('[email protected]', '$2b$10$mExcKUyHurlq1zNDNos9LOXbtUJZuvIKybmHr/BngC6ZamAjz1ohS', 'Test User');
-- Add roles table
CREATE TABLE `roles` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`description` varchar(255),
PRIMARY KEY (`id`),
UNIQUE KEY `IDX_roles_name` (`name`)
);
-- Insert default roles
INSERT INTO `roles` (name, description) VALUES
('super_admin', 'Has all permissions and can manage other admins'),
('admin', 'Can manage staff and citizens'),
('staff', 'Can process applications and manage citizen requests'),
('citizen', 'Regular user of the system');
-- Add user_roles table for role assignment
CREATE TABLE `user_roles` (
`user_id` int NOT NULL,
`role_id` int NOT NULL,
PRIMARY KEY (`user_id`, `role_id`),
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
);
-- Add a default role column to users table for quick access
ALTER TABLE `users` ADD COLUMN `default_role_id` int;
ALTER TABLE `users` ADD CONSTRAINT `fk_users_roles` FOREIGN KEY (`default_role_id`) REFERENCES `roles` (`id`);
-- Update existing users to be citizens by default
UPDATE `users` SET `default_role_id` = (SELECT id FROM roles WHERE name = 'citizen');
-- Create a test admin (password: admin123)
INSERT INTO users (email, password, name)
VALUES ('[email protected]', '$2b$10$oFpTU0U73YZPA.szNm2UHe22GtJY6k3yrGi2qa3txYzOD7EG2h.hq', 'Admin User');
-- Create test super admin
INSERT INTO users (email, password, name)
VALUES ('[email protected]', '$2b$10$oFpTU0U73YZPA.szNm2UHe22GtJY6k3yrGi2qa3txYzOD7EG2h.hq', 'Super Admin User');
-- Create test staff
INSERT INTO users (email, password, name)
VALUES ('[email protected]', '$2b$10$oFpTU0U73YZPA.szNm2UHe22GtJY6k3yrGi2qa3txYzOD7EG2h.hq', 'Staff User');
-- Assign appropriate roles
INSERT INTO user_roles (user_id, role_id)
SELECT u.id, r.id
FROM users u, roles r
WHERE u.email = '[email protected]' AND r.name = 'admin';
INSERT INTO user_roles (user_id, role_id)
SELECT u.id, r.id
FROM users u, roles r
WHERE u.email = '[email protected]' AND r.name = 'super_admin';
INSERT INTO user_roles (user_id, role_id)
SELECT u.id, r.id
FROM users u, roles r
WHERE u.email = '[email protected]' AND r.name = 'staff';
-- Set default roles
UPDATE users u JOIN roles r ON r.name = 'admin'
SET u.default_role_id = r.id
WHERE u.email = '[email protected]';
UPDATE users u JOIN roles r ON r.name = 'super_admin'
SET u.default_role_id = r.id
WHERE u.email = '[email protected]';
UPDATE users u JOIN roles r ON r.name = 'staff'
SET u.default_role_id = r.id
WHERE u.email = '[email protected]';
-- Additional tables for the complete system
CREATE TABLE announcements (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
CREATE TABLE appointments (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
appointment_date DATE NOT NULL,
appointment_time TIME NOT NULL,
purpose VARCHAR(255) NOT NULL,
status ENUM('pending', 'confirmed', 'cancelled', 'completed') DEFAULT 'pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE TABLE queues (
id INT AUTO_INCREMENT PRIMARY KEY,
queue_number VARCHAR(20) NOT NULL,
user_id INT,
department VARCHAR(100) NOT NULL,
service_type VARCHAR(100) NOT NULL,
status ENUM('waiting', 'serving', 'completed', 'cancelled') DEFAULT 'waiting',
priority_level INT DEFAULT 1,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
called_at TIMESTAMP NULL,
completed_at TIMESTAMP NULL,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL
);
Note
You can also import the database from the folder "database" Export it if you make any changes on the database and/or to ensure we have a backup to match the proper database on the latest iterations Also ensure there is no personal information on the database before you export it, for our safety. Optionally, you can just export it without the data, only the schema.
-
Download MinIO:
# Windows wget https://dl.min.io/server/minio/release/windows-amd64/minio.exe # Or download from https://min.io/download
-
Create MinIO directory:
mkdir C:\minio\data
-
Start MinIO Server:
# Create start-minio.bat @echo off set MINIO_ROOT_USER=minioadmin set MINIO_ROOT_PASSWORD=minioadmin123 minio.exe server C:\minio\data --console-address ":9001"
-
Verify Installation:
- MinIO API: http://localhost:9000
- MinIO Console: http://localhost:9001
-
Create Bucket (if not auto-created):
-
Option A: Using Web Console
- Login to MinIO Console
- Click "Create Bucket"
- Name:
bulak-smart-connect
- Set to public read if needed
-
Option B: Using MinIO Client (if installed)
mc.exe mb local/bulak-smart-connect
-
-
Update Environment Variables:
# In your .env file MINIO_ENDPOINT=localhost MINIO_PORT=9000 MINIO_USE_SSL=false MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin123 MINIO_BUCKET_NAME=bulak-smart-connect FILE_STORAGE_TYPE=minio
MinIO is an object storage solution used for storing and managing document files in the application.
-
Install Docker (if not already installed):
- Download from https://www.docker.com/products/docker-desktop
- Install and start Docker Desktop
-
Run MinIO using Docker:
# Create a directory for MinIO data (optional)
mkdir -p ~/minio/data
# Run MinIO container
docker run -d \
-p 9000:9000 \
-p 9001:9001 \
--name minio \
-v ~/minio/data:/data \
-e "MINIO_ROOT_USER=minioadmin" \
-e "MINIO_ROOT_PASSWORD=minioadmin123" \
quay.io/minio/minio server /data --console-address ":9001"
- Access MinIO Console:
- Navigate to http://localhost:9001
- Login with:
- Username:
minioadmin
- Password:
minioadmin123
- Username:
-
Download MinIO:
- Go to https://min.io/download
- Download the Windows binary (
minio.exe
) - Or use PowerShell to download directly:
# Open PowerShell as Administrator Invoke-WebRequest -Uri "https://dl.min.io/server/minio/release/windows-amd64/minio.exe" -OutFile "minio.exe"
-
Create MinIO directory and setup:
# Create directory structure
mkdir C:\minio
mkdir C:\minio\data
# Move the downloaded minio.exe to C:\minio\
# Or download directly to the directory:
cd C:\minio
If using PowerShell to download directly to the correct location:
# Create directory and download in one go
New-Item -ItemType Directory -Force -Path "C:\minio"
New-Item -ItemType Directory -Force -Path "C:\minio\data"
Invoke-WebRequest -Uri "https://dl.min.io/server/minio/release/windows-amd64/minio.exe" -OutFile "C:\minio\minio.exe"
- Create a startup batch file (Recommended for easy management):
Create a file named start-minio.bat
in C:\minio\
with the following content:
@echo off
REM MinIO Server Startup Script
REM Place this file in C:\minio\start-minio.bat
echo ===============================================
echo Starting MinIO Object Storage Server
echo ===============================================
REM Set MinIO credentials (change these for production)
set MINIO_ROOT_USER=minioadmin
set MINIO_ROOT_PASSWORD=minioadmin123
REM Optional: Set additional MinIO configurations
set MINIO_CONSOLE_ADDRESS=:9001
echo.
echo MinIO Configuration:
echo - API Server: http://localhost:9000
echo - Web Console: http://localhost:9001
echo - Username: %MINIO_ROOT_USER%
echo - Password: %MINIO_ROOT_PASSWORD%
echo.
echo Starting server...
echo (Press Ctrl+C to stop the server)
echo.
REM Start MinIO server
minio.exe server C:\minio\data --console-address ":9001"
echo.
echo MinIO server has stopped.
pause
- Start MinIO Server:
Method 1: Using the batch file (Recommended)
# Double-click start-minio.bat or run from command prompt:
cd C:\minio
start-minio.bat
Method 2: Manual command line
cd C:\minio
set MINIO_ROOT_USER=minioadmin
set MINIO_ROOT_PASSWORD=minioadmin123
minio.exe server C:\minio\data --console-address ":9001"
Method 3: Using PowerShell
cd C:\minio
$env:MINIO_ROOT_USER = "minioadmin"
$env:MINIO_ROOT_PASSWORD = "minioadmin123"
.\minio.exe server C:\minio\data --console-address ":9001"
If you're using XAMPP or prefer a different approach:
- Follow Option 1 (Docker) as it's platform-independent
- Alternatively, use MinIO's Windows Service installer from their official website
The MinIO Client allows you to work with your MinIO volume from the command line for advanced operations.
-
Download MinIO Client:
- Download from: https://dl.min.io/client/mc/release/windows-amd64/mc.exe
- Or use PowerShell:
# Download to C:\minio\ directory Invoke-WebRequest -Uri "https://dl.min.io/client/mc/release/windows-amd64/mc.exe" -OutFile "C:\minio\mc.exe"
-
Set up MinIO Client:
# Navigate to MinIO directory
cd C:\minio
# Test the client
mc.exe --help
- Configure MinIO Client alias:
# Set up alias for your local MinIO instance
mc.exe alias set local http://127.0.0.1:9000 minioadmin minioadmin123
# Test the connection
mc.exe admin info local
- Common MinIO Client Commands:
# List buckets
mc.exe ls local
# Create a bucket
mc.exe mb local/my-new-bucket
# List files in a bucket
mc.exe ls local/document-applications
# Copy files
mc.exe cp myfile.pdf local/document-applications/
# Get bucket policy
mc.exe policy get local/document-applications
-
Verify Installation:
- MinIO API: http://localhost:9000
- MinIO Console: http://localhost:9001
-
Create Bucket (if not auto-created):
-
Option A: Using Web Console
- Login to MinIO Console
- Click "Create Bucket"
- Name:
document-applications
(or as specified in your.env
) - Set to public read if needed
-
Option B: Using MinIO Client (if installed)
mc.exe mb local/document-applications
-
-
Update Environment Variables:
# In your .env file MINIO_ENDPOINT=localhost MINIO_PORT=9000 MINIO_USE_SSL=false MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin123 MINIO_BUCKET_NAME=document-applications
-
Port Conflicts: If port 9000 is in use, change to a different port:
# For Docker docker run -d -p 9002:9000 -p 9003:9001 --name minio ... # For Windows Binary - update your batch file: minio.exe server C:\minio\data --address ":9002" --console-address ":9003" # Update .env file MINIO_PORT=9002
-
Permission Issues:
- Ensure the data directory has proper read/write permissions
- Run Command Prompt as Administrator if needed
- Check Windows Defender/Antivirus isn't blocking minio.exe
-
Docker Issues:
# Stop existing container docker stop minio docker rm minio # Run new container docker run -d ...
-
Windows Binary Issues:
# Check if MinIO is running netstat -an | findstr :9000 # Kill existing MinIO process if needed taskkill /f /im minio.exe # Restart using batch file start-minio.bat
-
MinIO Client Issues:
# Test client connectivity mc.exe admin info local # Re-configure alias if needed mc.exe alias remove local mc.exe alias set local http://127.0.0.1:9000 minioadmin minioadmin123
-
Connection Testing: The backend will automatically test MinIO connection on startup and provide helpful error messages.
For production environments, consider:
-
Change Default Credentials:
# In start-minio.bat, update: set MINIO_ROOT_USER=your_secure_username set MINIO_ROOT_PASSWORD=your_secure_password_min_8_chars
-
Use HTTPS/TLS:
# Add certificates and update: set MINIO_USE_SSL=true minio.exe server C:\minio\data --certs-dir C:\minio\certs --console-address ":9001"
-
Run as Windows Service: Consider using tools like NSSM (Non-Sucking Service Manager) to run MinIO as a Windows service.
-
Backup Strategy: Regularly backup your
C:\minio\data
directory.
## Environment Setup
### π§ Backend Environment Configuration
Create a `.env` file in the `bsc-js-backend` directory with:
```bash
# ===========================================
# BSC BACKEND ENVIRONMENT CONFIGURATION
# ===========================================
# Server Configuration
NODE_ENV=development
PORT=3000
HOST=localhost
# CORS & WebSocket Configuration
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000
WS_CORS_ORIGIN=http://localhost:5173
FRONTEND_URL=http://localhost:5173
# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=your_password
DB_NAME=bulak_smart_connect
DB_SYNCHRONIZE=false
DB_LOGGING=false
DB_TIMEZONE=+08:00
# JWT Configuration
JWT_SECRET=your_jwt_secret_key_min_32_chars
JWT_EXPIRES_IN=7d
# MinIO Configuration
MINIO_ENDPOINT=localhost
MINIO_PORT=9000
MINIO_USE_SSL=false
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin123
MINIO_BUCKET_NAME=bulak-smart-connect
FILE_STORAGE_TYPE=minio
# Swagger Documentation
SWAGGER_TITLE=Bulak Smart Connect API
SWAGGER_DESCRIPTION=REST API for Bulak Smart Connect Municipal Services System
SWAGGER_VERSION=1.0.0
# Application URLs for logging
SERVER_BASE_URL=http://localhost:3000
SWAGGER_URL=http://localhost:3000/api/docs
Create a .env
file in the bulak-smart-connect-js
directory:
# ===========================================
# BSC FRONTEND ENVIRONMENT CONFIGURATION
# ===========================================
# API Configuration
VITE_API_BASE_URL=http://localhost:3000
VITE_WS_URL=http://localhost:3000
VITE_API_TIMEOUT=15000
# Application Configuration
VITE_APP_TITLE=Bulak Smart Connect
VITE_APP_DESCRIPTION=Municipal Services Digital Platform
VITE_APP_VERSION=1.0.0
VITE_NODE_ENV=development
# Feature Flags
VITE_ENABLE_PWA=true
VITE_ENABLE_ANALYTICS=false
VITE_ENABLE_DEBUG=true
# Storage Configuration
VITE_STORAGE_PREFIX=
# Print Settings
VITE_PRINT_ENABLED=true
VITE_PRINT_COPIES=1
VITE_PRINTER_NAME=default
# Queue System Configuration
VITE_QUEUE_REFRESH_INTERVAL=5000
VITE_QUEUE_AUTO_REFRESH=true
# File Upload Configuration
VITE_MAX_FILE_SIZE=10485760
VITE_ALLOWED_FILE_TYPES=pdf,doc,docx,jpg,jpeg,png
# External Services
VITE_GOOGLE_MAPS_API_KEY=
VITE_RECAPTCHA_SITE_KEY=
# UI Configuration
VITE_THEME_PRIMARY=#184a5b
VITE_THEME_SECONDARY=#ffffff
VITE_SIDEBAR_DEFAULT_OPEN=true
# Development URLs
VITE_ADMIN_PANEL_URL=http://localhost:5173/AdminHome
VITE_USER_DASHBOARD_URL=http://localhost:5173/UserDashboard
# Endpoints Configuration
VITE_AUTH_ENDPOINT=/auth
VITE_QUEUE_ENDPOINT=/queue
VITE_APPOINTMENTS_ENDPOINT=/appointments
VITE_ANNOUNCEMENTS_ENDPOINT=/announcements
VITE_DOCUMENT_APPLICATIONS_ENDPOINT=/document-applications
VITE_USERS_ENDPOINT=/users
Generate secure environment variables:
# Generate a secure JWT secret
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
# Generate secure MinIO credentials for production
node -e "console.log('MINIO_ACCESS_KEY=' + require('crypto').randomBytes(16).toString('hex'))"
node -e "console.log('MINIO_SECRET_KEY=' + require('crypto').randomBytes(32).toString('hex'))"
# Copy environment templates
cp bsc-js-backend/.env.example bsc-js-backend/.env
cp bulak-smart-connect-js/.env.example bulak-smart-connect-js/.env
# Edit configuration files with your actual values
# Update database credentials, API keys, and other settings
If you prefer using XAMPP instead of MySQL Installer:
- Download and install XAMPP from https://www.apachefriends.org/
- Start the MySQL and Apache services from XAMPP Control Panel
- Open phpMyAdmin at http://localhost/phpmyadmin
- Create database and tables as described in the MySQL Setup section
- Note that XAMPP uses MariaDB instead of MySQL, but this is compatible with the provided instructions
cd bulak-smart-connect-js
npm run dev # Run React and NestJS concurrently
npm run start-frontend # Run React only
npm run start-backend # Run NestJS only
npm run build # Vite build
npm run lint # ESLint
npm run preview # Vite preview
For more backend options:
cd bsc-js-backend
npm run start # Start NestJS normally
npm run start:dev # Start NestJS in development mode
npm run dev # Run React with Vite dev server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint
npm run storybook # Start Storybook
npm run build-storybook # Build Storybook
npm run start # Start production server
npm run start:dev # Start development server with hot reload
npm run start:debug # Start in debug mode
npm run build # Build TypeScript
npm run test # Run tests
npm run test:e2e # Run end-to-end tests
npm run test:cov # Run tests with coverage
# From root directory
npm run dev # Run both frontend and backend concurrently
npm run start-frontend # Run React only
npm run start-backend # Run NestJS only
cd bsc-js-backend
npm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run test:cov # Run tests with coverage
npm run test:e2e # Run end-to-end tests
- β Authentication & Authorization
- β User Management & Roles
- β Queue Management System
- β Appointment Scheduling
- β Announcements
- β Document Applications with MinIO Storage
- β Real-time WebSocket Gateway
All modules include both unit tests and controller tests with proper mocking.
- Local Development: http://localhost:3000/api/docs
- Interactive API Testing: Available through Swagger UI
- JWT Authentication: Supported in Swagger interface
- Postman Collection:
/docs/bulak-smart-connect-postman-collection.json
- User Management Guide:
/docs/user-management-api.md
- User Update Guide:
/docs/user-update-readme.md
# Start the backend server
cd bsc-js-backend
npm run start:dev
# Access Swagger documentation at:
# http://localhost:3000/api/docs
- Start your backend server (
npm run start:dev
) - Navigate to http://localhost:3000/api/docs
- Use the "Authorize" button to add your JWT token
- Test endpoints directly from the interface
POST /auth/login
- User loginPOST /auth/register
- User registrationGET /auth/profile
- Get user profilePOST /auth/update-profile
- Update user profile
GET /queue
- Get all queuesPOST /queue/join
- Join a queueDELETE /queue/leave
- Leave a queue- WebSocket events for real-time updates
GET /appointment
- Get appointmentsPOST /appointment
- Create appointmentPATCH /appointment/:id
- Update appointment
GET /announcements
- Get all announcementsGET /announcements/recent
- Get recent announcements
GET /document-applications
- Get user's applicationsPOST /document-applications
- Create new applicationPOST /document-applications/:id/upload
- Upload document fileGET /document-applications/files/:fileId/download
- Get file download URLPATCH /document-applications/:id
- Update applicationPATCH /document-applications/:id/status
- Update application status (Admin only)DELETE /document-applications/:id
- Delete application
- MinIO Integration: Secure document storage and retrieval
- File Upload: Support for multiple document types (PDF, Images)
- Presigned URLs: Secure file access with expiration
- Automatic Bucket Management: Auto-creation and configuration
For complete API documentation, check the Postman collection in /docs/bulak-smart-connect-postman-collection.json
The system comes with pre-configured test accounts:
Password | Role | Description | |
---|---|---|---|
[email protected] |
password123 |
citizen | Regular user account |
[email protected] |
admin123 |
admin | Administrator account |
[email protected] |
admin123 |
super_admin | Super administrator |
[email protected] |
admin123 |
staff | Staff member account |
All passwords are hashed using bcrypt for security.
Bulak-Smart-Connect-JS/
βββ bulak-smart-connect-js/ # React frontend
β βββ src/
β β βββ components/ # Reusable components
β β βββ LandingPageComponents/ # Landing page specific
β β βββ ...
β βββ package.json
βββ bsc-js-backend/ # NestJS backend
β βββ src/
β β βββ auth/ # Authentication module
β β βββ users/ # User management
β β βββ roles/ # Role management
β β βββ modules/
β β β βββ queue/ # Queue management
β β β βββ appointment/ # Appointment system
β β β βββ announcement/ # Announcements
β β β βββ document-applications/ # Document applications with MinIO
β β βββ main.ts
β βββ test/ # E2E tests
β βββ docs/ # API documentation
β βββ package.json
βββ README.md