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

filogram

v1.0.1

Published

Why pay for cloud storage? Store files directly in Telegram with a clean REST API. Zero cost, zero hassle.

Readme

📁 Filogram

Why pay for cloud storage? Store files directly in Telegram with a clean REST API. Zero cost, zero hassle.


📦 Tech Stack

  • Node.js + Express.js – API server
  • MongoDB + Mongoose – Store file metadata
  • Multer – Handle multipart file uploads (memory storage)
  • Axios – Call Telegram Bot API
  • dotenv – Environment variable management

🚀 Getting Started

Option A — Use as an npm Package (Recommended)

1. Install globally:

npm install -g filogram

2. Create a .env file anywhere on your machine:

PORT=3000
MONGO_URI=mongodb://localhost:27017/my-files
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here

3. Run from the same folder as your .env:

filogram

You should see:

✅ Connected to MongoDB
🚀 Server running on http://localhost:3000

Option B — Run Locally (Development)

1. Prerequisites

  • Node.js v18+
  • MongoDB running locally or a MongoDB Atlas URI
  • A Telegram bot token (create one via @BotFather)
  • Your Telegram Chat ID (send a message to your bot, then visit https://api.telegram.org/bot<TOKEN>/getUpdates)

2. Clone & Install

cd filogram
npm install

3. Configure Environment

Copy .env.example to .env and fill in your values:

cp .env.example .env
PORT=3000
MONGO_URI=mongodb://localhost:27017/filogram
TELEGRAM_BOT_TOKEN=your_real_token_here
TELEGRAM_CHAT_ID=your_chat_id_here

4. Run the Server

npm run dev   # development
npm start     # production

Server starts at: http://localhost:3000


📡 API Endpoints

1. POST /api/upload – Upload a file

| Field | Value | |---|---| | Method | POST | | URL | http://localhost:3000/api/upload | | Body type | form-data | | Key | file (type: File) | | Allowed types | PDF, JPG, PNG | | Max size | 50 MB |

Response:

{
  "success": true,
  "id": "65f1a2b3c4d5e6f7a8b9c0d1",
  "name": "file.pdf"
}

2. GET /api/file/:id – Get file download URL

| Field | Value | |---|---| | Method | GET | | URL | http://localhost:3000/api/file/65f1a2b3c4d5e6f7a8b9c0d1 |

Replace 65f1a2b3c4d5e6f7a8b9c0d1 with the id returned from the upload endpoint.

Response:

{
  "success": true,
  "id": "65f1a2b3c4d5e6f7a8b9c0d1",
  "name": "file.pdf",
  "url": "https://api.telegram.org/file/bot<TOKEN>/documents/file_123.pdf",
  "createdAt": "2024-03-23T10:00:00.000Z"
}

⚠️ Telegram file URLs expire after ~1 hour. Always call this endpoint to get a fresh URL.


3. GET /api/files – List all uploaded files

| Field | Value | |---|---| | Method | GET | | URL | http://localhost:3000/api/files |

Response:

{
  "success": true,
  "count": 2,
  "files": [
    {
      "_id": "65f1a2b3c4d5e6f7a8b9c0d1",
      "originalName": "file.pdf",
      "telegramFileId": "BQACAgIAA...",
      "createdAt": "2024-03-23T10:00:00.000Z"
    }
  ]
}

📁 Project Structure

filogram/
├── controllers/
│   └── fileController.js
├── models/
│   └── File.js
├── routes/
│   └── fileRoutes.js
├── services/
│   └── telegramService.js
├── utils/
│   └── fileFilter.js
├── app.js
├── server.js
├── .env.example
└── package.json

❌ Error Responses

All errors return JSON in this shape:

{
  "success": false,
  "error": "Description of the error"
}

| Scenario | Status | |---|---| | No file provided | 400 | | Invalid file type | 400 | | File too large (>50MB) | 400 | | File ID not found in DB | 404 | | Telegram / server error | 500 |