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

devflux

v1.1.0

Published

A TypeScript SDK for the dev.to API with full type safety and comprehensive documentation

Readme

DevFlux

A TypeScript SDK for the dev.to API with full type safety and comprehensive documentation.

npm version TypeScript License: MIT

Features

Full TypeScript Support - Built with TypeScript, includes comprehensive type definitions
📚 Extensive Documentation - JSDoc comments on all methods and types
🎯 Type-Safe - Catch errors at compile time, not runtime
🚀 Modern - Supports both ESM and CommonJS
🪶 Lightweight - Zero dependencies
🔧 Flexible - Customizable configuration options

Installation

npm install devflux

Or with yarn:

yarn add devflux

Or with pnpm:

pnpm add devflux

Quick Start

import { DevFluxClient } from 'devflux';

// Create a client instance
const client = new DevFluxClient();

// Fetch articles
const articles = await client.getArticles({ per_page: 10 });

console.log(articles[0].title);

Usage Examples

Fetch Articles by Username

const client = new DevFluxClient();

// Get all articles by a specific user
const articles = await client.getArticlesByUsername('zororaka', {
  page: 1,
  per_page: 30
});

articles.forEach(article => {
  console.log(`${article.title} - ${article.readable_publish_date}`);
});

Fetch Articles by Tag

const client = new DevFluxClient();

// Get articles tagged with 'javascript'
const jsArticles = await client.getArticlesByTag('javascript', {
  per_page: 20
});

Fetch Top Articles

const client = new DevFluxClient();

// Get top articles from the last 7 days
const topWeekly = await client.getTopArticles(7);

// Get top articles from the last month
const topMonthly = await client.getTopArticles(30);

// Get top articles of all time
const topAllTime = await client.getTopArticles(Infinity);

Fetch a Specific Article

const client = new DevFluxClient();

// By article ID
const article = await client.getArticleById(123456);

// By username and slug
const article = await client.getArticleByPath('zororaka', 'my-awesome-post');

console.log(article.title);
console.log(article.description);
console.log(article.url);

Pagination Support

const client = new DevFluxClient();

// Get paginated results with metadata
const response = await client.getArticlesPaginated({
  page: 1,
  per_page: 30
});

console.log(response.data); // Array of articles
console.log(response.hasMore); // Whether there are more pages
console.log(response.page); // Current page number
console.log(response.perPage); // Items per page

Fetch Fresh or Rising Articles

const client = new DevFluxClient();

// Get recently published articles
const freshArticles = await client.getFreshArticles();

// Get trending articles
const risingArticles = await client.getRisingArticles();

API Reference

DevFluxClient

The main client class for interacting with the dev.to API.

Constructor

new DevFluxClient()

Creates a new DevFlux client instance. No configuration needed - works out of the box!

Methods

getArticles(params?: ArticleQueryParams): Promise<Article[]>

Fetches a list of articles.

Parameters:

  • page (number): Page number for pagination
  • per_page (number): Number of articles per page (max: 1000)
  • tag (string): Filter by tag
  • tags (string): Filter by tags (comma-separated)
  • tags_exclude (string): Exclude tags (comma-separated)
  • username (string): Filter by username
  • state ('fresh' | 'rising' | 'all'): Filter by state
  • top (number): Filter by top articles (days)
  • collection_id (number): Filter by collection ID
getArticlesByUsername(username: string, params?: ArticleQueryParams): Promise<Article[]>

Fetches articles by a specific username.

getArticleById(id: number): Promise<Article>

Fetches a single article by its ID.

getArticleByPath(username: string, slug: string): Promise<Article>

Fetches a single article by username and slug.

getArticlesPaginated(params?: ArticleQueryParams): Promise<PaginatedResponse<Article>>

Fetches articles with pagination metadata.

getArticlesByTag(tag: string, params?: ArticleQueryParams): Promise<Article[]>

Fetches articles by tag.

getTopArticles(days: number, params?: ArticleQueryParams): Promise<Article[]>

Fetches top articles from a specified time period.

getFreshArticles(params?: ArticleQueryParams): Promise<Article[]>

Fetches recently published articles.

getRisingArticles(params?: ArticleQueryParams): Promise<Article[]>

Fetches trending articles.

TypeScript Types

DevFlux exports comprehensive TypeScript types:

import type {
  Article,
  User,
  Organization,
  FlareTag,
  ArticleQueryParams,
  PaginatedResponse
} from 'devflux';

Article

Complete article object with all fields from the dev.to API.

User

User/author information.

Organization

Organization details.

ArticleQueryParams

Query parameters for filtering and pagination.

PaginatedResponse<T>

Wrapper for paginated results with metadata.

Error Handling

DevFlux throws errors when API requests fail:

try {
  const articles = await client.getArticles();
} catch (error) {
  console.error('Failed to fetch articles:', error.message);
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Links

Acknowledgments

Built with ❤️ for the dev.to community.