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

@colyseus/drizzle-driver

v0.17.7

Published

PostgreSQL driver for Colyseus using Drizzle ORM.

Readme

@colyseus/drizzle-driver

PostgreSQL driver for Colyseus using Drizzle ORM.

Installation

npm install @colyseus/drizzle-driver

Usage

Basic Usage (with DATABASE_URL)

If no options are provided, the driver will use process.env.DATABASE_URL:

import { Server } from '@colyseus/core';
import { PostgresDriver } from '@colyseus/drizzle-driver';

const gameServer = new Server({
  driver: new PostgresDriver()
});

Using with your own Drizzle instance

If you already have a Drizzle database instance, you can provide it directly:

import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import { Server } from '@colyseus/core';
import { PostgresDriver } from '@colyseus/drizzle-driver';

const sql = postgres('postgresql://user:password@localhost:5432/database');
const db = drizzle(sql);

const gameServer = new Server({
  driver: new PostgresDriver({ db })
});

Using with a custom schema

You can provide your own custom schema definition if you need to customize the table name or structure:

import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import { pgTable, text, integer, boolean, timestamp, jsonb } from 'drizzle-orm/pg-core';
import { Server } from '@colyseus/core';
import { PostgresDriver } from '@colyseus/drizzle-driver';

// Define a custom schema (e.g., with a different table name)
const myCustomRoomCaches = pgTable('my_custom_room_table', {
  roomId: text('roomId').primaryKey(),
  clients: integer('clients').notNull(),
  locked: boolean('locked'),
  private: boolean('private'),
  maxClients: integer('maxClients').notNull(),
  metadata: jsonb('metadata'),
  name: text('name').notNull(),
  publicAddress: text('publicAddress'),
  processId: text('processId').notNull(),
  createdAt: timestamp('createdAt'),
  unlisted: boolean('unlisted'),
});

const gameServer = new Server({
  driver: new PostgresDriver({ schema: myCustomRoomCaches })
});

Using both custom database and schema

You can combine both options:

import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import { Server } from '@colyseus/core';
import { PostgresDriver, roomcaches } from '@colyseus/drizzle-driver';

const sql = postgres('postgresql://user:password@localhost:5432/database');
const db = drizzle(sql);

const gameServer = new Server({
  driver: new PostgresDriver({
    db,
    schema: roomcaches // or your custom schema
  })
});

Options

The driver constructor accepts an optional options object:

  • db: (optional) An existing Drizzle database instance. If provided, the driver will use this instance instead of creating a new one from DATABASE_URL.
  • schema: (optional) A custom schema table definition. If not provided, uses the default roomcaches schema.

Features

  • Built on Drizzle ORM and postgres.js
  • Type-safe database operations
  • Efficient query building
  • Full support for all Colyseus MatchMaker operations

Schema

The driver automatically creates a roomcaches table with the following structure:

  • roomId (TEXT, PRIMARY KEY)
  • clients (INTEGER)
  • locked (BOOLEAN, nullable)
  • private (BOOLEAN, nullable)
  • maxClients (INTEGER)
  • metadata (JSONB, nullable)
  • name (TEXT)
  • publicAddress (TEXT, nullable)
  • processId (TEXT)
  • createdAt (TIMESTAMP, nullable)
  • unlisted (BOOLEAN, nullable)

Environment Variables

If no connection string is provided, the driver will use the DATABASE_URL environment variable, or fall back to:

postgresql://postgres:postgres@localhost:5432/postgres

License

MIT