npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bhagyasreeborse

v1.0.1

Published

API wrapper for SRM Academia portal

Readme

SRM Academia API

A RESTful API wrapper for SRM Academia student portal using Puppeteer for browser automation. Connect any frontend to access your academic data.

Features

  • 🔐 Authentication - Secure login to SRM Academia via browser automation
  • 👤 Profile - Get student profile information
  • 📚 Courses - View enrolled courses
  • 📊 Attendance - Track attendance with summaries
  • 📝 Marks - View internal marks and assessments
  • 📅 Timetable - Daily and weekly class schedule

Quick Start

1. Install Dependencies

npm install

2. Configure Environment

Create a .env file:

PORT=3000
[email protected]
SRM_PASSWORD=your_correct_password

3. Start the Server

# Development mode (with auto-reload)
npm run dev

# Production mode
npm start

The server will start at http://localhost:3000

API Endpoints

Health Check

curl http://localhost:3000/api/health

Authentication

Login (use your SRM credentials)

curl -X POST http://localhost:3000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","password":"your_password"}'

Or use credentials from .env:

curl -X POST http://localhost:3000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{}'

Check Login Status

curl http://localhost:3000/api/auth/status

If CAPTCHA appears

# 1) Call login first; if captchaRequired=true, read captcha from /tmp/after-login.png
# 2) Submit captcha:
curl -X POST http://localhost:3000/api/auth/captcha \
  -H "Content-Type: application/json" \
  -d '{"captcha":"YOUR_CAPTCHA_TEXT"}'

Logout

curl -X POST http://localhost:3000/api/auth/logout

Academic Data (requires login first)

| Method | Endpoint | Description | |--------|----------|-------------| | GET | /api/academic/profile | Get student profile | | GET | /api/academic/courses | Get enrolled courses | | GET | /api/academic/day-order | Get current day order | | GET | /api/attendance | Get all attendance data | | GET | /api/attendance/summary | Get attendance summary | | GET | /api/marks | Get all marks | | GET | /api/marks/internal | Get internal marks summary | | GET | /api/timetable/today | Get today's schedule | | GET | /api/timetable/week | Get weekly timetable | | GET | /api/timetable/:day | Get specific day (monday-saturday) |

Usage Examples

Complete Flow

# 1. Login first
curl -X POST http://localhost:3000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","password":"your_password"}'

# 2. Get your attendance
curl http://localhost:3000/api/attendance

# 3. Get today's timetable
curl http://localhost:3000/api/timetable/today

# 4. Logout when done
curl -X POST http://localhost:3000/api/auth/logout

JavaScript (Fetch)

const API_URL = 'http://localhost:3000/api';

// Login
async function login(email, password) {
  const response = await fetch(`${API_URL}/auth/login`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ email, password })
  });
  return response.json();
}

// Get Attendance
async function getAttendance() {
  const response = await fetch(`${API_URL}/attendance`);
  return response.json();
}

// Usage
await login('[email protected]', 'your_password');
const attendance = await getAttendance();
console.log(attendance);

React Example

import { useState, useEffect } from 'react';

function AttendanceDashboard() {
  const [attendance, setAttendance] = useState(null);
  const [loggedIn, setLoggedIn] = useState(false);

  const login = async () => {
    const res = await fetch('http://localhost:3000/api/auth/login', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        email: '[email protected]',
        password: 'your_password'
      })
    });
    const data = await res.json();
    if (data.success) setLoggedIn(true);
  };

  const fetchAttendance = async () => {
    const res = await fetch('http://localhost:3000/api/attendance/summary');
    const data = await res.json();
    setAttendance(data.data);
  };

  useEffect(() => {
    if (loggedIn) fetchAttendance();
  }, [loggedIn]);

  return (
    <div>
      {!loggedIn ? (
        <button onClick={login}>Login to Academia</button>
      ) : (
        <div>
          <h2>Overall: {attendance?.overallPercentage}</h2>
          {attendance?.breakdown?.map(course => (
            <p key={course.course}>{course.course}: {course.percentage}</p>
          ))}
        </div>
      )}
    </div>
  );
}

Project Structure

srm-academia-api/
├── src/
│   ├── index.js                    # Express server entry
│   ├── routes/
│   │   ├── auth.js                 # Authentication routes
│   │   ├── academic.js             # Profile & courses
│   │   ├── attendance.js           # Attendance routes
│   │   ├── marks.js                # Marks routes
│   │   └── timetable.js            # Timetable routes
│   └── services/
│       └── puppeteerService.js     # Browser automation
├── .env                            # Your credentials (don't commit!)
├── .env.example                    # Example env file
├── .gitignore
├── package.json
└── README.md

How It Works

This API uses Puppeteer (headless Chrome) to:

  1. Navigate to SRM Academia portal
  2. Handle the login form within the iframe
  3. Navigate to various pages and extract data
  4. Return structured JSON responses

Troubleshooting

"Incorrect password"

  • Double-check your password on the actual SRM Academia website
  • Passwords are case-sensitive

"Could not find email input"

  • The portal structure may have changed
  • Check /tmp/login-debug.png for screenshots

Slow responses

  • First request takes longer (browser launch)
  • Subsequent requests are faster (session reuse)

Security Notes

⚠️ Important:

  • Never commit your .env file with credentials
  • Use environment variables in production
  • This is for personal use only
  • The browser runs in headless mode

Requirements

  • Node.js 18+
  • Chromium (installed automatically with Puppeteer)

License

MIT