Skip to content

BeLike-Harsh/rail-suraksha

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš‚ RailSuraksha - AI-Powered Railway Analytics Platform

Next.js React TypeScript Tailwind CSS License

Advanced Railway Track Fitting Management with AI-Driven Analytics

πŸš€ Live Demo β€’ πŸ› Report Bug β€’ ✨ Request Feature

RailSuraksha Dashboard


πŸ“‹ Table of Contents


🎯 Overview

RailSuraksha is a comprehensive, AI-powered railway analytics platform designed to revolutionize track fitting management and maintenance operations. Built for Indian Railways and modern transit systems, it provides real-time monitoring, predictive analytics, and intelligent inventory management for railway infrastructure components.

🌟 Key Highlights

  • πŸ” Real-time Monitoring: Live tracking of railway track fittings across all zones
  • πŸ€– AI-Powered Analytics: Predictive maintenance and risk assessment algorithms
  • πŸ“Š Comprehensive Dashboard: Interactive visualizations with advanced filtering
  • 🏷️ QR Code Management: Generate and track QR codes for physical assets
  • πŸ“¦ Smart Inventory: Complete CRUD operations with warranty tracking
  • πŸ”— System Integration: Seamless connectivity with existing railway systems
  • πŸ“± Responsive Design: Optimized for desktop, tablet, and mobile devices
  • πŸŒ™ Dark Mode: Professional dark theme for extended usage

✨ Features

πŸŽ›οΈ Dashboard & Analytics

  • Interactive Metrics: Real-time KPIs with trend analysis
  • Risk Assessment: Zone-wise risk mapping with severity indicators
  • Vendor Performance: Quality scoring and performance tracking
  • Predictive Maintenance: AI-driven maintenance scheduling
  • Custom Reports: Export analytics in multiple formats (CSV, Excel, JSON, PDF)

πŸ“¦ Inventory Management

  • Asset Tracking: Complete lifecycle management of railway components
  • CRUD Operations: Add, edit, delete inventory items with validation
  • Advanced Filtering: Multi-parameter search and filtering system
  • Warranty Management: Automated warranty tracking and notifications
  • Batch Processing: Bulk operations and data export capabilities

🏷️ QR Code Generation

  • Dynamic QR Codes: Generate QR codes for physical asset tracking
  • Batch Creation: Bulk QR code generation for multiple items
  • Multiple Formats: Export as PNG, SVG, and PDF formats
  • Custom Styling: Configurable QR code appearance and branding

πŸ”— System Integration

  • API Connectivity: RESTful APIs for external system integration
  • Real-time Sync: Live data synchronization with railway databases
  • Health Monitoring: System status dashboard with uptime tracking
  • Error Handling: Comprehensive logging and error recovery

πŸ”” Notifications & Alerts

  • Smart Alerts: Priority-based notification system
  • Risk Warnings: Automated alerts for high-risk components
  • Maintenance Reminders: Scheduled maintenance notifications
  • System Updates: Real-time status updates and announcements

πŸ—οΈ Architecture

Frontend Architecture

β”œβ”€β”€ 🎨 Presentation Layer (React + Next.js)
β”‚   β”œβ”€β”€ Components (Modular UI Components)
β”‚   β”œβ”€β”€ Pages (Route-based Navigation)
β”‚   └── Hooks (Custom React Hooks)
β”œβ”€β”€ πŸ”„ State Management (React State + Context)
β”œβ”€β”€ 🎯 Business Logic Layer
β”œβ”€β”€ πŸ“‘ API Integration Layer
└── 🎨 Styling (Tailwind CSS + shadcn/ui)

Component Structure

components/
β”œβ”€β”€ πŸ“Š dashboard/          # Analytics and metrics
β”œβ”€β”€ πŸ“¦ inventory/          # Asset management
β”œβ”€β”€ 🏷️ qr-generation/     # QR code utilities
β”œβ”€β”€ πŸ”— integration/       # System connectivity
β”œβ”€β”€ πŸ”” notifications/     # Alert system
β”œβ”€β”€ 🚨 alerts/            # Priority notifications
β”œβ”€β”€ 🎨 ui/                # Reusable UI components
└── πŸ“± analytics/         # Advanced analytics

