Skip to content

Enterprise-grade fiber optic installation monitoring system with real-time project tracking, field reporting, and automated documentation.

Notifications You must be signed in to change notification settings

Kevin5621/fiber-monitoring-project

Repository files navigation

Fiber Monitoring Project

Enterprise-Grade Fiber Optic Installation Monitoring System

A comprehensive, enterprise-level monorepo solution for monitoring and managing fiber optic installation projects. This system provides real-time project tracking, automated reporting, and seamless collaboration between field workers and management teams.

πŸ—οΈ Architecture Overview

This project implements a modern, scalable architecture with:

  • Microservices Architecture: Separate applications for different user roles
  • Real-time Data Synchronization: Live updates across all applications
  • Enterprise Security: Role-based access control with Supabase Auth
  • Scalable Database Design: PostgreSQL with optimized schemas
  • Cloud-Native Storage: R2-compatible object storage for documents
  • Mobile-First Design: Responsive interfaces for field operations

🎯 Business Value

For Management Teams

  • Real-time Project Visibility: Live dashboards with KPIs and progress metrics
  • Automated Reporting: Daily, weekly, and monthly reports generation
  • Resource Optimization: Track team performance and project efficiency
  • Risk Management: Early identification of project delays and issues
  • Compliance Tracking: Automated audit trails and documentation

For Field Operations

  • Streamlined Workflows: Intuitive mobile interfaces for field workers
  • Offline Capability: Work continues even with intermittent connectivity
  • Photo Documentation: Integrated photo capture with GPS tagging
  • Issue Reporting: Real-time problem escalation and tracking
  • Progress Tracking: Milestone completion with automated notifications

πŸ› οΈ Technology Stack

Frontend

  • Framework: Next.js 14 with App Router
  • UI Library: shadcn/ui components with Tailwind CSS
  • State Management: React hooks with custom state management
  • Real-time Updates: Supabase Realtime subscriptions

Backend & Database

  • Database: PostgreSQL 15 with Supabase
  • Authentication: Supabase Auth with role-based access control
  • API: RESTful APIs with Next.js API routes
  • Storage: Cloudflare R2 compatible object storage
  • Real-time: WebSocket connections via Supabase Realtime

DevOps & Infrastructure

  • Monorepo Management: Turborepo for efficient build processes
  • Containerization: Docker for consistent deployment
  • Type Safety: TypeScript throughout the application
  • Code Quality: ESLint, Prettier, and Husky for code standards

πŸ“± Applications

Admin Dashboard (/apps/admin)

Target Users: Project Managers, Supervisors, Executives

Key Features:

  • Executive dashboard with KPIs and analytics
  • Project portfolio management
  • Team performance monitoring
  • Automated report generation
  • Document approval workflows
  • Real-time project status visualization
  • User management and role assignment

Technical Highlights:

  • Advanced data visualization with charts and graphs
  • Bulk operations for project management
  • Export capabilities (Excel, PDF)
  • Real-time notifications and alerts

Waspang Field Interface (/apps/waspang)

Target Users: Field Technicians, Site Supervisors

Key Features:

  • Mobile-optimized field reporting
  • Photo documentation with GPS coordinates
  • Offline-first design for remote locations
  • Milestone tracking and completion
  • Issue reporting with photo evidence
  • Daily progress updates

Technical Highlights:

  • Progressive Web App (PWA) capabilities
  • Offline data synchronization
  • Camera integration with metadata
  • Location-based project filtering

πŸ—„οΈ Data Architecture

Core Entities

Projects

- Project metadata and configuration
- Timeline and milestone definitions
- Team assignments and permissions
- Status tracking and progress metrics

Reports

- Daily field reports with structured data
- Photo documentation and attachments
- GPS coordinates and location data
- Issue tracking and resolution

Documents

- Multi-format document storage
- Version control and audit trails
- Category-based organization
- Access control and permissions

Users & Roles

- Role-based access control (RBAC)
- Project-specific permissions
- Activity logging and audit trails
- Authentication and session management

πŸš€ Getting Started

Prerequisites

  • Node.js: Version 18.0.0 or higher
  • Docker: Version 20.10.0 or higher
  • Supabase CLI: Latest version
  • Git: Version 2.30.0 or higher

Installation

  1. Clone the Repository

    git clone https://github.com/Kevin5621/fiber-monitoring-project.git
    cd fiber-monitoring-project
  2. Install Dependencies

    npm install
  3. Environment Configuration Create environment files for each application:

    Admin App (apps/admin/.env.local):

    NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
    NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
    SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
    R2_ACCESS_KEY_ID=your_r2_access_key
    R2_SECRET_ACCESS_KEY=your_r2_secret_key
    R2_BUCKET_NAME=your_bucket_name
    R2_ENDPOINT=your_r2_endpoint

    Waspang App (apps/waspang/.env.local):

    NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
    NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
    SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
    R2_ACCESS_KEY_ID=your_r2_access_key
    R2_SECRET_ACCESS_KEY=your_r2_secret_key
    R2_BUCKET_NAME=your_bucket_name
    R2_ENDPOINT=your_r2_endpoint
  4. Database Setup

    # Start Supabase locally
    supabase start
    
    # Apply migrations
    supabase db reset
  5. Start Development Servers

    # Start all applications
    npm run dev
    
    # Or start specific applications
    npm run dev:admin
    npm run dev:waspang
    npm run dev:all

