Modularium

Modularium

The idea of modularium is heavily inspired by new frontend generative component frameworks. It should be used to bootstrap backend GraphQL projects fast 🚄!

Modules work together with GraphQL Yoga and MongoDB.

Adding a module

When you add a module you add a folder with a code to src/modules/MODULE_NAME. That folder consist of:

  • axolotl.ts
  • index.ts
  • models.ts
  • resolvers.ts
  • schema.graphql
  • To add a module to your project please execute the following command:

    npx @aexol/modularium@latest add MODULE

    where module is the name of actual module. Each module will have it's separate documentation within this repository.

    When module is added it also add's itself to your axolotl.json.

    axolotl.json
    {
        "schema": "schema.graphql",
        "models": "src/models.ts",
        "federation":[
            {
                "schema":"src/modules/main/schema.graphql",
                "models":"src/modules/main/models.ts"
            },
            {
                "schema":"src/modules/users/schema.graphql",
                "models":"src/modules/users/models.ts"
            }
        ]
    }

    This config represents your main schema in modules/main folder and the users module. Main schema.graphql file becomes the supergraph which is generated from GraphQL modules using federation.