πŸš€ Quick Start

Prerequisites

  • Node.js 18.0+
  • pnpm 8.0+ (recommended) or npm
  • Git for version control

1️⃣ Clone Repository

git clone https://github.com/YashhhCodesHere/rail-suraksha.git
cd rail-suraksha

2️⃣ Install Dependencies

pnpm install

3️⃣ Start Development Server

pnpm dev

4️⃣ Open Application

Visit http://localhost:3000 in your browser.


πŸ“± Screenshots

🎯 Dashboard Overview

Dashboard

πŸ“¦ Inventory Management

Inventory

🏷️ QR Code Generation

QR Generation

πŸ”— System Integration

Integration


πŸ› οΈ Tech Stack

Frontend Technologies

Technology Version Purpose
βš›οΈ React 19.0 UI Library
πŸ”— Next.js 14.2.25 React Framework
πŸ“˜ TypeScript 5.0 Type Safety
🎨 Tailwind CSS 4.1.9 Styling Framework
🧩 shadcn/ui Latest Component Library
πŸ“Š Recharts 2.15.4 Data Visualization

UI Components & Libraries

Library Purpose
πŸŽ›οΈ Radix UI Headless UI Components
πŸ“… date-fns Date Manipulation
🏷️ qrcode QR Code Generation
🎭 Lucide React Icon Library
🎨 class-variance-authority Component Variants
πŸ“Š Recharts Charts & Graphs

Development Tools

Tool Purpose
πŸ“¦ pnpm Package Manager
πŸ” ESLint Code Linting
🎯 TypeScript Static Type Checking
🎨 PostCSS CSS Processing
⚑ Vercel Analytics Performance Monitoring

πŸ“¦ Installation

Development Setup

  1. Clone and Navigate

    git clone https://github.com/YashhhCodesHere/rail-suraksha.git
    cd rail-suraksha
  2. Install Dependencies

    # Using pnpm (recommended)
    pnpm install
    
    # Or using npm
    npm install
    
    # Or using yarn
    yarn install
  3. Environment Setup

    cp .env.example .env.local
    # Edit .env.local with your configuration
  4. Start Development

    pnpm dev

Production Build

# Build for production
pnpm build

# Start production server
pnpm start

# Export static files
pnpm export

βš™οΈ Configuration

Environment Variables

Create a .env.local file in the root directory:

# Application
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_APP_NAME=RailSuraksha

# API Configuration
NEXT_PUBLIC_API_BASE_URL=https://api.railsuraksha.com
API_SECRET_KEY=your_secret_key_here

# Database (if applicable)
DATABASE_URL=postgresql://username:password@localhost:5432/railsuraksha

# Analytics
VERCEL_ANALYTICS_ID=your_analytics_id

# Feature Flags
NEXT_PUBLIC_ENABLE_ANALYTICS=true
NEXT_PUBLIC_ENABLE_NOTIFICATIONS=true

Next.js Configuration

The application uses the following Next.js configuration (next.config.mjs):

const nextConfig = {
  output: 'export',           // Static site generation
  eslint: {
    ignoreDuringBuilds: true, // Skip ESLint during builds
  },
  typescript: {
    ignoreBuildErrors: true,  // Skip TypeScript errors during builds
  },
  images: {
    unoptimized: true,        // Disable image optimization for static export
  },
}

πŸ”§ Usage

Dashboard Navigation

  1. Dashboard: View analytics and key metrics
  2. QR Generation: Create QR codes for assets
  3. Inventory: Manage railway components
  4. Analytics: Advanced reporting and insights
  5. Integration: System health and connectivity

Inventory Management

// Add new inventory item
const newItem = {
  batchId: "24-01-1234",
  vendor: "Tata Steel Limited",
  itemType: "Rail Joint",
  zone: "Northern Railway",
  location: "Section A, Track 1",
  // ... other properties
};

QR Code Generation