πŸ”§ Development Workflow

πŸ“– For a complete list of all available scripts, see Available Scripts

Monorepo Commands

# Install dependencies for all packages
npm install

# Run development servers
npm run dev                    # All apps
npm run dev:admin              # Admin only
npm run dev:waspang            # Waspang only

# Build applications
npm run build                  # All apps
npm run build:admin            # Admin only
npm run build:waspang          # Waspang only

# Start production servers
npm run start                  # All apps
npm run start:admin            # Admin only
npm run start:waspang          # Waspang only

# Type checking
npm run type-check             # All packages
npm run type-check:admin       # Admin only
npm run type-check:waspang     # Waspang only
npm run type-check:shared      # Shared package only
npm run type-check:report      # Detailed type check report

# Lint and format code
npm run lint                   # All packages (with turbo - stops on first error)
npm run lint:all               # All packages (individual - shows all errors)
npm run lint:admin             # Admin only
npm run lint:waspang           # Waspang only
npm run lint:shared            # Shared package only
npm run format                 # Format all code

# Database and utilities
npm run seed:storage           # Seed storage data
npm run reset:all              # Reset all data

Database Management

# Start Supabase
supabase start

# Stop Supabase
supabase stop

# Reset database (applies migrations and seeds)
supabase db reset

# Generate new migration
supabase migration new migration_name

# Apply migrations only
supabase db push

# View database status
supabase status

πŸ” Code Quality & Linting

Linting Commands

The project provides two different linting approaches:

1. Turbo Linting (npm run lint)

  • Uses Turborepo to run lint across all workspaces
  • Stops on first error - if shared package has errors, admin and waspang won't show their errors
  • Useful for CI/CD pipelines where you want to fail fast

2. Individual Linting (npm run lint:all)

  • Runs lint for each workspace independently
  • Shows all errors from all workspaces
  • Useful for development to see all issues at once
  • Provides clear status for each workspace

Individual Workspace Linting

npm run lint:admin    # Lint admin app only
npm run lint:waspang  # Lint waspang app only
npm run lint:shared   # Lint shared package only

Type Checking

npm run type-check             # Check all packages
npm run type-check:admin       # Check admin only
npm run type-check:waspang     # Check waspang only
npm run type-check:shared      # Check shared only
npm run type-check:report      # Detailed report with counts

πŸ› Troubleshooting

Common Issues

Supabase Connection Issues

If you encounter authentication errors like:

password authentication failed for user "supabase_storage_admin"

Solution:

# Stop all Supabase services
supabase stop

# Clean Docker resources
docker system prune -f

# Restart Supabase
supabase start

Port Conflicts

If ports are already in use:

# Check what's using the ports
sudo lsof -i :54321  # API port
sudo lsof -i :54322  # Database port
sudo lsof -i :54323  # Studio port

# Kill processes if necessary
sudo kill -9 <PID>

Database Migration Issues

# Reset database completely
supabase db reset --linked

# Or reset local database
supabase db reset

Performance Optimization

Development Mode

  • Use npm run dev --filter=<app> to run only specific applications
  • Enable Turbo cache: npx turbo build --cache-dir=.turbo

Production Builds

  • Optimize images and assets
  • Enable compression and caching
  • Use CDN for static assets

πŸ“Š Monitoring & Analytics

Built-in Analytics

  • Project completion rates
  • Team productivity metrics
  • Issue resolution times
  • Document upload statistics
  • User activity tracking

Custom Reporting

  • Excel export functionality
  • PDF report generation
  • Real-time dashboard updates
  • Automated email notifications

πŸ”’ Security Features

Authentication & Authorization

  • Multi-factor authentication support
  • Role-based access control (RBAC)
  • Session management with secure tokens
  • Brute force protection

Data Protection

  • Encrypted data transmission (HTTPS)
  • Secure file uploads with validation
  • Audit logging for all operations
  • GDPR-compliant data handling

API Security

  • Rate limiting and throttling
  • Input validation and sanitization
  • CORS configuration
  • API key management

πŸš€ Deployment

Production Deployment

# Build for production
npm run build

# Start production servers
npm run start

# Or start specific applications
npm run start:admin
npm run start:waspang

Docker Deployment

# Build Docker images
docker-compose build

# Deploy with Docker Compose
docker-compose up -d

Environment Variables

Ensure all required environment variables are set in production:

  • Database connection strings
  • API keys and secrets
  • Storage configuration
  • Authentication settings

πŸ“ˆ Scalability Considerations

Database Optimization

  • Indexed queries for performance
  • Connection pooling
  • Read replicas for analytics
  • Automated backups

Application Scaling

  • Horizontal scaling with load balancers
  • Caching strategies (Redis)
  • CDN for static assets
  • Microservices architecture

🀝 Contributing

Development Guidelines

  1. Follow TypeScript best practices
  2. Write comprehensive tests
  3. Use conventional commit messages
  4. Update documentation for new features
  5. Follow the established code style

Code Review Process

  1. Create feature branches from main
  2. Submit pull requests with detailed descriptions
  3. Ensure all tests pass
  4. Update relevant documentation
  5. Get approval from maintainers

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

Documentation

Contact

  • Technical Issues: Create an issue on GitHub
  • Feature Requests: Submit via GitHub discussions
  • Security Concerns: Email security@company.com

Built with ❀️ for enterprise-grade fiber optic project management

Releases

No releases published

Packages

No packages published

Contributors 9