> ## ⚠️ DEPRECATION NOTICE
>
> **`irctc-connect` has been renamed to [`railkit`](https://www.npmjs.com/package/railkit).**
>
> This package will continue to work for now, but it will **not** receive new features, bug fixes, or security updates. Please migrate to `railkit` as soon as possible.
>
> ### 🔄 Migrate in 3 steps
>
> ```bash
> # 1. Remove the old package
> npm uninstall irctc-connect
>
> # 2. Install the new package
> npm install railkit
> ```
>
> ```diff
> - import { configure, checkPNRStatus } from "irctc-connect";
> + import { configure, checkPNRStatus } from "railkit";
> ```
>
> 📖 **New documentation:** [https://railkit.rajivdubey.dev](https://railkit.rajivdubey.dev)
> 📦 **New repository:** [github.com/RAJIV81205/RailKit](https://github.com/RAJIV81205/RailKit)
> 🚀 **npm page:** [npmjs.com/package/railkit](https://www.npmjs.com/package/railkit)
>
> ---

# IRCTC Connect (DEPRECATED)

[![npm version](https://badge.fury.io/js/irctc-connect.svg)](https://www.npmjs.com/package/irctc-connect)
[![Downloads](https://img.shields.io/npm/dm/irctc-connect.svg)](https://www.npmjs.com/package/irctc-connect)
[![License: ISC](https://img.shields.io/npm/l/irctc-connect.svg)](https://github.com/RAJIV81205/RailKit/blob/main/LICENSE)
[![Status: Deprecated](https://img.shields.io/badge/status-deprecated-red.svg)](#-deprecation-notice)

<img width="1536" height="657" alt="IRCTC Connect Banner" src="https://github.com/user-attachments/assets/39c770a2-639c-443c-93b6-4e78889e78b0" />

> **Heads up:** This is the **legacy** `irctc-connect` package. It still works, but the actively maintained successor is **[`railkit`](https://www.npmjs.com/package/railkit)**. New users should install `railkit` directly.

A comprehensive Node.js SDK for Indian Railways. Get real-time PNR status, train information, live tracking, station updates, train search, and seat availability — all through a single, clean API.

---

## ✨ Features

- 🎫 **PNR Status** — Real-time PNR status with full passenger details
- 🚂 **Train Information** — Complete train details with station-by-station route
- 📍 **Live Train Tracking** — Real-time position and delay info for any train
- 🚉 **Live Station Board** — Upcoming trains at any station right now
- 🔍 **Train Search** — Find all direct trains between two stations
- 💺 **Seat Availability** — Check availability and fare for any class and quota
- 💰 **Fare Lookup** — Full fare breakdown for any train, class, and quota
- ⚡ **Fast & Reliable** — Built-in timeout handling, input validation, and caching

---

## 📦 Installation (NEW package — recommended)

```bash
npm install railkit
```

### Legacy installation (this package)

If you specifically need the legacy `irctc-connect` package — for example to keep an existing project running while you migrate — you can still install it, but a deprecation warning will be shown on every install/update:

```bash
npm install irctc-connect@^3.3.1
```

---

## 🔑 Getting an API Key

1. Visit **[railkit.rajivdubey.dev](https://railkit.rajivdubey.dev)**
2. Sign up and navigate to your Dashboard
3. Generate an API key from the **API Keys** section
4. Copy the key — you'll use it in the next step

---

## 🚀 Quick Start

### Step 1 — Add your API key to `.env`

```bash
# .env
IRCTC_API_KEY=your_api_key_here
```

### Step 2 — Use the SDK

**With the new `railkit` package (recommended):**

```js
import { configure, checkPNRStatus } from "railkit";

configure(process.env.IRCTC_API_KEY);

const result = await checkPNRStatus("1234567890");
console.log(result);
```

**With the legacy `irctc-connect` package (still works):**

```js
import { configure, checkPNRStatus } from "irctc-connect";

configure(process.env.IRCTC_API_KEY);

const result = await checkPNRStatus("1234567890");
console.log(result);
```

The API surface is identical — once you've swapped the import, you're done.

---

## 🧭 Migration Checklist

- [ ] Run `npm uninstall irctc-connect`
- [ ] Run `npm install railkit`
- [ ] Replace every `from "irctc-connect"` with `from "railkit"`
- [ ] Re-test your application
- [ ] Deploy 🚀

The `configure(apiKey)` call and all function names/signatures remain the same, so no other code changes are required.

---

## 📚 Documentation

| Resource          | Link                                                                                  |
| ----------------- | ------------------------------------------------------------------------------------- |
| New docs site     | <https://railkit.rajivdubey.dev>                                                      |
| npm (new package) | <https://www.npmjs.com/package/railkit>                                               |
| GitHub repository | <https://github.com/RAJIV81205/RailKit>                                               |
| Issues            | <https://github.com/RAJIV81205/RailKit/issues>                                        |

---

## 📜 License

ISC © [Rajiv81205](https://github.com/RAJIV81205)
