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

@cyguin/sniplet

v0.2.0

Published

Pastebin for code. Drop-in snippet sharing for Next.js with syntax highlighting, burn-on-read, and expiry.

Readme

@cyguin/sniplet

Pastebin for code. Drop-in snippet sharing for Next.js apps.

npm install @cyguin/sniplet

Share code snippets via URL — burn-on-read, expiry, syntax highlighting. No account required. Self-hosted on your own database.


Quick Start

1. Install

npm install @cyguin/sniplet

2. Add the routeapp/api/snips/[...cyguin]/route.ts:

import { createSnipletHandler } from '@cyguin/sniplet/next'
import { SQLiteAdapter } from '@cyguin/sniplet/adapters/sqlite'

(globalThis as any).__SNIPLET_CONFIG__ = createSnipletHandler({
  adapter: SQLiteAdapter({ path: './data/sniplet.db' }),
  options: {
    defaultExpiry: '7d',
    rateLimit: { window: '1m', max: 30 },
  },
})

export { handler as GET, handler as POST, handler as DELETE } from '@cyguin/sniplet/next'

Wait — the handler export doesn't exist yet. The real pattern in Next.js App Router is:

// app/api/snips/[...cyguin]/route.ts
import { createSnipletHandler } from '@cyguin/sniplet/next'
import { SQLiteAdapter } from '@cyguin/sniplet/adapters/sqlite'

const handler = createSnipletHandler({
  adapter: SQLiteAdapter({ path: './data/sniplet.db' }),
})

export async function GET(req: Request, { params }: { params: Promise<{ cyguin: string[] }> }) {
  return handler(req, params as any)
}
export async function POST(req: Request, { params }: { params: Promise<{ cyguin: string[] }> }) {
  return handler(req, params as any)
}
export async function DELETE(req: Request, { params }: { params: Promise<{ cyguin: string[] }> }) {
  return handler(req, params as any)
}

3. Drop in the components:

// app/snips/create/page.tsx
'use client'
import { SnipCreate } from '@cyguin/sniplet/react'

export default function CreatePage() {
  return (
    <SnipCreate
      apiBase="/api/snips"
      onSuccess={(id, url) => {
        navigator.clipboard.writeText(url)
        window.location.href = `/snips/${id}`
      }}
      theme="light"
    />
  )
}
// app/snips/[id]/page.tsx
'use client'
import { SnipView } from '@cyguin/sniplet/react'

export default function SnipPage({ params }: { params: { id: string } }) {
  return <SnipView id={params.id} apiBase="/api/snips" theme="light" />
}

API Routes

| Method | Route | Description | |--------|-------|-------------| | GET | /api/snips/[...cyguin] | Get a snip by ID | | GET | /api/snips/options | List expiry options | | POST | /api/snips | Create a new snip | | DELETE | /api/snips/[...cyguin] | Delete a snip |


Theming

All components use --cyguin-* CSS custom properties. Set them on a parent element or CSS selector:

/* Light (default) */
:root {
  --cyguin-bg: #ffffff;
  --cyguin-bg-subtle: #f5f5f5;
  --cyguin-border: #e5e5e5;
  --cyguin-fg: #0a0a0a;
  --cyguin-fg-muted: #888888;
  --cyguin-accent: #f5a800;
  --cyguin-accent-dark: #c47f00;
  --cyguin-accent-fg: #0a0a0a;
  --cyguin-radius: 6px;
  --cyguin-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Dark (Cyguin) */
[data-theme="dark"] {
  --cyguin-bg: #0a0a0a;
  --cyguin-bg-subtle: #1a1a1a;
  --cyguin-border: #2a2a2a;
  --cyguin-fg: #f5f5f5;
  --cyguin-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

Or pass theme="dark" prop:

<SnipCreate theme="dark" />
<SnipView theme="dark" />

Adapters

SQLite (default)

import { SQLiteAdapter } from '@cyguin/sniplet/adapters/sqlite'

createSnipletHandler({
  adapter: SQLiteAdapter({ path: './data/sniplet.db' }),
})

Postgres

import { PostgresAdapter } from '@cyguin/sniplet/adapters/postgres'

createSnipletHandler({
  adapter: PostgresAdapter({ connectionString: process.env.DATABASE_URL! }),
})

Exports

| Import | What you get | |--------|-------------| | @cyguin/sniplet | Types: Snip, CreateSnipInput, SnipletAdapter, error classes | | @cyguin/sniplet/next | createSnipletHandler, SnipletConfig, SnipletOptions, ExpiryOption | | @cyguin/sniplet/react | SnipCreate, SnipView | | @cyguin/sniplet/adapters/sqlite | SQLiteAdapter | | @cyguin/sniplet/adapters/postgres | PostgresAdapter |


Requirements

  • Next.js 14+ (App Router)
  • React 18+
  • Node.js 20+

License

MIT