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

@tilcayo/core

v0.0.2

Published

Core runtime for the Tilcayo framework

Readme

@tilcayo/core

Tilcayo's TypeScript API runtime: routing, typed request contexts, Zod validation, middleware, and MongoDB helpers built on Express and Mongoose.

Start a project

Use Node.js 22.9+ and run this outside the framework repository:

npm create tilcayo-app@latest my-api -- --type api --no-auth --yes
cd my-api

Set MONGODB_URI in .env to a running MongoDB instance, then run npm run dev. The health endpoint is http://localhost:9149/health. For a database-free starter, use --type minimal --no-auth.

Use the runtime directly

npm install @tilcayo/core zod

Save this as server.mjs and run node server.mjs:

import { createApp, defineRoutes, requestId, securityHeaders } from "@tilcayo/core";
import { z } from "zod";

const app = createApp({ middleware: [requestId(), securityHeaders()] });

app.routes(defineRoutes((router) => {
  router.get("/health", (ctx) => ctx.response.success({ status: "ok" }));
  router.post("/greet", (ctx) => ctx.response.success({
    greeting: `Hello, ${ctx.body.name}`,
  }), { validate: { body: z.object({ name: z.string().min(1) }) } });
}));

app.listen(9149);

Send POST /greet with JSON {"name":"Ada"}. Invalid input returns HTTP 422. TypeScript apps can use TilcayoContext<Body> for separate typed controllers.

Routing and responses

Register modules with app.routes(). Routers support get, post, put, patch, delete, group, and resource. Resources provide list, create, read, update (PUT), and delete endpoints. Add PATCH explicitly when needed.

Route options accept validate: { body, query, params } and middleware: [...]. Response helpers include ctx.response.success(data), created(data), and noContent(). Throw badRequest(), notFound(), unauthorized(), or forbidden() for HTTP errors.

MongoDB

Install mongoose in your application when importing it directly:

npm install mongoose

Save as database.mjs and run node --env-file=.env database.mjs, with a valid MONGODB_URI in your environment:

import mongoose from "mongoose";
import { connectMongo, disconnectMongo, mongoModel } from "@tilcayo/core";

const Product = mongoModel("Product", new mongoose.Schema({
  name: { type: String, required: true },
  price: { type: Number, required: true },
}, { timestamps: true }));

await connectMongo(process.env.MONGODB_URI);
await Product.create({ name: "Notebook", price: 250 });
const products = await Product.all();
const page = await Product.paginate({ page: 1, perPage: 20 });
await disconnectMongo();

In an API, keep the connection open until shutdown. The generated starter handles that lifecycle. Models also offer filtering, sorting, selection, population, cursor pagination, bulk operations, aggregation, and .raw for Mongoose queries. Pagination is opt-in: a query parameter alone does not change all() behavior. Keep query filters and bulk operations under application control.

Middleware

| Export | Purpose | | --- | --- | | requestId | Request identifiers | | requestLogger | Request logging | | securityHeaders | Basic HTTP security headers | | cors | Cross-origin requests | | rateLimit | Limits held in the current process | | bodyLimit | Request body limits | | cache | HTTP cache headers, not server-side storage |

Rate limits do not share state across servers and do not trust proxy forwarding headers. The MongoDB connection helper configures public DNS servers before connecting. Authentication is available separately in @tilcayo/auth.

More guides

Project overview · Create an app · CLI · Authentication