A mobile railway information application built with React Native, Expo, and TypeScript.
Train Tracker provides features for checking train routes, retrieving live train running information, and checking Passenger Name Record (PNR) status through external API services.
- Search for a train using its train number.
- Retrieve train name and train number.
- View the route and station information.
- Display arrival and departure times.
- View halt duration, distance from source, and journey day.
- Search using a train number.
- Fetch live running-status information.
- Display station-wise arrival and departure information.
- View day/date and reported delay information.
- Enter a 10-digit PNR number.
- Retrieve booking and current passenger status.
- Display train name and number.
- View source and destination station information.
- Display journey date, departure, arrival, and class.
- View passenger booking and current seat details.
- Display chart preparation status.
- Save successful PNR lookup responses locally.
- Store recent PNR information using AsyncStorage.
- Display the most recent saved PNR information on the home screen.
| Technology | Purpose |
|---|---|
| React Native | Mobile application development |
| Expo | Development and build environment |
| TypeScript | Type-safe application code |
| Expo Router | File-based navigation |
| AsyncStorage | Local PNR data storage |
| External REST APIs | Train route, live status, and PNR information |
| React Native Components | Mobile user interface |
```text train-tracker/ ├── api/ │ ├── apiConfig.ts │ ├── liveTrainService.ts │ ├── pnrService.ts │ └── trainRouteService.ts ├── app/ │ ├── (tabs)/ │ │ ├── index.tsx │ │ └── settings.tsx │ ├── live.tsx │ ├── pnr.tsx │ └── _layout.tsx ├── components/ ├── constants/ ├── hooks/ ├── assets/ ├── app.json ├── package.json └── README.md ```
- Node.js
- npm
- Expo development environment
- Android Studio or Xcode for emulator-based testing
- Required API credentials
```bash git clone https://github.com/ItsHardikSoni/train-tracker.git ```
```bash cd train-tracker ```
```bash npm install ```
The application uses external API services for train route, live train status, and PNR information.
Configure the following values through your Expo application configuration:
- API_KEY
- API_HOST
- PNR_API_HOST
- TRAIN_ROUTE_API_HOST
The API configuration currently reads these values from Expo configuration extras.
Do not commit real API keys or private credentials to the repository. Use environment-based configuration and keep secrets out of source control.
```bash npx expo start ```
You can then open the application using an available development build, Android emulator, iOS simulator, or compatible Expo Go setup.
The application separates external API requests into dedicated service files:
liveTrainService.ts– retrieves live train running status.pnrService.ts– retrieves PNR booking status.trainRouteService.ts– retrieves train route and station information.apiConfig.ts– provides API configuration values.
AsyncStorage is used to save successful PNR lookup information locally so that recent PNR details can be displayed when the user returns to the home screen.
- Train information depends on the availability and response format of the configured external API services.
- API access may require valid credentials and an active subscription.
- The application does not operate as an official railway reservation or ticket-booking platform.
- Live status and PNR results should be verified with official railway sources before making travel decisions.
- The home screen includes some sample recent-search entries.
Potential improvements include:
- Station search functionality.
- Better recent search history management.
- Improved API error handling and loading states.
- More detailed train schedule information.
- Secure environment-based API credential management.
Ayush