0.0.13 • Published 8 months ago

@creazy231/strapi-plugin-apollo-sandbox v0.0.13

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago


💭 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,
    // 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.

0.0.13

8 months ago

0.0.11

10 months ago

0.0.11-beta.1

10 months ago

0.0.11-beta.0

10 months ago

0.0.10

10 months ago

0.0.10-beta.1

10 months ago

0.0.10-beta.0

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago