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

strapi-neon-tech-db-branches

v0.1.18

Published

This Strapi Plugin integrates neon.tech serverless Postgres DB - including automatic DB branch creation (synced with git branch)

Downloads

319

Readme

Strapi v4 plugin strapi-neon-tech-db-branches

This plugin integrates neon.tech with Strapi. It does the following:

  • automatically inject the postgres connection string (host, port, username, password) using your current git branch or environment variables
  • create a new neon database branch for your current working git branch
  • the same database branch is used in development as well as in the preview deployment which eliminates copying and recreation of testing data

isolated databases

The neon parent branch will always be the main branch. Therefore this plugin follows the develop-preview-ship principle. This will make working with Strapi way more easy since therefore Strapi is always "seeded" with live data.

Installation

The neon-sdk dependency requires at least node v18. Therefore this package also requires at least node v18

npm i strapi-neon-tech-db-branches
pnpm i strapi-neon-tech-db-branches

Configuration

First create a new project in neon.tech and copy your credentials for the following Setup. During development the git-branch does not have to be set and is automatically read from your .git/head/refs file.

This plugin can be configured via Environment variables or via plugins.js config:

Configure via Environment Variables:

  • NEON_API_KEY get it from here: https://console.neon.tech/app/settings/api-keys
  • NEON_PROJECT_NAME the neon project under wich your DB runs
  • NEON_ROLE create it manually under roles for your project first
  • GIT_BRANCH || GITHUB_REF_NAME || VERCEL_GIT_COMMIT_REF The branch can be pinned via one of these env variables (will use first available). If set, plugin will not use branch from git then. Usefull for deployment or in CI

Configure via config/plugin.js config:

module.exports = {
  ...
  'strapi-neon-tech-db-branches': {
    enabled: true,
    config: {
      neonApiKey: "09hx...0a8yjd", // get it from here: https://console.neon.tech/app/settings/api-keys
      neonProjectName: "strapi-project-xyz", // the neon project under wich your DB runs
      neonRole: "sample-user", // create it manually under roles for your project first
      //(gitBranch: "main") // branch can be pinned via this config option. Will not use branch from git then. Usefull for preview/production deployment
    }
  },
  ...
}

Usage in CI (for production/preview deployments):

For a production/preview deployment you generally do not want to deploy your whole git repo but instead build and bundle your application. Make sure to start the bundled application with environment variable GIT_BRANCH set. Best Option is to add this env variable in your CI Pipeline to the preview deployment. In Github Actions the git branch name is available during the CI run with ${{ github.ref_name }} .

If you have any API liveness probes/checks for your containers, make sure to use a route wich does not trigger DB usage. Otherwise your neon endpoints will run even on inactivity. DB get's triggered for example on /index.html so better use something from the static folder like /assets/images/logo_login.png/assets/images/logo_login.png

Sponsors

Strapi Plugin developed and maintained by trieb.work cloud consulting