A full-stack Indian Railways intelligence platform with live GPS tracking, AI journey assistant (RailMind), delay predictions, weather forecasting along route, elevation profiling, and POI discovery. Built for modern India, works on every device.
Trackly is not just another train tracking app. While apps like NTES, RailYatri, and ixigo only show you where the train is, Trackly tells you everything:
- Live position on an interactive map with smooth interpolation
- Why the train is delayed β weather, congestion, or upstream trains
- Whether you'll make your connecting train
- What you're passing through β rivers, mountains, monuments, cities
- AI answers to any question about your journey β no hallucinations, no guessing
The core differentiator is RailMind β a RAG-powered AI assistant strictly scoped to Indian Railways data, always cites its source, and honestly says "I don't know" rather than making things up.
- Real-time position from RailRadar API with smooth interpolation between pings
- Animated train marker on interactive MapLibre GL map
- Full route visualization β orange for covered, grey for remaining
- Station dots with popups showing arrival/departure times
- Speed indicator (km/h), delay status, last update timestamp
- Auto-refresh every 30 seconds
- Search any train by number (e.g.
12951) or name (e.g.Rajdhani) - Instant results with live delay badge
- Recent searches saved locally
- Favourite trains for quick access
- Journey completion percentage with distance covered and remaining
- Delay trend analysis (improving / stable / worsening)
- Elevation profile along the entire route
- Station arrival history (actual vs scheduled)
- Current weather at every station along the route
- Rain probability and fog alerts that affect delays
- Temperature range across the full journey
- Route-wide weather delay risk score (High / Medium / Low)
- Points of interest along the route via OpenStreetMap Overpass API
- Rivers, mountains, heritage sites, tourist attractions near each station
- Elevation profile chart powered by OpenTopoData
- Powered by Groq Llama 3.3-70b β fastest free LLM available
- 3-layer hallucination prevention system
- Confidence scoring on every response (HIGH / MEDIUM / LOW)
- Hard scope boundary β refuses all non-railway questions
- Suggested follow-up questions after every answer
- Journey-aware β knows your current train's live status
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 14.2.5 | React framework with App Router |
| TypeScript | 5.x | Type safety across the codebase |
| TailwindCSS | 3.4 | Utility-first styling |
| MapLibre GL JS | 4.5.0 | Interactive map rendering |
| Zustand | 4.5 | Lightweight global state management |
| Recharts | 2.12 | Elevation profile chart |
| Lucide React | 0.400 | Icon library (no emojis) |
| Framer Motion | 11.3 | Page transitions and animations |
| Axios | 1.7 | HTTP client with interceptors |
| Technology | Version | Purpose |
|---|---|---|
| FastAPI | 0.111 | High-performance Python web framework |
| Uvicorn | 0.30 | ASGI server with WebSocket support |
| Groq SDK | 0.9 | LLM API client |
| LangChain | 0.2.6 | RAG pipeline orchestration |
| ChromaDB | 0.5.3 | Local vector database |
| sentence-transformers | 3.0.1 | Free local text embeddings |
| httpx | 0.27 | Async HTTP client |
| Pydantic | 2.7 | Request/response data validation |
| BeautifulSoup4 | 4.12 | HTML parsing for NTES fallback |
| APScheduler | 3.10 | Background scheduling |
| WebSockets | 12.0 | Real-time live position updates |
| Model | Provider | Temperature | Use Case |
|---|---|---|---|
llama-3.1-8b-instant |
Groq (free) | 0.0 | Intent classifier β binary, fast |
llama-3.1-8b-instant |
Groq (free) | 0.0 | Entity extraction β JSON output |
llama-3.3-70b-versatile |
Groq (free) | 0.1 | Main RailMind responses |
mixtral-8x7b-32768 |
Groq (free) | 0.1 | Long-context route analysis |
all-MiniLM-L6-v2 |
HuggingFace (local) | β | Text embeddings for ChromaDB |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER BROWSER β
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββββ β
β β Next.js 14 β β MapLibre GL β β RailMind Chat UI β β
β β App Router β β Interactive β β (React Component) β β
β β 5 Tab Pages β β Map β β Confidence Badges β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββββββ¬ββββββββββββ β
β βββββββββββββββββββ΄βββββββββββββββββββββββ β
β β HTTP / WebSocket / REST β
βββββββββββββββββββββββββββββͺβββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββͺβββββββββββββββββββββββββββββββββββββββ
β FASTAPI BACKEND β
β β β
β ββββββββββ¬ββββββββ¬ββββββββ΄ββ¬βββββββββ¬ββββββββββ¬ββββββββββββ β
β β/search β/trainsβ /live β /ai β/weather β/elevation β β
β β Router β Routerβ Router β Router β Router β /poi β β
β βββββ¬βββββ΄ββββ¬ββββ΄βββββ¬βββββ΄βββββ¬ββββ΄βββββ¬βββββ΄ββββββββββββ β
β β β β β β β
β βββββΌβββββββββΌβββββββββΌβββ βββββΌβββββββ ββββΌβββββββββββββββ β
β β TrainService β β RailMind β β WeatherService β β
β β β β RAG β β + GeoService β β
β β β’ RailRadar API β β Pipeline β β β β
β β β’ NTES fallback β β β β Open-Meteo β β
β β β’ Position interpolate β β ChromaDB β β OpenTopoData β β
β β β’ WebSocket broadcast β β + Groq β β Overpass API β β
β ββββββββββββββββββββββββββ ββββββββββββ ββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββͺβββββββββββββββββββββββββββββββββββββββ
β EXTERNAL APIs (All Free Tier) β
β β
β βββββββββββββββ ββββββββββββ ββββββββββββββ βββββββββββββββββ β
β β RailRadar β β MapTiler β β Open-Meteo β β OpenTopoData β β
β β 50 req/day β β 100k/mo β β unlimited β β 1000 req/day β β
β βββββββββββββββ ββββββββββββ ββββββββββββββ βββββββββββββββββ β
β β
β βββββββββββββββ ββββββββββββ ββββββββββββββββββββββββββββββββββ β
β β Overpass β βNominatim β β Groq API β β
β β OSM POI β βGeocoding β β llama-3.3-70b (free tier) β β
β β unlimited β β free β β 500k tokens/day free β β
β βββββββββββββββ ββββββββββββ ββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
User types "12951" or "Rajdhani"
β
βΌ debounce 300ms
GET /api/search/?q=12951
β
βΌ
TrainService.search_trains()
β
ββββΊ RailRadar /v1/lookup/trains?q=12951
β β
β 200 OK β parse {number, name, source, dest}
β 429 β show rate limit message
β 404 β empty results
β
βΌ
Return SearchResult[] with delay badge
β
βΌ
Render dropdown β click to go to /train/12951
User opens /train/12951
β
βΌ Parallel fetch
βββββββββββββββββββββββ
β GET /api/trains/id β GET /api/live/id
β Full schedule β Current position
β All stations β Delay in minutes
βββββββββββββββββββββββ Speed (km/h)
β
βΌ
MapLibre map.on('load'):
βββ addSource('full') β grey route line
βββ addSource('done') β orange completed line
βββ forEach station β dot marker + popup
βββ trainMarker β orange circle icon
β
βΌ
fitBounds() β zoom to show entire route
β
βΌ
Poll every 30s:
GET /api/live/12951
β
βββ trainMarker.setLngLat([lng, lat])
βββ source('done').setData(completedCoords)
βββ Update stats grid
User: "Will my train reach Mumbai on time?"
β
ββββββββββΌβββββββββ
β INTENT CHECK β llama-3.1-8b / temp=0.0
β Railway? YES/NO β ~180ms
ββββββββββ¬βββββββββ
β YES only
ββββββββββΌβββββββββ
β EXTRACT ENTITY β llama-3.1-8b / temp=0.0
β train=12951 β JSON output
β type=delay β
ββββββββββ¬βββββββββ
β
ββββββββββΌβββββββββ
β CHROMADB RAG β Local vector search
β Find relevant β Top 4 chunks returned
β schedule data β
ββββββββββ¬βββββββββ
β
ββββββββββΌβββββββββ
β INJECT LIVE β From RailRadar API
β delay=23 mins β Real-time context
β station=Surat β
ββββββββββ¬βββββββββ
β
ββββββββββΌβββββββββββββββββββββββββββββββββββββ
β GROUNDED RESPONSE llama-3.3-70b / temp=0.1 β
β β
β System prompt enforces: β
β β’ Only answer from provided context β
β β’ Never invent train numbers or timings β
β β’ Add [CONFIDENCE: HIGH/MEDIUM/LOW] β
β β’ Add [SOURCE: Live API / Schedule DB] β
β β’ Max 180 words, suggest 2 follow-ups β
ββββββββββ¬ββββββββββββββββββββββββββββββββββββββ
β
βΌ
Response with badge:
π’ HIGH β from live API
π‘ MEDIUM β from schedule DB
π΄ LOW β estimated/inferred
Query enters
β
βΌ
[Gate 1] Is it about railways?
NO βββββββββββββββββββββββΊ "I only answer railway questions"
β
YES
βΌ
[Gate 2] ChromaDB retrieval
Empty βββββββββββββββββββββΊ "No data β check NTES or IRCTC"
β
Has context
βΌ
[Gate 3] LLM with constraints
Temperature 0.1 (near-zero creativity)
"ONLY use the context provided below"
"NEVER invent train numbers or timings"
β
βΌ
[Gate 4] Confidence tagging
Live API data β HIGH confidence
Schedule database β MEDIUM confidence
Inferred/estimated β LOW confidence
β
βΌ
Response shown with confidence badge + source
trackly/
β
βββ README.md β This file
βββ start.sh β One-command startup script
β
βββ backend/ β Python FastAPI server
β βββ main.py β Entry point, CORS, lifespan hooks
β βββ requirements.txt β All Python dependencies
β βββ .env.example β Template (copy to .env)
β β
β βββ routers/ β HTTP route handlers
β β βββ search.py β GET /api/search/?q=
β β βββ trains.py β GET /api/trains/{id}
β β βββ live.py β GET + WS /api/live/{id}
β β βββ ai.py β POST /api/ai/chat
β β βββ weather.py β GET /api/weather/{id}
β β βββ elevation.py β GET /api/elevation/{id}
β β βββ poi.py β GET /api/poi/{id}
β β
β βββ services/ β Core business logic
β β βββ train_service.py β RailRadar + NTES integration
β β βββ rag_pipeline.py β Groq + ChromaDB RAG engine
β β βββ weather_service.py β Open-Meteo integration
β β βββ geo_service.py β Elevation + POI services
β β
β βββ models/
β βββ train.py β Pydantic request/response models
β
βββ frontend/ β Next.js React application
βββ next.config.js β Next.js + env var config
βββ tailwind.config.ts β Brand colors, design tokens
βββ package.json β Node dependencies
βββ tsconfig.json β TypeScript config
β
βββ src/
βββ app/ β Next.js App Router
β βββ layout.tsx β Root layout + Navbar
β βββ page.tsx β Homepage β hero + search
β βββ globals.css β Global styles
β βββ search/page.tsx β Full-page search
β βββ favourites/page.tsx β Saved trains list
β βββ settings/page.tsx β API keys + about
β βββ train/[id]/page.tsx β Train detail (5 tabs)
β
βββ components/
β βββ layout/
β β βββ Navbar.tsx β Top nav with route awareness
β βββ tracking/
β β βββ LiveTrackingTab.tsx β MapLibre map + live data
β β βββ StationTimeline.tsx β All stops with status
β β βββ WeatherTab.tsx β Per-station weather cards
β βββ analytics/
β β βββ AnalyticsTab.tsx β Elevation chart + POI list
β βββ ai/
β βββ RailMindChat.tsx β Chat UI with confidence badges
β
βββ lib/
βββ api.ts β Typed Axios client + interfaces
βββ store.ts β Zustand β recents, favourites, state
Base URL: http://localhost:8000/api
Interactive docs at http://localhost:8000/docs
| Method | Endpoint | Description |
|---|---|---|
GET |
/search/?q={query} |
Search trains by number or name |
GET |
/trains/{id} |
Full schedule + all stations |
GET |
/trains/{id}/status |
Current running status |
GET |
/live/{id} |
Live position + delay (HTTP) |
WS |
/live/ws/{id} |
WebSocket stream (30s interval) |
POST |
/ai/chat |
RailMind AI conversation |
GET |
/ai/suggestions/{id} |
Proactive AI journey alerts |
GET |
/weather/{id} |
Weather for all route stations |
GET |
/elevation/{id} |
Elevation profile data |
GET |
/poi/{id} |
Points of interest along route |
| API | Provides | Free Limit | Key? |
|---|---|---|---|
| RailRadar | Live tracking, schedules, search | 50 req/day | Yes β railradar.in/developers |
| Groq | LLM inference (Llama 3.3) | 500k tokens/day | Yes β console.groq.com |
| MapTiler | Vector map tiles | 100k tiles/month | Yes β maptiler.com |
| Open-Meteo | Weather forecast | Unlimited | No |
| OpenTopoData | Elevation (SRTM) | 1000 req/day | No |
| Overpass API | OSM points of interest | Unlimited | No |
| Nominatim | Reverse geocoding | Fair use | No |
Total cost for full MVP: βΉ0 / month
- Node.js 18+
- Python 3.11+
- Git
git clone https://github.com/yourusername/trackly.git
cd tracklyRailRadar β https://railradar.in/developers (2 min)
Groq β https://console.groq.com (2 min)
MapTiler β https://maptiler.com (2 min)
cd backend
cp .env.example .env
# Edit .env β add RAILRADAR_API_KEY and GROQ_API_KEY
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python main.py
# β
http://localhost:8000
# π http://localhost:8000/docscd frontend
cp .env.local.example .env.local
# Edit .env.local β add NEXT_PUBLIC_MAPTILER_KEY
npm install
npm run dev
# β
http://localhost:3000RAILRADAR_API_KEY=rr_live_xxxxxxxxxxxxxxxx # required
GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxxxxxx # required
REDIS_URL=redis://localhost:6379 # optional
APP_ENV=development
CORS_ORIGINS=http://localhost:3000NEXT_PUBLIC_MAPTILER_KEY=your_key_here # required
NEXT_PUBLIC_API_URL=http://localhost:8000 # change in production1. Push repo to GitHub
2. render.com β New Web Service β Connect repo
3. Build command: pip install -r requirements.txt
4. Start command: uvicorn main:app --host 0.0.0.0 --port $PORT
5. Add env vars in Render dashboard
1. vercel.com β Import project β Connect GitHub repo
2. Framework: Next.js (auto-detected)
3. Environment variables:
NEXT_PUBLIC_API_URL = https://your-app.onrender.com
NEXT_PUBLIC_MAPTILER_KEY = your_maptiler_key
4. Deploy
Ankit β‘
"No cap, Indian Railways just got an upgrade."