A framework for delightful GraphQL developer portals ✨.
npm add polen vite react react-dom
vite
,react
,react-dom
are peer dependencies of Polen.- We would like to remove
react
andreact-dom
as peers deps in the future to simplify this for you. (see)
You can find working examples in the examples directory.
The following shows minimal default usage.
-
Have a GraphQL schema file in the same directory that you run
vite
.type Query { hello: String }
-
Use Polen in your Vite config.
import { Polen } from 'polen' export default Polen.createConfiguration({ // options here... })
-
Build your developer portal.
npx vite build --app
-
You now have a deployable developer portal. Try it locally (http://localhost:5174):
node dist/entry.js
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)**.`,
},
],
})
Polen is an ESM only package. If you are using CJS, then you need
NodeJS version >=22.0.0
to require
it.
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
Refer to releases on this repo.
If you are working on Polen itself, then refer to DEVELOPMENT.md for details about workflow, testing, etc.