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-dev

v0.2.0

Published

Development tools for Elysia.js

Readme

elysia-dev

Collection of development tools for Elysia.js

[!CAUTION] This is EXPERIMENTAL software. The CLI / API may change!

[!IMPORTANT] Help improve this software by reporting any issues on GitHub

Supported Parsers & Writers

[!TIP] You can freely combine parsers and writers, such as using an Open-API parser with a TypeScript writer.

Usage

Structure your code like this:

// app.ts
import { Elysia, t } from 'elysia'

// make sure to export the main instance (variable name doesn't matter)
export const app = new Elysia()
	.model(
		'user',
		t.Object({
			name: t.String(),
			age: t.Number()
		})
	)
	.get('/', () => 'yay')
	.post('/', () => '', { body: 'user' })

// below routes are excluded from generation due to `export` above

app.get('/excluded', () => 'excluded')

if (process.env.NODE_ENV !== 'test') {
	// we don't need to call `listen` within `bun test`
	app.listen(8080)
}

CLI

bunx elysia-dev --help

Generate Eden Treaty test file

bunx elysia-dev gen ./app.ts --writer=treaty --outfile=./test.test.ts
import { describe, it, expect } from 'bun:test'
import { treaty } from '@elysiajs/eden'
import { app } from './app'

await app.modules

const api = treaty(app)

describe('Elysia', () => {
	it('GET - / - Response: { 200: string; }"', async () => {
		const { data, error } = await api.index.get()
		expect(error).toBeNull()
		expect(data).toBeTypeOf('string')
	})

	it('POST - /user - Request: { name: string; age: number; } - Response: { 200: string; }"', async () => {
		const { data, error } = await api.user.post({
			name: 'Bogeychan',
			age: 42
		})
		expect(error).toBeNull()
		expect(data).toBeTypeOf('string')
	})
})

Generate REST Client requests file

bunx elysia-dev gen ./app.ts --writer=rest --outfile=./request.http
@protocol = http
@hostname = localhost
@port     = 8080
@origin   = {{protocol}}://{{hostname}}:{{port}}

###

# index
GET {{origin}}/ HTTP/1.1

###

# user - { name: string; age: number; }
POST {{origin}}/user HTTP/1.1
Content-Type: application/json

{
  "name": "Bogeychan",
  "age": 42
}

###

Generate OpenAPI definition file

bunx elysia-dev gen ./app.ts --writer=open-api --outfile=./open-api.json
{
	"openapi": "3.1.0",
	"info": {
		"title": "Elysia Documentation",
		"description": "Development documentation",
		"version": "0.0.0"
	},
	"paths": {
		"/": {
			"post": {
				"responses": {
					"200": {
						"description": "200",
						"content": {
							"text/plain": {
								"schema": {
									"type": "string"
								}
							}
						}
					}
				},
				"requestBody": {
					"content": {
						"application/json": {
							"schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string"
									},
									"age": {
										"type": "number"
									}
								}
							}
						}
					},
					"required": true
				}
			},
			"get": {
				"responses": {
					"200": {
						"description": "200",
						"content": {
							"text/plain": {
								"schema": {
									"type": "string"
								}
							}
						}
					}
				}
			}
		}
	}
}

Based on Swagger UI docs

new Elysia()
	.get('/json', () => Bun.file('./open-api.json'))
	.get('/swagger', ({ set }) => {
		set.headers['content-type'] = 'text/html'
		const path = '/json'
		return `<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="description" content="SwaggerUI" />
  <title>SwaggerUI</title>
  <link rel="stylesheet" href="https://unpkg.com/[email protected]/swagger-ui.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js" crossorigin></script>
<script>
  window.onload = () => {
    window.ui = SwaggerUIBundle({
      url: '${path}',
      dom_id: '#swagger-ui',
    });
  };
</script>
</body>
</html>`
	})

API

bun add elysia-dev -D

Generate open-api definition file using typescript parser

import { gen } from 'elysia-dev'

await gen({
	entrypoint: './app.ts',
	parse: {
		$type: 'typescript'
	},
	outFile: './open-api.json',
	write: {
		$type: 'open-api'
	},
	logging: {
		level: 'silent' // disable logging
	}
})

Checkout the examples folder.

License

MIT