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

insite-server

v2.4.0

Published

Main inSite server entry point

Readme

insite-server

Orchestrator for the inSite server. Wires MongoDB, HTTP, WebSocket, users, subscriptions, cookies, and config into a single initializable instance.

Part of inSite — composes insite-db, insite-http, insite-ws, insite-users-server, insite-users-server-ws, insite-subscriptions-server, insite-ws-transfers, insite-config, insite-cookie, insite-common.

Installation

npm install insite-server

Or:

bun add insite-server

Quick Start

import { InSite } from "insite-server";

const inSite = await InSite.init({
	db: { url: "mongodb://127.0.0.1:27017", name: "mydb" },
	port: 3000,
	wss: {},
	users: { abilities: [] },
	http: true,
	cookie: {}
});

InSite.init(options) returns Promise<InSite>. The constructor new InSite(options?) triggers init asynchronously when options are passed. Use whenReady() to await initialization completion.

API Reference

Exports

| Export | Type | Description | |--------|------|-------------| | InSite | class | Main orchestrator | | Options<AS> | type | InSite options | | OmitRedundant<I, O> | type | Omits from I properties not configured in O | | ServerConfig<O> | type | Config type for given options | | WSServerWithActualProps<AS, O> | type | WSServer type with publish/transfer props based on options | | UsersServerWithActualProps<AS, O> | type | UsersServer type with publication props based on options | | AbilitiesSchema | type | From insite-common | | CookieMiddleware, CookieSetter, parseCookie | class/function | From insite-cookie | | CookieSetterOptions | type | From insite-cookie | | connect, connectToDB, Collections, MongoDB types | — | From insite-db; DBOptions type | | HTTPServer, StaticMiddleware, TemplateMiddleware, etc. | — | From insite-http; HTTPServerOptions type | | SubscriptionHandler, Publication, SubscriptionHandle, etc. | — | From insite-subscriptions-server | | Users, AbilityError, PermissionError, etc. | — | From insite-users-server; UsersOptions type | | UsersServer, WSSCWithUser | — | From insite-users-server-ws; UsersServerOptions type | | IncomingTransport, OutgoingTransport, WithTransfer, WithOnTransfer | — | From insite-ws-transfers | | WSServer, WSServerClient | — | From insite-ws; WSServerOptions type |

InSite

class InSite<O extends Options<any>, AS extends AbilitiesSchema>

Constructor

new InSite<O, AS>(options?: O)

Creates an instance. If options is provided, calls init asynchronously.

Instance properties (populated after init based on options)

| Property | Type | When present | |----------|------|--------------| | mongoClient | MongoClient | db option | | db | DB | db option | | collections | Collections | db option | | config | ServerConfig<O> | config option | | wss | WSServerWithActualProps<AS, O> | wss option | | incomingTransport | IncomingTransport<WSSCWithUser<AS>> | wss.incomingTransport or users | | outgoingTransport | OutgoingTransport<WSSCWithUser<AS>> | wss.outgoingTransport | | subscriptionHandler | SubscriptionHandler<AS> | wss.subscriptions | | usersServer | UsersServerWithActualProps<AS, O> | users with server and WS | | users | Users<AS> | users option | | cookie | CookieSetter<AS> | cookie and usersServer and http | | http | HTTPServer | http option |

Instance methods

| Method | Returns | Description | |--------|---------|--------------| | whenReady() | Promise<this> | Resolves when init completes |

Static methods

| Method | Returns | Description | |--------|---------|--------------| | InSite.init(options, asPromise?) | Promise<OmitRedundant<IS, IO>> or OmitRedundant<IS, IO> | Factory. With asPromise === false, returns instance synchronously. |

Options

| Option | Type | Description | |--------|------|-------------| | db | DBOptions | MongoDB connection (url, name, onConnect) | | config | ConfigSchema \| null | Schema for config collection | | ssl | { cert: string; key: string } | TLS certificates for HTTP and WS | | port | number \| string | Port for HTTP and WS server | | wss | WSS<AS> | WebSocket server options (subscriptions, transports) | | users | Users<AS> | Users, roles, orgs, sessions | | cookie | Cookie<AS> \| null | Cookie middleware and setter options | | http | HTTP | HTTP server (static, template, middlewares) | | public | boolean | Whether the server is public |

Related

License

MIT