// Generate QR code
const qrData = {
  batchId: "24-01-1234",
  type: "Rail Joint",
  location: "Track Section A",
};

const qrCode = await generateQRCode(qrData);

Export Data

// Export inventory as CSV
handleExport('csv');

// Export as Excel
handleExport('excel');

// Export as JSON with metadata
handleExport('json');

// Print report
handleExport('print');

πŸ“Š API Reference

Inventory Endpoints

GET    /api/inventory           # Get all inventory items
POST   /api/inventory           # Create new item
PUT    /api/inventory/:id       # Update item
DELETE /api/inventory/:id       # Delete item

Analytics Endpoints

GET    /api/analytics/dashboard # Dashboard metrics
GET    /api/analytics/trends    # Trend data
GET    /api/analytics/zones     # Zone-wise analysis

QR Code Endpoints

POST   /api/qr/generate         # Generate QR code
GET    /api/qr/:id              # Get QR code data

Integration Endpoints

GET    /api/integration/status  # System health
POST   /api/integration/sync    # Sync data
GET    /api/integration/logs    # System logs

πŸ§ͺ Testing

Run Tests

# Run all tests
pnpm test

# Run tests in watch mode
pnpm test:watch

# Run tests with coverage
pnpm test:coverage

Test Structure

tests/
β”œβ”€β”€ __tests__/
β”‚   β”œβ”€β”€ components/     # Component tests
β”‚   β”œβ”€β”€ pages/         # Page tests
β”‚   └── utils/         # Utility tests
β”œβ”€β”€ __mocks__/         # Mock data
└── setup.ts           # Test setup

πŸš€ Deployment

Vercel Deployment (Recommended)

  1. Connect Repository

    npx vercel
  2. Configure Environment

    • Add environment variables in Vercel dashboard
    • Set build command: pnpm build
    • Set output directory: out
  3. Deploy

    npx vercel --prod

Static Export

# Generate static files
pnpm export

# Deploy to any static hosting
# Files will be in the 'out' directory

Docker Deployment

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]

🀝 Contributing

We welcome contributions! Please follow our guidelines:

Development Workflow

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

Code Standards

  • Use TypeScript for type safety
  • Follow ESLint rules
  • Write meaningful commit messages
  • Add tests for new features
  • Update documentation as needed

Pull Request Process

  1. Ensure your code builds successfully
  2. Update README.md with new features
  3. Add tests for your changes
  4. Request review from maintainers

πŸ“ˆ Roadmap

Q1 2025

  • πŸ” Authentication System - User management and role-based access
  • πŸ“± Mobile App - React Native companion app
  • πŸ€– Advanced AI - Machine learning models for predictive analytics

Q2 2025

  • 🌐 Multi-language Support - Internationalization (i18n)
  • πŸ“Š Advanced Reporting - Custom report builder
  • πŸ”— API Gateway - Standardized API management

Q3 2025

  • πŸ›°οΈ IoT Integration - Sensor data integration
  • πŸ“‘ Real-time Updates - WebSocket implementation
  • πŸ”’ Enhanced Security - Advanced security features

πŸ“ž Support

Get Help

Contact


πŸ“„ License

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

MIT License

Copyright (c) 2025 RailSuraksha

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

πŸ™ Acknowledgments

Built With

  • βš›οΈ React Team - For the amazing React framework
  • πŸ”— Vercel - For Next.js and hosting platform
  • 🎨 Tailwind Labs - For the utility-first CSS framework
  • 🧩 shadcn - For the beautiful component library
  • πŸ“Š Recharts Team - For the visualization library

Special Thanks

  • πŸš‚ Indian Railways - For inspiration and domain knowledge
  • πŸ‘₯ Open Source Community - For countless contributions
  • πŸ§‘β€πŸ’» Contributors - For making this project better

⭐ Star this repo if you find it helpful!

GitHub Stars GitHub Forks GitHub Issues

Made with ❀️ for the Railway Industry

πŸš€ Live Demo β€’ πŸ“š Documentation β€’ 🀝 Contribute

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 79.4%
  • HTML 17.1%
  • CSS 3.4%
  • JavaScript 0.1%