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 🙏

© 2024 – Pkg Stats / Ryan Hefner

prisma-accelerate-local

v1.1.4

Published

Prisma Accelerate functionality can be self-hosted locally.

Downloads

3,473

Readme

prisma-accelerate-local

Prisma Accelerate functionality can be self-hosted locally.

Samples

  • Node.js (local)
    https://github.com/SoraKumo001/prisma-accelerate-local-test
  • Cloudflare Workers(Postgres) (local)
    https://github.com/SoraKumo001/cloudflare-workers-prisma
  • Cloudflare Workers(Postgres) (server)
    https://github.com/SoraKumo001/prisma-accelerate-workers
  • Cloudflare Workers(D1) (server)
    https://github.com/SoraKumo001/prisma-accelerate-workers-d1
  • Deno(Postgres) (server)
    https://github.com/SoraKumo001/prisma-accelerate-deno

usage

CLI Options

| Category | Option | Description | | ------------- | --------------------------- | --------------------------------------------- | | USAGE | [option] <url> | | | ARGUMENTS | <url> | Datasource url | | OPTIONS | -t, --http | Accepted at http | | | -p, --port <port> | Port to listen on (default:4000) | | | -h, --host <host> | Host to listen on (default:localhost) | | | -c, --cert <path> | Path to ssl cert file | | | -k, --key <path> | Path to ssl key file | | | -w, --wasm | Use wasm as the run-time engine(early-access) | | | -s, --secret <secret> | Secret used with API key | | | -m, --make | make api key | | | -b, --bodyLimit <size(MB)> | body limit size(default: 16MB) |

CLI

Start without setting an API key for local use.

# Startup by specifying the Datasource url
npx prisma-accelerate-local postgresql://postgres:password@localhost:5432/postgres

# Startup by specifying Port
npx prisma-accelerate-local postgresql://postgres:password@localhost:5432/postgres -p 8000

When setting the API key

  • Create an API key
npx prisma-accelerate-local -s secret -m postgresql://postgres:password@localhost:5432/postgres

# Output
eyJhbGciOiJIUzI1NiJ9.eyJkYXRhc291cmNlVXJsIjoiYSIsImlhdCI6MTcwMzY2NDg1NywiaXNzIjoicHJpc21hLWFjY2VsZXJhdGUifQ.4ruaA1RAT9cD3PACSEVIdUs3i2exKkMpNYGks3hyos4
  • Activate with API key enabled.

If secret is used, the DB address is embedded in the API key

npx prisma-accelerate-local -s secret

Client Environment Variables

With regard to the Node.js configuration.

Please set the environment variable NODE_TLS_REJECT_UNAUTHORIZED because you are using an unauthenticated certificate.

With regard to api_key

  • If you are not using secret, the api_key can be any string.
  • If you are using secret, put --secret and the api_key created with --make in api_key

Example

  • .env
DATABASE_URL="prisma://localhost:4000/?api_key=API_KEY"
NODE_TLS_REJECT_UNAUTHORIZED="0"
# To remove the NODE_TLS_REJECT_UNAUTHORIZED warning
NODE_NO_WARNINGS="1"

library

If you call this package as a library, it will look like this.

import { createServer } from 'prisma-accelerate-local';

const server = createServer({
  datasourceUrl: 'postgresql://postgres:password@localhost:5432/postgres',
})
  .listen({ port: 4000 })
  .then((url) => console.log(`🚀  Server ready at ${url} `));