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

glasswork

v0.11.0

Published

A transparent, Lambda-optimized web framework for building OpenAPI-compliant REST APIs.

Readme

 

npm version Coverage CI License: MIT TypeScript

A transparent, serverless-optimized web framework for building OpenAPI-compliant REST APIs.

Built on Hono, Awilix, and Valibot, Glasswork provides automatic OpenAPI spec generation, type-safe routing, dependency injection, and clean modular architecture.

Why Glasswork?

NestJS-style architecture with serverless-first design.

Glasswork combines the best patterns from NestJS (modules, DI, OpenAPI) with the performance characteristics needed for serverless:

  • Small & Fast - tiny bundles (~1MB incl Prisma), no decorators, no reflection
  • Clean Architecture - Module system with dependency injection (Awilix)
  • OpenAPI Built-in - Automatic spec generation from Valibot schemas
  • Framework-Agnostic Services - Test business logic without HTTP mocking
  • Transparent - Direct access to Hono, no heavy abstractions

Perfect for: Lambda-first projects, MVPs, hobby APIs, or anywhere you want NestJS patterns without the bundle size.

Features

  • OpenAPI-First: Automatic spec generation from Valibot schemas - write code, get docs
  • Type-Safe Routes: Request/response validation with full TypeScript inference
  • Module System: Organize your API into logical, testable modules
  • Dependency Injection: Powered by Awilix with serverless-compatible PROXY mode
  • Framework-Agnostic Services: Test business logic without any HTTP mocking
  • Production-Ready: Small bundles, fast cold starts, works anywhere Node.js runs

Installation

npm install glasswork hono awilix valibot hono-openapi

Quick Start

1. Define Your DTOs (Valibot Schemas)

import { object, string, email, pipe, minLength } from 'valibot';

// These schemas automatically generate OpenAPI documentation
export const LoginDto = object({
  email: pipe(string(), email()),
  password: pipe(string(), minLength(8)),
});

export const SessionDto = object({
  token: string(),
  expiresAt: string(),
});

2. Create Type-Safe Routes

import { createRoutes, route } from 'glasswork';

export const authRoutes = createRoutes<{ authService: AuthService }>(
  (router, { authService }) => {
    // router is a real Hono instance - all features work

    router.post('/login', route({
      tags: ['Auth'],
      summary: 'User login',
      public: true,
      body: LoginDto,
      responses: { 200: SessionDto },
      handler: async ({ body }) => {
        // body is fully typed from LoginDto
        return authService.login(body.email, body.password);
      },
    }));
  }
);

3. Write Framework-Agnostic Services

// Services have zero framework coupling
export class AuthService {
  constructor({ prismaService, hashService }: {
    prismaService: PrismaService;
    hashService: HashService;
  }) {
    this.prismaService = prismaService;
    this.hashService = hashService;
  }

  async login(email: string, password: string) {
    const user = await this.prismaService.user.findUnique({ where: { email } });
    if (!user) throw new NotFoundException('Invalid credentials');

    await this.hashService.verify(password, user.password);
    return this.createSession(user);
  }
}

4. Define Modules and Bootstrap

// auth.module.ts
export const AuthModule = defineModule({
  name: 'auth',
  basePath: 'auth',
  providers: [AuthService],
  routes: authRoutes,
});

// app.ts
import { bootstrap } from 'glasswork';

const { app } = bootstrap(AppModule, {
  openapi: {
    enabled: true,
    documentation: {
      info: { title: 'My API', version: '1.0.0' },
    },
  },
});

export default app; // Ready for Lambda or local server

Your OpenAPI spec is automatically generated at /api/openapi.json 🎉

When to Use Glasswork

Choose Glasswork when you want:

  • NestJS-style architecture with smaller bundles
  • Automatic OpenAPI generation without decorators
  • Serverless-first design (Lambda, Cloudflare Workers, etc.)
  • Clean, testable code with dependency injection

Consider alternatives:

  • GraphQL? Use Apollo Server or Pothos
  • Container deployment? NestJS is excellent for this
  • Full-stack app? Use Next.js or Remix
  • Minimal framework? Use Hono directly

Requirements

  • Node.js 20+
  • TypeScript 5+

Contributing

Glasswork is in active development. Feedback, issues, and contributions are welcome!

License

MIT