Advanced Railway Track Fitting Management with AI-Driven Analytics
- π― Overview
- β¨ Features
- ποΈ Architecture
- π Quick Start
- π± Screenshots
- π οΈ Tech Stack
- π¦ Installation
- βοΈ Configuration
- π§ Usage
- π API Reference
- π§ͺ Testing
- π Deployment
- π€ Contributing
- π License
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.
- π 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
- 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)
- 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
- 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
- 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
- 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
βββ π¨ 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)
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
- Node.js 18.0+
- pnpm 8.0+ (recommended) or npm
- Git for version control
git clone https://github.com/YashhhCodesHere/rail-suraksha.git
cd rail-surakshapnpm installpnpm devVisit http://localhost:3000 in your browser.
| 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 |
| 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 |
| Tool | Purpose |
|---|---|
| π¦ pnpm | Package Manager |
| π ESLint | Code Linting |
| π― TypeScript | Static Type Checking |
| π¨ PostCSS | CSS Processing |
| β‘ Vercel Analytics | Performance Monitoring |
-
Clone and Navigate
git clone https://github.com/YashhhCodesHere/rail-suraksha.git cd rail-suraksha -
Install Dependencies
# Using pnpm (recommended) pnpm install # Or using npm npm install # Or using yarn yarn install
-
Environment Setup
cp .env.example .env.local # Edit .env.local with your configuration -
Start Development
pnpm dev
# Build for production
pnpm build
# Start production server
pnpm start
# Export static files
pnpm exportCreate 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=trueThe 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
},
}- Dashboard: View analytics and key metrics
- QR Generation: Create QR codes for assets
- Inventory: Manage railway components
- Analytics: Advanced reporting and insights
- Integration: System health and connectivity
// 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
};// Generate QR code
const qrData = {
batchId: "24-01-1234",
type: "Rail Joint",
location: "Track Section A",
};
const qrCode = await generateQRCode(qrData);// Export inventory as CSV
handleExport('csv');
// Export as Excel
handleExport('excel');
// Export as JSON with metadata
handleExport('json');
// Print report
handleExport('print');GET /api/inventory # Get all inventory items
POST /api/inventory # Create new item
PUT /api/inventory/:id # Update item
DELETE /api/inventory/:id # Delete itemGET /api/analytics/dashboard # Dashboard metrics
GET /api/analytics/trends # Trend data
GET /api/analytics/zones # Zone-wise analysisPOST /api/qr/generate # Generate QR code
GET /api/qr/:id # Get QR code dataGET /api/integration/status # System health
POST /api/integration/sync # Sync data
GET /api/integration/logs # System logs# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:coveragetests/
βββ __tests__/
β βββ components/ # Component tests
β βββ pages/ # Page tests
β βββ utils/ # Utility tests
βββ __mocks__/ # Mock data
βββ setup.ts # Test setup
-
Connect Repository
npx vercel
-
Configure Environment
- Add environment variables in Vercel dashboard
- Set build command:
pnpm build - Set output directory:
out
-
Deploy
npx vercel --prod
# Generate static files
pnpm export
# Deploy to any static hosting
# Files will be in the 'out' directoryFROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]We welcome contributions! Please follow our guidelines:
- 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
- Use TypeScript for type safety
- Follow ESLint rules
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
- Ensure your code builds successfully
- Update README.md with new features
- Add tests for your changes
- Request review from maintainers
- π Authentication System - User management and role-based access
- π± Mobile App - React Native companion app
- π€ Advanced AI - Machine learning models for predictive analytics
- π Multi-language Support - Internationalization (i18n)
- π Advanced Reporting - Custom report builder
- π API Gateway - Standardized API management
- π°οΈ IoT Integration - Sensor data integration
- π‘ Real-time Updates - WebSocket implementation
- π Enhanced Security - Advanced security features
- π Documentation: Check our comprehensive docs
- π Bug Reports: Create an issue
- π‘ Feature Requests: Request a feature
- π¬ Discussions: Join discussions
- π§βπ» Developer: YashhhCodesHere
- π§ Email: support@railsuraksha.com
- π Website: railsuraksha.com
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.
- βοΈ 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
- π 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!
Made with β€οΈ for the Railway Industry