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

@solumjs/http

v0.3.6

Published

SolumJS HTTP abstraction, router and Node.js adapter

Readme

@solumjs/http

HTTP abstraction with router, REST decorators, guards, interceptors, pagination, session management, HTTP clients, and static file serving.

Install

npm install @solumjs/http

Route Definitions

import { RestController, Get, Post, Put, Patch, Delete, Param, Body, Query, Header, CookieValue, CurrentUser, Req, Res, Next, ResponseStatus } from "@solumjs/http";

@RestController("/api/products")
export class ProductController {

    @Get("/")
    async listProducts() { return []; }

    @Get("/:id")
    async getProduct(@Param("id") id: string) { return {}; }

    @Post("/")
    @ResponseStatus(201)
    async createProduct(@Body() dto: CreateProductDto) { return dto; }

    @Put("/:id")
    async updateProduct(@Param("id") id: string, @Body() dto: UpdateProductDto) { return dto; }

    @Patch("/:id")
    async patchProduct(@Param("id") id: string, @Body() dto: Partial<UpdateProductDto>) { return dto; }

    @Delete("/:id")
    async deleteProduct(@Param("id") id: string) { }
}

Parameter Decorators

import { RestController, Get, Body, Param, Query, Header, CookieValue, CurrentUser, Req, Res, Next, Valid } from "@solumjs/http";

@RestController("/api")
export class ExampleController {

    @Get("/search")
    async search(
        @Query("q") query: string,
        @Query("page") page: number,
        @Header("Authorization") auth: string,
        @CookieValue("session") sid: string,
        @CurrentUser() user: User,
        @Req() req: SolumjsRequest,
        @Res() res: SolumjsResponse,
    ) { return { query, page }; }

    @Post("/data")
    async create(@Body() body: CreateDto) { return body; }
}

Guards

import { CanActivate, ExecutionContext, UseGuards, Roles } from "@solumjs/http";
import { Bean } from "@solumjs/core";

// Custom guard
@Bean("IApiKeyGuard")
export class ApiKeyGuard implements CanActivate {
    async canActivate(context: ExecutionContext): Promise<boolean> {
        const request = context.switchToHttp().getRequest();
        const apiKey = request.headers["x-api-key"];
        return apiKey === process.env.API_KEY;
    }
}

// Usage
@RestController("/api")
@UseGuards(ApiKeyGuard)
export class ApiController {

    @Get("/admin")
    @Roles("ADMIN")
    async adminEndpoint() { return "admin data"; }
}

Interceptors

import { HandlerInterceptor, ExecutionContext, UseInterceptors } from "@solumjs/http";
import { Bean } from "@solumjs/core";

@Bean("LoggingInterceptor")
export class LoggingInterceptor implements HandlerInterceptor {
    async intercept(context: ExecutionContext, next: () => Promise<any>): Promise<any> {
        const start = Date.now();
        const result = await next();
        console.log(`Request took ${Date.now() - start}ms`);
        return result;
    }
}

@RestController("/api")
@UseInterceptors(LoggingInterceptor)
export class ApiController { /* ... */ }

Pagination

import { PageRequest, Page } from "@solumjs/http";

@RestController("/users")
export class UserController {

    @Get("/")
    async listUsers(@Query() pageRequest: PageRequest): Promise<Page<UserResponseDto>> {
        const users = await this.userService.findAll(pageRequest);
        return users; // { data: [...], page, size, total, totalPages }
    }
}

Declarative HTTP Clients

import { HttpClient, HttpGet, HttpPost, HttpPut, HttpDelete } from "@solumjs/http";

@HttpClient("jsonplaceholder")
@BaseUrl("https://jsonplaceholder.typicode.com")
@Timeout(5000)
export interface TodoClient {

    @HttpGet("/todos/:id")
    getTodo(@Param("id") id: number): Promise<Todo>;

    @HttpPost("/todos")
    createTodo(@Body() todo: CreateTodoDto): Promise<Todo>;

    @HttpPut("/todos/:id")
    updateTodo(@Param("id") id: number, @Body() todo: UpdateTodoDto): Promise<Todo>;

    @HttpDelete("/todos/:id")
    deleteTodo(@Param("id") id: number): Promise<void>;
}

SSRF-Protected makeRequest

import { makeRequest } from "@solumjs/http";

// Direct SSRF-protected HTTP request (DNS pinning, private IP blocking, redirect limits)
const res = await makeRequest("https://api.example.com/data", {
    method: "GET",
    timeout: 10000,
    headers: { Authorization: "Bearer token" },
});

Session Management

import { createSessionMiddleware, MemorySessionStore } from "@solumjs/http";

// In-memory session
app.use(createSessionMiddleware());

// Custom TTL
app.use(createSessionMiddleware({ ttlMs: 30 * 60 * 1000 }));

// Custom cookie name
app.use(createSessionMiddleware({ cookieName: "myapp.sid" }));

// Redis session store
import { connectRedisSessionStore } from "@solumjs/http";
const redisStore = await connectRedisSessionStore("redis://localhost:6379");
app.use(createSessionMiddleware({ store: redisStore }));

Cookies

import { setCookie, clearCookie } from "@solumjs/http";

// Set cookie
setCookie(res, "session", "abc123", { httpOnly: true, maxAge: 3600 });

// Clear cookie
clearCookie(res, "session");

Static Files

import { serveStatic } from "@solumjs/http";

app.use(serveStatic("public", { index: "index.html" }));

Request/Response Types

import { SolumjsRequest, SolumjsResponse, UploadedFile, Session, SolumjsLogger } from "@solumjs/http";

// SolumjsRequest
// - method, path, params, query, headers, body
// - log: SolumjsLogger
// - raw: IncomingMessage
// - cookies, files, session

// SolumjsResponse
// - status(code), json(data), send(text), end()
// - raw: ServerResponse

License

MIT