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

@creazy231/strapi-plugin-apollo-sandbox

v0.0.15

Published

Integrate Apollo Sandbox for a powerful GraphQL Explorer in your Strapi Admin Interface

Downloads

870

Readme



💭 Motivation

There already is a GraphQL Playground plugin for Strapi, why do I need Apollo Sandbox? Well, the current Playground just doesn't provide a good developer experience in my opinion. Apollo Sandbox is a great alternative to the GraphQL Playground with an awesome developer experience. That's why I created this plugin.

⏳ Installation

Install the plugin in your Strapi project.

# using yarn
yarn add @creazy231/strapi-plugin-apollo-sandbox

# using npm
npm install @creazy231/strapi-plugin-apollo-sandbox --save

After successful installation, you've to build a fresh package. To archive that simply use:

yarn build && yarn develop
# or
npm run build && npm run develop

The Apollo Sandbox plugin should appear in the Plugins section of Strapi sidebar after you run the app again.

🔧 Configuration

[!IMPORTANT] This plugin requires the graphql plugin and its playground to be enabled. You can enable it in the ./config/plugins.ts file in your Strapi project. You also need to modify the ./config/middlewares.ts file and replace strapi::security with the following:

export default [
  // ...
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        directives: {
          "frame-src": [ "http://localhost:*", "self", "sandbox.embed.apollographql.com" ],
        },
      },
    },
  },
  // ...
]

After the modification, your file should look like this:

export default [
  "strapi::errors",
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        directives: {
          "frame-src": [ "http://localhost:*", "self", "sandbox.embed.apollographql.com" ],
        },
      },
    },
  },
  "strapi::cors",
  "strapi::poweredBy",
  "strapi::logger",
  "strapi::query",
  "strapi::body",
  "strapi::session",
  "strapi::favicon",
  "strapi::public",
];

🛠️ Plugin Configuration

Config can be changed in the ./config/plugins.ts file in your Strapi project. You can overwrite the config like so:

export default {
  // ...
  "graphql": {
    enabled: true,
    config: {
      // set this to true if you want to enable the playground in production
      playgroundAlways: false,
    },
  },
  "apollo-sandbox": {
    // enables the plugin only in development mode
    // if you also want to use it in production, set this to true
    // keep in mind that graphql playground has to be enabled
    enabled: process.env.NODE_ENV === "production" ? false : true,
    config: {
      // endpoint: "https://tunneled-strapi.com/graphql", // OPTIONAL - endpoint has to be accessible from the browser
    }
  },
  // ...
};

endpoint configuration is optional. If you don't provide it, the plugin will create a tunnel of your Strapi instance. This is useful if you're developing locally but still want to use the Apollo Sandbox plugin. You can still provide your own tunneled endpoint if you want to.

🖐 Requirements

Complete installation requirements are exact same as for Strapi itself and can be found in the documentation under Installation Requirements.

Supported Strapi versions:

  • Strapi v4.x.x

Node / NPM versions:

  • NodeJS >= 14.21 < 19
  • NPM >= 7.x

We recommend always using the latest version of Strapi to start your new projects.

🤝 Contributing

Feel free to fork and make a Pull Request to this plugin project. All the input is warmly welcome!

⭐️ Show your support

Give a star if this project helped you.

🔗 Links

🌎 Community support

License

MIT License Copyright (c) 2023 creazy231.