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

elysia-remote-dts

v1.0.3

Published

A plugin that provide .d.ts types remotely for Eden Treaty to consume.

Readme

Elysia Remote DTS

A plugin that provides remote .d.ts types for Eden Treaty to consume.

NPM Version NPM Downloads NPM License

Problem

Imagine this scenario: You've deployed an Elysia server remotely and want to provide end-to-end type safety using Eden Treaty. However, external developers don't have direct access to your server's source code to extract the typeof app types because:

  • Your server is closed-source
  • The frontend is located elsewhere, making types inaccessible

This plugin solves this problem by exposing types remotely and providing them to Eden Treaty for consumption.

[!NOTE]
The code responsible for runtime type-generation is adapted from rolldown-plugin-dts. The difference is that our generateDts utility is completely independent and decoupled from the rolldown lifecycle. Full credit goes to the original developers - we've simply ported some functionality to enhance the Elysia ecosystem.

Installation

bun add elysia-remote-dts

Usage

import { Elysia } from 'elysia'
import { dts } from 'elysia-remote-dts'

const app = new Elysia().use(dts('./src/index.ts')).listen(3000)

// Be sure to export the type for the plugin to consume
export type App = typeof app;

Types will then be available at /server.d.ts by default, or at the path specified in the dtsPath option.

Due to limitations with Triple-Slash Directives, types cannot be directly consumed from a remote URL (tracking issue). For frontend projects, you'll need to first download the type declaration file before using it with Eden:

curl -o server.ts https://<remote-url>/server.d.ts

If you've customized the path:

curl -o server.ts https://<remote-url>/your-custom-path

Then use it in your frontend code:

import { treaty } from '@elysiajs/eden'
import type { App } from './server'

// Your frontend project should already have both elysia and @elysiajs/eden installed
export const app = treaty<App>('https://<remote-url>')

Configuration

The dts plugin accepts the following configuration options:

dts(entryPoint, options)

| Option | Type | Default | Description | |--------|------|---------|-------------| | cwd | string | Current directory | The directory where the plugin will look for the tsconfig.json file. | | dtsInput | boolean | false | Set to true when entries are .d.ts files (instead of .ts files). When enabled, the plugin will skip generating a .d.ts file for the entry point. | | tsconfig | string \| boolean | "tsconfig.json" | The path to the tsconfig.json file. When set to false, any tsconfig.json file will be ignored. | | compilerOptions | object | {} | The compilerOptions for the TypeScript compiler. See TypeScript compiler options. | | resolve | boolean \| (string \| RegExp)[] | false | Resolve external types used in .d.ts files from node_modules. Can be a boolean or an array of strings/RegExp patterns. | | resolvePaths | boolean | false | When true, the plugin will resolve paths in tsconfig.json. This option is enabled automatically when paths is set in compilerOptions. | | dtsPath | string | "/server.d.ts" | The path where the type definitions will be served. |

Example with Options

import { Elysia } from 'elysia'
import { dts } from 'elysia-remote-dts'

const app = new Elysia().use(
  dts('./src/index.ts', {
    tsconfig: './tsconfig.json',
    compilerOptions: {
      strict: true
    },
    dtsPath: '/types.d.ts'
  })
).listen(3000)

export type App = typeof app;

Known Limitations

  1. Type emission may occasionally return null in certain runtime environments (particularly in Distroless). We recommend using oven/bun or oven/bun:alpine as your base image.

  2. The typescript package must be available at runtime, not just as a development dependency.

  3. For all Elysia instances and controller chaining, it's recommended to chain your routes rather than calling controller.<METHOD> on separate lines, as the latter approach won't be properly included in type compilation by TypeScript. (example)