Modern Next.js dashboard for tracking Indian infrastructure development with real-time updates, AI chat, and interactive visualizations
- Overview
- System Architecture
- Features
- Tech Stack
- Project Structure
- Installation
- Configuration
- Pages & Routes
- Components
- Design System
- Development
Track India Frontend is a modern, responsive Next.js application that visualizes Indian infrastructure development data with real-time updates, AI-powered chat, interactive dashboards, and predictive analytics. Built with a clean black/white theme and full dark mode support.
- π Interactive Dashboard with live data visualizations
- π¬ AI Chat Interface powered by RAG + Gemini Pro
- π° Real-time Updates with filtering and search
- πΊοΈ Interactive Maps using Leaflet
- π Data Export to PDF with charts
- π Dark Mode with theme persistence
- β‘ Optimized Performance with prefetching and lazy loading
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Track India Frontend β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
β User Layer β β Presentation β β Data Layer β
ββββββββββββββββββββ€ ββββββββββββββββββββ€ ββββββββββββββββββββ€
β β’ Browser ββββββββββΆβ Next.js Pages βββββββββββ API Client β
β β’ Mobile β β β’ Dashboard β β β’ Fetch API β
β β’ Desktop β β β’ Updates β β β’ Error Handling β
ββββββββββββββββββββ β β’ Chat β β β’ Caching β
β β’ About β ββββββββββββββββββββ
ββββββββββββββββββββ β
β β
βΌ βΌ
ββββββββββββββββββββ ββββββββββββββββββββ
β Components β β Backend API β
ββββββββββββββββββββ€ ββββββββββββββββββββ€
β β’ Charts βββββββββββ Flask Server β
β β’ Maps β β β’ /api/updates β
β β’ Chat Interface β β β’ /api/stats β
β β’ Export Tools β β β’ /api/chat β
ββββββββββββββββββββ ββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β State & Context β
ββββββββββββββββββββ€
β β’ Theme Context β
β β’ React Query β
β β’ Local Storage β
ββββββββββββββββββββ
App Layout (layout.tsx)
βββ Navbar (global navigation)
βββ ThemeProvider (dark mode)
βββ Page Content
βββ Dashboard Page
β βββ Map Component (Leaflet)
β βββ Trend Chart (Recharts)
β βββ Driver Chart (Recharts)
β βββ Export Button (jsPDF)
β
βββ Updates Page
β βββ Filter Controls
β βββ Update Cards
β βββ Detail Page (dynamic route)
β
βββ Chat Page
β βββ ChatInterface
β βββ ChatMessage (markdown)
β βββ Source Citations
β
βββ About Page
βββ Feature Cards
βββ Team Section
- Interactive Map: District-wise project visualization using Leaflet
- Trend Charts: Time-series data with Recharts
- Driver Analysis: Top ministries by project count
- Quick Stats: Active projects, funding, policies, completed projects
- PDF Export: Download dashboard with charts as PDF
- Predictive Analytics: AI-powered trend forecasting
- Real-time Data: Auto-refresh from backend API
- Natural Language: Ask questions about infrastructure projects
- RAG-Powered: Retrieves relevant context before answering
- Source Citations: Each answer includes 5 relevant sources
- Markdown Support: Rich text formatting in responses
- Chat History: Maintains conversation context
- Loading States: Smooth animations during AI processing
- Real-time Feed: 50+ infrastructure updates from NewsAPI + data.gov.in
- Filtering: By type (all/news/project) and date
- Search: Full-text search across titles and descriptions
- Pagination: Efficient data loading with limits
- Detail Pages: Dynamic routes for individual updates
- Related Items: 5 similar updates on detail pages
- Impact Scores: Visual indicators for project significance
- Black/White Theme: Professional grayscale palette
- Dark Mode: Full support with theme toggle
- Responsive: Mobile-first design (320px - 4K)
- Animations: Framer Motion for smooth transitions
- Accessibility: ARIA labels, keyboard navigation
- Loading States: Custom liquid loader animation
- Consistent UI: Unified component library
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 14.0.0 | React framework with SSR/SSG |
| React | 18 | UI library |
| TypeScript | 5 | Type safety |
| Tailwind CSS | 3.3 | Utility-first styling |
| Technology | Purpose |
|---|---|
| Framer Motion | 10.16.16 - Smooth animations |
| GSAP | 3.13.0 - Advanced animations |
| Lucide React | 0.294.0 - Icon library |
| Technology | Purpose |
|---|---|
| Recharts | 2.8.0 - Charts and graphs |
| Leaflet | 1.9.4 - Interactive maps |
| React Leaflet | 4.2.1 - Leaflet React bindings |
| Technology | Purpose |
|---|---|
| React Query | 5.14.0 - Data fetching & caching |
| Zustand | 4.4.7 - Lightweight state management |
| Technology | Purpose |
|---|---|
| jsPDF | 2.5.1 - PDF generation |
| html2canvas | 1.4.1 - Screenshot to image |
| React Markdown | 10.1.0 - Markdown rendering |
Track-India-Null-Coders/
βββ src/
β βββ app/ # Next.js App Router
β β βββ layout.tsx # Root layout with navbar
β β βββ page.tsx # Home page
β β βββ loading.tsx # Loading state (LiquidLoader)
β β βββ globals.css # Global styles
β β β
β β βββ dashboard/ # Dashboard route
β β β βββ page.tsx # Main dashboard page
β β β βββ components/
β β β βββ Map.tsx # District map
β β β βββ TrendChart.tsx # Time-series chart
β β β βββ DriverChart.tsx # Ministry chart
β β β
β β βββ updates/ # Updates route
β β β βββ page.tsx # Updates listing
β β β βββ [id]/ # Dynamic route
β β β βββ page.tsx # Single update detail
β β β
β β βββ chat/ # Chat route
β β β βββ page.tsx # Chat page
β β β βββ components/
β β β βββ ChatInterface.tsx # Main chat UI
β β β βββ ChatMessage.tsx # Message component
β β β
β β βββ about/ # About route
β β βββ page.tsx # About page
β β
β βββ components/ # Shared components
β β βββ Navbar.tsx # Global navigation
β β βββ LoadingBar.tsx # Top progress bar
β β βββ LiquidLoader.tsx # Animated loader
β β βββ ExportButton.tsx # PDF export
β β βββ DistrictSearch.tsx # Search component
β β
β βββ contexts/ # React contexts
β β βββ ThemeContext.tsx # Dark mode provider
β β
β βββ lib/ # Utilities
β βββ api.ts # API client functions
β βββ charts.ts # Chart configurations
β
βββ public/ # Static assets
β βββ images/ # Images, logos, etc.
β
βββ tailwind.config.js # Tailwind configuration
βββ next.config.js # Next.js configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json # Dependencies
βββ README.md # This file
src/app/: Next.js 14 App Router pages and layoutssrc/components/: Reusable React componentssrc/contexts/: React Context providers for global statesrc/lib/: Utility functions and API clients
- Node.js 16+ (recommended: 18 LTS)
- npm or yarn package manager
- Backend API running on port 8010
cd Track-India-Null-Codersnpm install
# or
yarn installnpm run dev
# or
yarn devhttp://localhost:3000
Create a .env.local file if you need custom configuration:
# Backend API URL (default: http://localhost:8010)
NEXT_PUBLIC_API_URL=http://localhost:8010
# Analytics (optional)
NEXT_PUBLIC_GA_ID=your_google_analytics_idThe frontend connects to the Flask backend by default at http://localhost:8010. Update in src/lib/api.ts if needed:
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8010";| Route | File | Description |
|---|---|---|
/ |
app/page.tsx |
Home page with feature highlights |
/dashboard |
app/dashboard/page.tsx |
Interactive data dashboard |
/updates |
app/updates/page.tsx |
Live updates feed |
/updates/[id] |
app/updates/[id]/page.tsx |
Single update detail |
/chat |
app/chat/page.tsx |
AI-powered chat interface |
/about |
app/about/page.tsx |
About the project |
- Hero section with animations
- Feature cards (Dashboard, Chat, Updates)
- Quick navigation
- Dark mode support
- Interactive Map: Click districts for details
- Trend Chart: Time-series with multiple metrics
- Driver Chart: Top 10 ministries by projects
- Quick Stats: 4 key metrics
- Export PDF: Download full dashboard
- Predictive Analytics: AI-powered forecasts
- Filter Controls: Type (all/news/project), limit
- Update Cards: Title, description, date, source
- Pagination: Load more functionality
- Search: Filter by keywords
- Detail Links: Navigate to full update
- Full Content: Complete update information
- Impact Score: Visual progress indicator
- Quick Stats: Key metrics
- Related Updates: 5 similar items
- Back Navigation: Return to listing
- Share Options: Copy link, social media
- Message Input: Text area with submit
- Chat History: Conversation display
- AI Responses: Markdown-formatted answers
- Source Citations: Clickable sources
- Loading State: Animated while processing
- Error Handling: User-friendly error messages
- Mission Statement: Project goals
- Features: Key capabilities
- Data Sources: API information
- Technology Stack: Tech used
- Team: Null Coders information
// Global navigation with dark mode toggle
- Logo and branding
- Desktop navigation links
- Mobile hamburger menu
- Theme toggle button
- Prefetch enabled on all links// Top progress bar during navigation
- Grayscale gradient animation
- Auto-hide after page load
- Smooth transitions// Animated loading screen
- 7 liquid bars with physics
- Grayscale theme (black/white)
- Droplet animations
- Wave effects
- Dark mode support// PDF export functionality
- Captures current page
- Converts to PDF
- Includes charts and maps
- Download trigger// Interactive Leaflet map
- District boundaries
- Click interactions
- Tooltips
- Zoom controls
- Responsive sizing// Time-series line chart
- Multiple data series
- Responsive design
- Hover tooltips
- Legend
- Grid lines// Bar chart for ministry data
- Top 10 ministries
- Horizontal bars
- Color coding
- Value labels// Main chat container
- Message list
- Input form
- Auto-scroll
- Loading states
- Error handling// Individual message display
- User/AI differentiation
- Markdown rendering
- Source citations
- Timestamp
- AvatarBackground: white (#ffffff)
Text: gray-900 (#111827)
Accent: gray-900 (#111827)
Secondary: gray-600 (#4b5563)
Border: gray-200 (#e5e7eb)Background: black (#000000)
Text: white (#ffffff)
Accent: white (#ffffff)
Secondary: gray-300 (#d1d5db)
Border: gray-700 (#374151)Headings: font-bold
- h1: text-5xl (48px)
- h2: text-3xl (30px)
- h3: text-2xl (24px)
Body: font-normal
- Large: text-xl (20px)
- Base: text-base (16px)
- Small: text-sm (14px)Container: max-w-7xl mx-auto px-4
Section Padding: py-16
Component Gap: gap-6, gap-8// Framer Motion Variants
fadeIn: {
initial: { opacity: 0, y: 20 },
animate: { opacity: 1, y: 0 },
transition: { duration: 0.6 }
}
slideIn: {
initial: { x: -100, opacity: 0 },
animate: { x: 0, opacity: 1 },
transition: { type: "spring" }
}sm: 640px // Mobile landscape
md: 768px // Tablet portrait
lg: 1024px // Tablet landscape
xl: 1280px // Desktop
2xl: 1536px // Large desktop# Development server (hot reload)
npm run dev
# Production build
npm run build
# Start production server
npm start
# Lint code
npm run lint-
Start Backend
cd python python app.py -
Start Frontend
npm run dev
-
Open Browser
http://localhost:3000
- TypeScript: Strict mode enabled
- ESLint: Next.js recommended rules
- Prettier: Auto-formatting on save
- Components: Functional components with hooks
- CSS: Tailwind utility classes
β Implemented:
- Link prefetching on all navigation
- Image optimization with Next.js Image
- Code splitting by route
- Lazy loading for heavy components
- Debounced search inputs
- Memoized expensive computations
- React Query for data caching
| Metric | Value | Target |
|---|---|---|
| First Contentful Paint | <1.5s | β |
| Largest Contentful Paint | <2.5s | β |
| Time to Interactive | <3.5s | β |
| Cumulative Layout Shift | <0.1 | β |
| Lighthouse Score | 90+ | β |
-
Cannot connect to backend
- Ensure Flask server is running on port 8010
- Check API_BASE_URL in
lib/api.ts - Verify CORS is enabled in Flask
-
Charts not rendering
- Check if data is loading from API
- Open browser console for errors
- Verify Recharts is installed
-
Dark mode not working
- Clear browser local storage
- Check ThemeContext provider
- Verify theme toggle button
-
Build errors
# Clear cache and reinstall rm -rf .next node_modules npm install npm run build
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Production
vercel --prod# Build production
npm run build
# Start server
npm startNEXT_PUBLIC_API_URL=https://your-api-domain.com- User authentication
- Personalized dashboards
- Data export (CSV, Excel)
- Advanced filtering
- Real-time WebSocket updates
- Mobile app (React Native)
- Offline support (PWA)
- Multi-language support
Null Coders
Track India Hackathon Project β’ 2025
MIT License - See LICENSE file for details
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
For issues and questions:
- Create an issue on GitHub
- Contact: team@nullcoders.dev
Built with β€οΈ for India's Development Tracking