Skip to main content

Technical Documentation

This page provides technical details about Graphitron's components and implementation.

Core Components

graphitron-maven-plugin

The primary component of Graphitron is the graphitron-maven-plugin, which generates Java code from GraphQL schemas using directives that map to your database models.

  • Generate the GraphQL code and database queries needed to resolve a GraphQL query
    • In many cases, writing backend code can be skipped entirely!
    • Need more advanced queries? Graphitron provides options for setting custom conditions, sorting, queries and more, while still taking care of the GraphQL-side of things
    • Custom services can be used to implement more complex logic that cannot be generated
  • Supports Apollo Federation
  • Error handling

For implementation details, code samples, and advanced configuration options, see the source repository.

graphitron-schema-transformer

Graphitron schema transformer is a Maven plugin that can run independently of the main graphitron-maven-plugin. It is used to transform GraphQL schemas in various ways.

Key capabilities

  • Feature flag transformation

This allows you to include or exclude parts of your GraphQL schema based on specified feature flags. This is useful for controlling the visibility of certain fields, types, or arguments in your schema depending on the active feature flags.

  • Automatic Feature Directive Application

The schema-transformer Maven plugin automatically applies the @feature directive to fields, arguments, and enums based on the file structure of the provided schemas. This works in tandem with feature flag transformation to include the correct schema parts based on active feature flags.

  • Schema splitting

You can create separate Maven execution blocks to generate different types of schemas. This is useful for creating different schemas for different use cases or feature sets.

See the schema-transformer documentation for more information.

Example Implementation

For a working implementation demonstrating both plugins, refer to our example project.

Technical Requirements

  • Java 17 or higher
  • jOOQ (compatible version requirements based on your database)
  • Maven