{"id":50916411,"url":"https://github.com/quinnjr/nestjs-deno","last_synced_at":"2026-06-16T15:32:15.588Z","repository":{"id":331359925,"uuid":"1126325168","full_name":"quinnjr/nestjs-deno","owner":"quinnjr","description":"NestJS HTTP adapter for the Deno runtime using Deno.serve","archived":false,"fork":false,"pushed_at":"2026-04-15T18:52:36.000Z","size":291989,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-15T20:33:34.307Z","etag":null,"topics":["adapter","backend","deno","express","fastify","http-adapter","http-server","middleware","nest","nestjs","nodejs","rest-api","typescript","web-api","web-framework"],"latest_commit_sha":null,"homepage":"https://quinnjr.github.io/nestjs-deno/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quinnjr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"patreon":"https://www.patreon.com/c/PegasusHeavyIndustries?vanity=user"}},"created_at":"2026-01-01T17:01:23.000Z","updated_at":"2026-04-15T18:52:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/quinnjr/nestjs-deno","commit_stats":null,"previous_names":["pegasusheavy/nestjs-deno","quinnjr/nestjs-deno"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/quinnjr/nestjs-deno","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quinnjr%2Fnestjs-deno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quinnjr%2Fnestjs-deno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quinnjr%2Fnestjs-deno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quinnjr%2Fnestjs-deno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quinnjr","download_url":"https://codeload.github.com/quinnjr/nestjs-deno/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quinnjr%2Fnestjs-deno/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34412788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adapter","backend","deno","express","fastify","http-adapter","http-server","middleware","nest","nestjs","nodejs","rest-api","typescript","web-api","web-framework"],"created_at":"2026-06-16T15:32:15.444Z","updated_at":"2026-06-16T15:32:15.574Z","avatar_url":"https://github.com/quinnjr.png","language":"TypeScript","funding_links":["https://patreon.com/https://www.patreon.com/c/PegasusHeavyIndustries?vanity=user"],"categories":[],"sub_categories":[],"readme":"# @pegasus-heavy/nestjs-platform-deno\n\nA NestJS HTTP adapter for the Deno runtime, similar to `@nestjs/platform-express` and `@nestjs/platform-fastify`.\n\nThis adapter allows you to run your NestJS applications directly on Deno's native HTTP server (`Deno.serve`) without requiring Express, Fastify, or any other Node.js HTTP framework.\n\n## Features\n\n- 🦕 Native Deno HTTP server support via `Deno.serve`\n- 🚀 Full NestJS compatibility\n- 📦 Zero external HTTP framework dependencies\n- 🔒 Built-in CORS support\n- 📁 Static file serving\n- 🔄 Middleware support\n- 💪 TypeScript first\n\n## Installation\n\n```bash\n# Using Deno\ndeno add jsr:@pegasus-heavy/nestjs-platform-deno npm:@nestjs/common npm:@nestjs/core\n\n# Using npm/pnpm (for Node.js + Deno interop)\npnpm add @pegasus-heavy/nestjs-platform-deno @nestjs/common @nestjs/core\n```\n\n## Usage\n\n### Basic Usage\n\n```typescript\nimport { NestFactory } from '@nestjs/core';\nimport { DenoAdapter } from '@pegasus-heavy/nestjs-platform-deno';\nimport { AppModule } from './app.module.ts';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule, new DenoAdapter());\n  await app.listen(3000);\n}\n\nbootstrap();\n```\n\n### With CORS\n\n```typescript\nimport { NestFactory } from '@nestjs/core';\nimport { DenoAdapter } from '@pegasus-heavy/nestjs-platform-deno';\nimport { AppModule } from './app.module.ts';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule, new DenoAdapter());\n\n  app.enableCors({\n    origin: ['http://localhost:3000', 'https://myapp.com'],\n    methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',\n    credentials: true,\n  });\n\n  await app.listen(3000);\n}\n\nbootstrap();\n```\n\n### Serving Static Assets\n\n```typescript\nimport { NestFactory } from '@nestjs/core';\nimport { DenoAdapter } from '@pegasus-heavy/nestjs-platform-deno';\nimport { AppModule } from './app.module.ts';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule, new DenoAdapter());\n\n  const adapter = app.getHttpAdapter() as DenoAdapter;\n  adapter.useStaticAssets('./public', {\n    prefix: '/static',\n    maxAge: 3600,\n  });\n\n  await app.listen(3000);\n}\n\nbootstrap();\n```\n\n### Custom Error Handler\n\n```typescript\nimport { NestFactory } from '@nestjs/core';\nimport { DenoAdapter } from '@pegasus-heavy/nestjs-platform-deno';\nimport { AppModule } from './app.module.ts';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule, new DenoAdapter());\n\n  const adapter = app.getHttpAdapter() as DenoAdapter;\n  adapter.setErrorHandler((error, req, res) =\u003e {\n    console.error('Error:', error);\n    res.status(500).json({\n      statusCode: 500,\n      message: 'Something went wrong',\n      timestamp: new Date().toISOString(),\n    });\n  });\n\n  await app.listen(3000);\n}\n\nbootstrap();\n```\n\n### Using Express Middleware\n\nThe Deno adapter provides full compatibility with Express middleware, allowing you to use the vast ecosystem of existing Express middleware packages.\n\n```typescript\nimport { NestFactory } from '@nestjs/core';\nimport { DenoAdapter } from '@pegasus-heavy/nestjs-platform-deno';\nimport { AppModule } from './app.module.ts';\nimport helmet from 'helmet';\nimport compression from 'compression';\nimport morgan from 'morgan';\n\nasync function bootstrap() {\n  const adapter = new DenoAdapter();\n\n  // Use Express middleware directly\n  adapter.useExpressMiddleware(helmet());\n  adapter.useExpressMiddleware(compression());\n  adapter.useExpressMiddleware(morgan('combined'));\n\n  // Apply middleware to specific paths\n  adapter.useExpressMiddleware('/api', someApiMiddleware());\n\n  const app = await NestFactory.create(AppModule, adapter);\n  await app.listen(3000);\n}\n\nbootstrap();\n```\n\n### Using Express-style App Object\n\nFor middleware that requires an Express app instance (like `express-session`), you can use `getExpressApp()`:\n\n```typescript\nimport { NestFactory } from '@nestjs/core';\nimport { DenoAdapter } from '@pegasus-heavy/nestjs-platform-deno';\nimport { AppModule } from './app.module.ts';\nimport session from 'express-session';\nimport cookieParser from 'cookie-parser';\n\nasync function bootstrap() {\n  const adapter = new DenoAdapter();\n\n  // Get an Express-like app interface\n  const expressApp = adapter.getExpressApp();\n\n  // Use with middleware that needs app.use()\n  expressApp.use(cookieParser());\n  expressApp.use(session({\n    secret: 'my-secret',\n    resave: false,\n    saveUninitialized: false,\n  }));\n\n  const app = await NestFactory.create(AppModule, adapter);\n  await app.listen(3000);\n}\n\nbootstrap();\n```\n\n### Using Fastify Middleware/Hooks\n\nThe Deno adapter also supports Fastify-style hooks and plugins:\n\n```typescript\nimport { NestFactory } from '@nestjs/core';\nimport { DenoAdapter } from '@pegasus-heavy/nestjs-platform-deno';\nimport { AppModule } from './app.module.ts';\n\nasync function bootstrap() {\n  const adapter = new DenoAdapter();\n\n  // Use Fastify hooks directly\n  adapter.useFastifyHook('onRequest', async (request, reply) =\u003e {\n    console.log('Request:', request.method, request.url);\n  });\n\n  adapter.useFastifyHook('preHandler', (request, reply, done) =\u003e {\n    // Validate something\n    done();\n  });\n\n  const app = await NestFactory.create(AppModule, adapter);\n  await app.listen(3000);\n}\n\nbootstrap();\n```\n\n### Using Fastify Plugins\n\nFor Fastify plugins that require a Fastify instance:\n\n```typescript\nimport { NestFactory } from '@nestjs/core';\nimport { DenoAdapter } from '@pegasus-heavy/nestjs-platform-deno';\nimport { AppModule } from './app.module.ts';\nimport fastifyCors from '@fastify/cors';\nimport fastifyHelmet from '@fastify/helmet';\n\nasync function bootstrap() {\n  const adapter = new DenoAdapter();\n\n  // Register Fastify plugins\n  await adapter.registerFastifyPlugin(fastifyCors, { origin: '*' });\n  await adapter.registerFastifyPlugin(fastifyHelmet);\n\n  // Or use the Fastify instance directly\n  const fastify = adapter.getFastifyInstance();\n\n  fastify.addHook('onRequest', async (request, reply) =\u003e {\n    request.startTime = Date.now();\n  });\n\n  fastify.decorateRequest('user', null);\n\n  const app = await NestFactory.create(AppModule, adapter);\n  await app.listen(3000);\n}\n\nbootstrap();\n```\n\n## API Reference\n\n### DenoAdapter\n\nThe main adapter class that extends NestJS's `AbstractHttpAdapter`.\n\n#### Constructor\n\n```typescript\nnew DenoAdapter(instance?: unknown)\n```\n\n#### Static Methods\n\n- `DenoAdapter.create(options?: NestApplicationOptions): DenoAdapter` - Factory method to create a new adapter instance\n\n#### Instance Methods\n\n- `listen(port: number, callback?: () =\u003e void): Promise\u003cvoid\u003e` - Start the server\n- `listen(port: number, hostname: string, callback?: () =\u003e void): Promise\u003cvoid\u003e` - Start the server on a specific hostname\n- `close(): Promise\u003cvoid\u003e` - Gracefully shutdown the server\n- `enableCors(options?: DenoCorsOptions): void` - Enable CORS\n- `useStaticAssets(path: string, options?: DenoStaticAssetsOptions): void` - Serve static files\n- `useExpressMiddleware(middleware: ExpressMiddleware): void` - Use Express middleware\n- `useExpressMiddleware(path: string, middleware: ExpressMiddleware): void` - Use Express middleware for a path\n- `getExpressApp(): ExpressLikeApp` - Get an Express-compatible app object for middleware\n- `useFastifyHook(name: FastifyHookName, hook: FastifyHook): void` - Use a Fastify hook\n- `registerFastifyPlugin(plugin, opts?): Promise\u003cvoid\u003e` - Register a Fastify plugin\n- `getFastifyInstance(): FastifyLikeInstance` - Get a Fastify-compatible instance\n- `setErrorHandler(handler: Function): void` - Set custom error handler\n- `setNotFoundHandler(handler: Function): void` - Set custom 404 handler\n- `getHttpServer(): DenoHttpServer | undefined` - Get the underlying Deno server\n- `getType(): string` - Returns `'deno'`\n\n### DenoCorsOptions\n\n```typescript\ninterface DenoCorsOptions {\n  origin?: string | string[] | boolean | ((origin: string) =\u003e boolean | string);\n  methods?: string | string[];\n  allowedHeaders?: string | string[];\n  exposedHeaders?: string | string[];\n  credentials?: boolean;\n  maxAge?: number;\n  preflightContinue?: boolean;\n  optionsSuccessStatus?: number;\n}\n```\n\n### DenoStaticAssetsOptions\n\n```typescript\ninterface DenoStaticAssetsOptions {\n  prefix?: string;\n  index?: string | boolean;\n  redirect?: boolean;\n  maxAge?: number;\n  immutable?: boolean;\n  dotfiles?: 'allow' | 'deny' | 'ignore';\n  etag?: boolean;\n  lastModified?: boolean;\n}\n```\n\n## Requirements\n\n- Deno 1.40+ (for `Deno.serve` API)\n- NestJS 10.0.0+ or 11.0.0+\n\n## Compatibility\n\nThis adapter is designed to be a drop-in replacement for the Express or Fastify adapters. Most NestJS features work out of the box:\n\n- ✅ Controllers and routing\n- ✅ Dependency injection\n- ✅ Middleware (native + Express + Fastify)\n- ✅ Express middleware compatibility (helmet, compression, morgan, etc.)\n- ✅ Fastify hooks and plugins (@fastify/cors, @fastify/helmet, etc.)\n- ✅ Guards\n- ✅ Interceptors\n- ✅ Pipes\n- ✅ Exception filters\n- ✅ CORS\n- ✅ Static file serving\n- ✅ Cookie handling\n- ✅ Request/Reply decorators (Fastify-style)\n- ⚠️ View engines (not implemented in base adapter)\n- ⚠️ WebSockets (requires separate adapter)\n\n## License\n\nMIT © Pegasus Heavy Industries LLC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquinnjr%2Fnestjs-deno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquinnjr%2Fnestjs-deno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquinnjr%2Fnestjs-deno/lists"}