A lightweight Vercel-deployed proxy server and web UI for fetching live data from the National Stock Exchange of India (NSE) API. Bypasses browser CORS restrictions by routing requests through a serverless backend.
- CORS Proxy -- Routes requests to NSE India's API through a Vercel serverless function, avoiding browser-side CORS blocks
- Cookie Management -- Performs a warm-up request to
nseindia.comto obtain session cookies before making the actual API call - Live Web UI -- Clean, dark-themed frontend to input any NSE API path and view formatted JSON responses
- Configurable Endpoints -- Change the API path dynamically from the UI to test any NSE endpoint
- Response Caching -- Short-lived
Cache-Controlheaders (s-maxage=10) reduce redundant requests and lower the chance of IP blocks - Zero Dependencies -- Pure Node.js serverless function with no third-party packages
testtest/
├── api/
│ └── nse.js # Vercel serverless function (CORS proxy to NSE API)
├── index.html # Frontend UI for querying NSE data
├── Late_Night_PYQ_Marathons.min.html.gz # Compressed archived HTML asset
├── package.json # Project metadata
├── .gitignore # Git ignore rules
├── LICENSE # MIT License
└── README.md # Project documentation
- Node.js 18 or later
- A Vercel account (for deployment)
- Vercel CLI (optional, for local development)
-
Clone the repository
git clone https://github.com/tushar-alt/testtest.git cd testtest -
Install Vercel CLI (optional, for local dev)
npm install -g vercel
-
Link to your Vercel project (optional)
vercel link
vercel devThis starts a local development server. Open http://localhost:3000 in your browser.
vercel --prodDeploys the application to Vercel production.
- Open the deployed URL or
localhost:3000 - The default path is pre-filled with
NextApi/apiClient?functionName=getIndexData&type=All(fetches all index data) - Click Fetch to retrieve and display the JSON response
- Modify the path input to query other NSE API endpoints
The proxy function is available at:
GET /api/nse?path=<nse-api-path>
Parameters:
| Param | Type | Required | Description |
|---|---|---|---|
path |
string | Yes | The NSE API path (without the base URL prefix) |
Example:
GET /api/nse?path=NextApi/apiClient?functionName=getIndexData&type=All
Response: Proxied JSON from NSE India, with Access-Control-Allow-Origin: * header.
Browser --> /api/nse?path=... --> Vercel Serverless Function
|
|--> warm-up GET nseindia.com (grab cookies)
|--> GET nseindia.com/api/<path> (with cookies)
|
JSON response --> Browser
- The browser sends a request to
/api/nsewith the desired NSE path - The Vercel serverless function (
api/nse.js) first hitshttps://www.nseindia.com/to obtain session cookies - It then forwards the actual API request to
https://www.nseindia.com/api/<path>with the cookies attached - The response is sent back to the browser with permissive CORS headers
| Layer | Technology |
|---|---|
| Frontend | Vanilla HTML/CSS/JS |
| Backend | Vercel Serverless Functions (Node.js) |
| Deployment | Vercel |
| API Source | NSE India (nseindia.com) |
This project is licensed under the MIT License. See the LICENSE file for details.
tushar-alt -- 2026