MCPcopy
hub / github.com/tinyhttp/tinyhttp

github.com/tinyhttp/tinyhttp @v1.3.0 sqlite

repository ↗ · DeepWiki ↗ · release v1.3.0 ↗
315 symbols 1,185 edges 172 files 32 documented · 10%
README

tinyhttp

⚡ Tiny web framework as a replacement of Express

[][site-url] [npm][npm-url] [GitHub Workflow Status][github-actions] [Codecov][codecov] Vulnerabilities [Codacy grade][codacy-url] [Last commit][gh-url] [NPM][license]

🦕 tinyhttp now has a Deno port (work in progress)

tinyhttp is a modern Express-like web framework written in TypeScript and compiled to native ESM, that uses a bare minimum amount of dependencies trying to avoid legacy hell.

Here is a short list of most important features that tinyhttp has:

  • 2x faster than Express
  • ⚙ Full Express middleware support
  • ↪ Async middleware support
  • ☑ Native ESM and CommonJS support
  • 🚀 No legacy dependencies, just the JavaScript itself
  • 🔨 Types out of the box
  • 🔥 Prebuilt middleware for modern Node.js

Visit tinyhttp website for docs, guides and middleware search.

Install

tinyhttp requires Node.js 12.4.0 or newer. It is recommended to use pnpm, although it isn't required.

# npm
npm i @tinyhttp/app
# pnpm
pnpm i @tinyhttp/app
# yarn
yarn add @tinyhttp/app

Docs

You can see the documentation here.

Get Started

Create a new project using tinyhttp CLI:

pnpm i -g @tinyhttp/cli

tinyhttp new basic my-app

cd my-app

The app structure is quite similar to Express, except that you need to import App from @tinyhttp/app instead of default import from express.

import { App } from '@tinyhttp/app'
import { logger } from '@tinyhttp/logger'

const app = new App()

app
  .use(logger())
  .use(function someMiddleware(req, res, next) {
    console.log('Did a request')
    next()
  })
  .get('/', (_, res) => {
    res.send('<h1>Hello World</h1>')
  })
  .get('/page/:page/', (req, res) => {
    res.status(200).send(`You just opened ${req.params.page}`)
  })
  .listen(3000)

See tinyhttp "Learn" page for complete guide.

Middlewares

tinyhttp offers a list of premade middleware for common tasks, such as session, logger and jwt.

Search and explore the full list at middleware search page.

Comparison

See COMPARISON.md.

Benchmarks

Check benchmark folder.

Contributing

See CONTRIBUTING.md.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

v 1 r t l 💡 🔌 📆 🚧 💻 Matt 🔌 ⚠️ Nasmevka 📖 elianiva 💡 🚧 💻 ⚠️ Katja Lutz 💡 Arnovsky 🔌 💻 Rocktim Saikia 🚇 💻 💡
Ahmad Reza 💻 Ionel lupu 💡 Tomi Kalmi 📖 Luiginator 💡 💻 Aneesh Relan 💡 ⚠️ Roberto Ortega 💡 Barciet Maëlann 💡
shzmr 💻 ⚠️ 💡 Egor Avakumov 💡 Rashmi K A 💻 Shubhi Agarwal ⚠️ Maurizio ⚠️ 💻 jkreller 💡 Alan Carpilovsky ⚠️
KoljaTM ⚠️ ike 📖 💡 Fabian Morón Zirfas 🐛 Vitaly Baev ⚠️ 🐛 omrilotan 💻 📖 MVEMCJSUNPE 💡 🐛 Leo Toneff 💻
Calum Knott 📖 🐛 Reinaldy Rafli 💻

Extension points exported contracts — how you extend this code

PathObject (Interface)
* Optional path object
packages/unless/src/index.ts
Store (Interface)
(no doc) [1 implementers]
packages/rate-limit/src/memory-store.ts
LoggerOptions (Interface)
(no doc)
packages/logger/src/index.ts
RequestWithBotDetector (Interface)
(no doc)
packages/bot-detector/src/index.ts
ReqAndSessionInfo (Interface)
(no doc)
packages/session/src/index.ts
DotenvParseOptions (Interface)
(no doc)
packages/dotenv/src/structs.ts
Response (Interface)
(no doc)
packages/app/src/response.ts
AccessControlOptions (Interface)
(no doc)
packages/cors/src/index.ts

Core symbols most depended-on inside this repo

send
called by 139
packages/app/src/response.ts
listen
called by 103
packages/app/src/app.ts
get
called by 92
packages/app/src/response.ts
use
called by 92
packages/app/src/app.ts
runServer
called by 90
test_helpers/runServer.ts
InitAppAndTest
called by 74
test_helpers/initAppAndTest.ts
parse
called by 71
packages/dotenv/src/index.ts
proxyaddr
called by 48
packages/proxy-addr/src/index.ts

Shape

Function 197
Method 79
Class 23
Interface 16

Languages

TypeScript100%

Modules by API surface

packages/session/src/index.ts52 symbols
packages/app/src/response.ts23 symbols
packages/app/src/app.ts18 symbols
packages/accepts/src/index.ts15 symbols
packages/content-disposition/src/index.ts13 symbols
packages/router/src/index.ts11 symbols
packages/proxy-addr/src/index.ts10 symbols
packages/app/src/request.ts8 symbols
packages/rate-limit/src/memory-store.ts7 symbols
packages/favicon/src/index.ts7 symbols
examples/prisma-graphql/index.js7 symbols
packages/res/src/headers.ts6 symbols

Dependencies from manifests, versioned

@babel/cli7.13.0 · 1×
@babel/core7.12.9 · 1×
@babel/node7.13.0 · 1×
@babel/plugin-syntax-dynamic-import7.8.3 · 1×
@babel/plugin-transform-runtime7.12.1 · 1×
@babel/preset-env7.12.7 · 1×
@babel/runtime7.12.5 · 1×
@changesets/cli2.16.0 · 1×
@commitlint/cli12.1.1 · 1×
@commitlint/config-conventional12.1.1 · 1×
@koa/router10.0.0 · 1×
@prisma/cli2.12.1 · 1×

Datastores touched

YourDatabaseNameDatabase · 1 repos

For agents

$ claude mcp add tinyhttp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact