This document is for AI agents (and humans) working on the ProcessGraphQL codebase. It outlines the project structure, development workflows, and common tasks.
ProcessGraphQL is a ProcessWire module that seamlessly integrates GraphQL into a ProcessWire application. It allows users to serve a GraphQL API of their existing content without modifying structure.
- Stack: PHP (ProcessWire), Node.js (Dev tooling).
- Core Library:
webonyx/graphql-php. - Key Features:
- Schema generation based on ProcessWire Templates and Fields.
- Access Control (respects ProcessWire permissions).
- GraphiQL interface.
- Extensible via Hooks (
getQueryFields,getMutationFields).
src/: Core PHP source code (PSR-4ProcessWire\GraphQL\).test/: PHPUnit tests.ProcessGraphQL.module: Main module file (ProcessWire entry point).ProcessGraphQLConfig.php: Module configuration logic.graphiql/: GraphiQL interface assets.vendor/: Composer dependencies.
- PHP >= 7.4
- Composer
- Node.js & NPM
- Install dependencies:
npm install # This automatically runs composer install via postinstall
- Run all tests:
npm test(Runs PHPUnit) - Performance tests:
npm run test:performance - Coverage:
npm run test:cover
- Prettier:
npm run prettier(Formats code)
Check src/Type/Fieldtype/ to see existing implementations.
- Create a new class mapping the ProcessWire Fieldtype to GraphQL types.
- Register it in the main schema generation logic.
- Use
test/client.phpandtest/server.phpfor local testing (vianpm start). - Logs are typically handled by ProcessWire's logging system.
- Uses
semantic-release. - Commit messages should follow conventional commits (e.g.,
feat:,fix:) to trigger version bumps.
See Todo.md for the current backlog.
- N+1 Problems: Needs optimization for Files, Images, and Repeaters.
- Security: Selector sanitization needs review.
- Performance: Query complexity limiting is missing.
composer dump-autoload: Regenerate autoloader after adding classes.ls -F: Quick check of file structure.
Generated by Dobby (AI Agent)