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

@shophost/rest-api

v2.0.76

Published

`@shophost/rest-api` is the backend package for ShopHost. It provides:

Readme

@shophost/rest-api

@shophost/rest-api is the backend package for ShopHost. It provides:

  • the core API app builder
  • a Next.js route handler integration
  • exported Zod/OpenAPI schemas
  • a packaged Prisma schema and CLI for database sync

Installation

pnpm add @shophost/rest-api prisma @prisma/client @prisma/client-runtime-utils

Peer dependencies:

  • next >= 14
  • react >= 18
  • react-dom >= 18

Entry Points

  • @shophost/rest-api Exposes buildApiApp, generateOpenApiSpec, and schema exports.
  • @shophost/rest-api/next Exposes createNextHandler for Next.js App Router route handlers.
  • @shophost/rest-api/db Exposes packaged Prisma client helpers.
  • @shophost/rest-api/schemas Exposes reusable request/response schemas.

Next.js Usage

Create an App Router API route:

import { createNextHandler } from "@shophost/rest-api/next";

const handler = createNextHandler({
  database: {
    connectionString: process.env.DATABASE_URL!,
    log: ["info", "warn", "error"],
  },
  maps: {
    google: {
      key: process.env.GOOGLE_PLACES_API_KEY!,
    },
  },
  auth: {
    baseURL: process.env.NEXT_PUBLIC_API_BASE_URL!,
    domain: new URL(process.env.NEXT_PUBLIC_API_BASE_URL!).hostname.split(".").slice(-2).join("."),
    trustedOrigins: [process.env.NEXT_PUBLIC_APP_DOMAIN!],
    socialProviders: {
      google: {
        clientId: process.env.AUTH_GOOGLE_ID!,
        clientSecret: process.env.AUTH_GOOGLE_SECRET!,
      },
    },
  },
});

export { handler as GET, handler as POST, handler as PUT, handler as PATCH, handler as DELETE, handler as OPTIONS };

You can configure Resend per organization from the admin UI under Settings -> Integrations -> Resend.

Database Schema Sync

The published package ships the Prisma schema and a CLI so a consuming app can push the schema without copying Prisma files into the host project.

  1. Set DATABASE_URL in .env.local, .env, or your shell.
  2. Run:
pnpm exec shophost-rest-api db push

You can also pass standard Prisma flags through:

pnpm exec shophost-rest-api db push --accept-data-loss
pnpm exec shophost-rest-api db push --url "postgresql://user:password@host:5432/dbname?sslmode=require"

Schemas and Utilities

Import shared schemas:

import { CreateProductSchema, ProductSchema } from "@shophost/rest-api/schemas";

Import Prisma helpers owned by this package:

import { createPrismaClient, PrismaClient } from "@shophost/rest-api/db";

Generate the OpenAPI document:

import { generateOpenApiSpec } from "@shophost/rest-api";

const spec = generateOpenApiSpec();

Local Development

pnpm exec nx run rest-api:prisma:generate
pnpm exec nx run rest-api:test

License

MIT