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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@noviantodev/academiq

v1.1.3

Published

Detailed documentation for each package exported from the project.

Readme

Project Packages Documentation

Detailed documentation for each package exported from the project.

Table of Contents

Error Handling

import { ErrorHandler, AppError } from "@noviantodev/academiq";

// Create custom error
throw new AppError("Resource not found", 404);

// Use error handler middleware
app.use(ErrorHandler);

The error handling package provides:

  • Standardized error responses
  • Custom error classes for different scenarios
  • Global error handling middleware
  • Detailed error logging

Validation Middleware

import { validateRequest } from "@noviantodev/academiq";
import { z } from "zod";

// Define validation schema
const userSchema = {
  body: z.object({
    name: z.string().min(2),
    email: z.string().email(),
    age: z.number().int().positive().optional(),
  }),
  query: z.object({
    includeDetails: z.boolean().optional(),
  }),
};

// Use in route
router.post("/users", validateRequest(userSchema), handleCreateUser);

Features:

  • Request body validation using Zod
  • Query parameters validation
  • Request headers validation
  • Custom validation rules support
  • Automatic type conversion for query parameters

Async Wrapper

import { asyncWrapper } from "@noviantodev/academiq";

router.get(
  "/users",
  asyncWrapper(async (req, res) => {
    const users = await getUsersFromDB();
    res.json(users);
  })
);

Features:

  • Eliminates try-catch boilerplate
  • Automatic error propagation
  • Express middleware compatibility
  • TypeScript support

Auth Middleware

import { AuthMiddleware } from "@noviantodev/academiq";

const authMiddleware = new AuthMiddleware({
  jwtSecret: process.env.JWT_SECRET,
  redis: {
    host: process.env.REDIS_HOST,
    port: parseInt(process.env.REDIS_PORT),
  },
});

// Protect routes
router.get("/profile", authMiddleware.authenticateToken, (req, res) => {
  res.json(req.user);
});

// Role-based authorization
router.delete(
  "/users/:id",
  authMiddleware.authenticateToken,
  authMiddleware.authorizeRoles("admin"),
  deleteUser
);

Provides:

  • JWT authentication
  • Role-based authorization
  • Token verification

HTTP Handlers

import { ServiceResponse, handleServiceResponse } from "@noviantodev/academiq";

// Use in route
router.get(
  "/users/:id",
  asyncWrapper(async (req, res) => {
    const user = await getUserFromDB(req.params.id);
    const serviceResponse = ServiceResponse.success("User found", user);
    handleServiceResponse(serviceResponse, res);
  })
);

Common HTTP handlers for:

  • CRUD operations
  • File uploads
  • Response formatting
  • Request parsing

Service Health

import { healthCheck, ServiceHealth } from "@noviantodev/academiq";

// Basic health check
app.get("/health", healthCheck);

// Detailed service health monitoring
const serviceHealth = new ServiceHealth();
serviceHealth.addCheck("database", async () => {
  return db.isConnected();
});

app.get("/health/detailed", serviceHealth.check);

Features:

  • Service availability checking
  • Dependency health monitoring
  • Performance metrics
  • System status reporting

Logger

import { AppLogger } from "@noviantodev/academiq";

const logger = new AppLogger({
  level: "info",
  format: "json",
  filename: "app.log",
});

Features:

  • Flexible logging configuration
  • Different log levels
  • File logging
  • Console logging

Error Middleware

import { errorMiddleware } from "@noviantodev/academiq";

const errorMiddleware = errorMiddleware(logger);

Features:

  • Error logging
  • Error handling
  • Error response formatting
import express from "express";
import {
  ErrorHandler,
  validateRequest,
  asyncWrapper,
  AuthMiddleware,
  healthCheck,
} from "@noviantodev/academiq";

const app = express();
const authMiddleware = new AuthMiddleware({
  jwtSecret: process.env.JWT_SECRET,
  redis: {
    host: process.env.REDIS_HOST,
    port: parseInt(process.env.REDIS_PORT),
  },
});

// Health check
app.get("/health", healthCheck);

// Protected route with validation
app.post(
  "/users",
  authMiddleware.authenticateToken,
  validateRequest(userSchema),
  asyncWrapper(async (req, res) => {
    // Handle request
    res.status(201).json({ success: true });
  })
);

// Global error handler
app.use(ErrorHandler);

Installation

npm install @noviantodev/academiq

Contributing

Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.

License

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