Skip to content

the-guild-org/polen

Repository files navigation

Polen

A framework for delightful GraphQL developer portals ✨.

Installation

npm add polen vite react react-dom
  • vite, react, react-dom are peer dependencies of Polen.
  • We would like to remove react and react-dom as peers deps in the future to simplify this for you. (see)

Example

You can find working examples in the examples directory.

The following shows minimal default usage.

  1. Have a GraphQL schema file in the same directory that you run vite.

    type Query {
       	hello: String
     	}
  2. Use Polen in your Vite config.

    import { Polen } from 'polen'
    
    export default Polen.createConfiguration({
      // options here...
    })
  3. Build your developer portal.

    npx vite build --app
  4. You now have a deployable developer portal. Try it locally (http://localhost:5174):

    node dist/entry.js

Guide

Schema Augmentations

Schema Descriptions

You can append/prepend/replace descriptions of types and fields in your schema.

import { Polen } from 'polen'

export default Polen.createConfiguration({
  templateVariables: {
    title: `Basic Developer Portal`,
  },
  schemaAugmentations: [
    {
      type: `description`,
      on: {
        type: `TargetType`,
        name: `Query`,
      },
      placement: `over`,
      content:
        `**Content from [Polen](https://github.com/the-guild-org/polen)**.`,
    },
  ],
})

Package

ESM

Polen is an ESM only package. If you are using CJS, then you need NodeJS version >=22.0.0 to require it.

Exports

You can import a Polen namespace from polen. You can import its bare exports from polen/exports.

import { Polen } from 'polen'
import { VitePlugin } from 'polen/exports'

console.log(Polen.VitePlugin === VitePlugin) // true

Other

Changelog

Refer to releases on this repo.

Development

If you are working on Polen itself, then refer to DEVELOPMENT.md for details about workflow, testing, etc.

About

A framework for delightful GraphQL developer portals ✨

Resources

Stars

Watchers

Forks

Packages

No packages published