Contributing to TFCE GraphQL
Thank you for your interest in contributing to the TFCE GraphQL project! We welcome your input and collaboration. Please follow the guidelines below to ensure a smooth development process.
Getting Started
-
Fork the repository and clone it to your local machine.
-
Run
npm installto install dependencies. -
Create a
.envfile in the project root and configure environment variables (e.g.,TFCE_JWT_ENCRYPTION_KEY,TFE_BASE_URL, etc.). -
Build and start the project with:
npm install
npm start
Code Style and Standards
- This project uses TypeScript with strict type checking enabled.
- All source files are located under the
/srcdirectory and are organized by domain. - Use ESLint to ensure code quality: run
npm run lint. - Ensure your code is formatted using Prettier: run
npm run format.
Writing Tests
- We use Vitest for testing and
nockfor mocking HTTP calls. - Unit tests should live in the
tests/folder, mirroring the source file structure. - Write tests for new features and regression tests for bug fixes.
- Run the test suite with
npm run test.
Commits and Branches
- Use feature branches from
mainordevelop:feature/short-description. - Use clear commit messages. Prefer imperative style: “Add support for workspace resources”.
GraphQL Schema
- Use the
schema.tsfiles withgqltemplate literals for defining types.
- Use the
filterargument for all entity filters (nested filters are supported via composed*Filtertypes). - Define type definitions in the
schema.tsfiles and register them along with resolvers insrc/server/schema.ts.
Data Sources and Mappers
- Place new API interaction logic under
/src/<domain>/dataSource.ts. - Map API responses to internal types using a
mapper.tsfile. - Define types in
types.tsusing API-aligned*Attributesand mapped types.
Docker and Deployment
- Build with
npm run docker:build. - A lightweight, multi-arch Dockerfile is provided for secure production use.
- Run the container locally using:
docker run -p 4000:4000 tfce-graphql.
Documentation
-
Project uses Docusaurus for documentation under
/docs. -
Add or edit pages in the relevant folder under
docs/docs/. -
Run the docs locally with:
cd docs
npm install
npm start
Request Caching
- A request-level cache exists for resolver optimization.
- Use
context.requestCache.getOrSet(entity, id, fetchFn)to prevent redundant calls.
Submitting a PR
- Make sure all tests pass:
npm run test. - Ensure linter and formatter are clean.
- Push your branch and open a pull request.
- Clearly explain what the change does and why.
Need Help?
Open an issue or reach out via the discussion board. We appreciate your help improving TFCE GraphQL!