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

@deployforme/adapter-nest

v1.0.5

Published

NestJS adapter for Deploy4Me

Readme

@deployforme/adapter-nest

NestJS adapter for Deploy4Me runtime module management system.

Features

  • ✅ Full NestJS integration
  • 🔄 Dynamic route registration/unregistration
  • 📦 Automatic body parsing (built-in)
  • 🎯 Type-safe route definitions
  • 🛡️ Works with NestJS exception filters
  • 🚀 Compatible with Express and Fastify platforms

Installation

npm install @deployforme/core @deployforme/adapter-nest
# or
pnpm add @deployforme/core @deployforme/adapter-nest

Quick Start

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { Kernel, ModuleLoader, createRuntimeContext } from '@deployforme/core';
import { NestAdapter } from '@deployforme/adapter-nest';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  
  // Create adapter and context
  const adapter = new NestAdapter(app);
  const context = createRuntimeContext(adapter);
  
  // Initialize kernel and loader
  const kernel = new Kernel(context);
  const loader = new ModuleLoader(kernel);
  
  // Load dynamic modules
  await loader.loadModule('./modules/user.module.js');
  await loader.loadModule('./modules/admin.module.js');
  
  await app.listen(3000);
  console.log('NestJS app with Deploy4Me running on http://localhost:3000');
}

bootstrap();

Module Example

module.exports = {
  name: 'user',
  version: '1.0.0',
  
  register(context) {
    context.logger.log('Registering user module routes');
    
    // GET endpoint
    context.http.registerRoute({
      id: 'user-list',
      method: 'GET',
      path: '/users',
      handler: async (req, res) => {
        return { users: ['Alice', 'Bob', 'Charlie'] };
      }
    });

    // POST endpoint - body is automatically parsed
    context.http.registerRoute({
      id: 'user-create',
      method: 'POST',
      path: '/users',
      handler: async (req, res) => {
        const { email, password } = req.body;
        
        return { 
          message: 'User created',
          email,
          id: Math.floor(Math.random() * 1000)
        };
      }
    });

    // Dynamic parameters
    context.http.registerRoute({
      id: 'user-get',
      method: 'GET',
      path: '/users/:id',
      handler: async (req, res) => {
        return { 
          id: req.params.id,
          name: 'User ' + req.params.id 
        };
      }
    });
  },
  
  dispose() {
    console.log('User module disposed');
  }
};

Body Parsing

The NestAdapter automatically handles body parsing for POST, PUT, and PATCH requests. You don't need to manually parse the request body:

// ✅ Body is automatically available
context.http.registerRoute({
  id: 'create-item',
  method: 'POST',
  path: '/items',
  handler: async (req, res) => {
    const { name, price } = req.body; // Already parsed!
    return { success: true, item: { name, price } };
  }
});

Hot Reload Example

// Initial load
await loader.loadModule('./modules/user.module.js');

// Update user.module.js with new routes or logic...

// Reload without restarting NestJS
await loader.reloadModule('user');
// Old routes removed, new routes registered
// Zero downtime!

Admin Panel Example

Create an admin controller to manage modules:

import { Controller, Post, Delete, Param } from '@nestjs/common';
import { ModuleLoader } from '@deployforme/core';

@Controller('admin/modules')
export class AdminController {
  constructor(private loader: ModuleLoader) {}

  @Post(':name/reload')
  async reloadModule(@Param('name') name: string) {
    await this.loader.reloadModule(name);
    return { message: `Module ${name} reloaded` };
  }

  @Delete(':name')
  async unloadModule(@Param('name') name: string) {
    await this.loader.unloadModule(name);
    return { message: `Module ${name} unloaded` };
  }
}

API Reference

NestAdapter

class NestAdapter implements HttpAdapter {
  constructor(app: INestApplication);
  
  registerRoute(definition: RouteDefinition): void;
  unregisterRoute(id: string): void;
}

Route Definition

interface RouteDefinition {
  id: string;              // Unique route identifier
  method: HttpMethod;      // GET, POST, PUT, DELETE, PATCH
  path: string;            // Route path
  handler: Function;       // Async route handler
}

Platform Support

Works with both Express and Fastify platforms:

// Express (default)
const app = await NestFactory.create(AppModule);

// Fastify
const app = await NestFactory.create(AppModule, new FastifyAdapter());

Integration with NestJS Features

Dynamic modules work alongside NestJS features:

  • ✅ Guards
  • ✅ Interceptors
  • ✅ Exception Filters
  • ✅ Pipes
  • ✅ Middleware

Monitoring

Use the built-in monitoring dashboard:

import { MonitoringDashboard } from '@deployforme/core';

const dashboard = new MonitoringDashboard(kernel);
dashboard.start(9090);
// Visit http://localhost:9090 for metrics

License

MIT © Hacı Mert Gökhan