- Refined IntelliJ IDEA settings in `.idea/workspace.xml`, including updates to `ProblemsViewState` and `PropertiesComponent` for project consistency. - Renamed and expanded `.junie/guidelines.md` to reflect updated best practices, project structure, and development workflows.
2.3 KiB
2.3 KiB
Project Guidelines
This document provides concise information and best practices for developers working on the Zabbix GraphQL API project.
Tech Stack
- Runtime: Node.js (v18+)
- Language: TypeScript (ESM)
- API: GraphQL (Apollo Server 4)
- Testing: Jest
- Deployment: Docker
Project Structure
src/api/: GraphQL server configuration, schema loading, and root resolvers (seecreateResolversinresolvers.ts).src/datasources/: Modular classes for interacting with various Zabbix API components (hosts, items, etc.).src/execution/: Business logic for complex, multi-step operations (importers, exporters, deleters).src/model/: Shared data models and enumerations.src/test/: Unit and integration tests.schema/: GraphQL Schema Definition Language (SDL) files.
Common Scripts
npm run start: Launches the development server withtsxandnodemonfor hot-reloading.npm run test: Executes the Jest test suite.npm run codegen: Generates TypeScript types based on the GraphQL schema definitions.npm run compile: Compiles TypeScript source files into thedist/directory.npm run prod: Prepares the schema and runs the compiled production build.
Best Practices & Standards
- ESM & Imports: The project uses ECMAScript Modules (ESM). Always use the
.jsextension when importing local files (e.g.,import { Config } from "../common_utils.js";), even though the source files are.ts. - Configuration: Always use the
Configclass to access environment variables. Avoid directprocess.envcalls. - Type Safety: Leverage types generated via
npm run codegenfor resolvers and data handling to ensure consistency with the schema. - Import Optimization:
- Always optimize imports before committing.
- Project setting
OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMITis enabled. - Junie should include "Optimize imports" as a step in every plan.
- Modular Datasources: When adding support for new Zabbix features, create a new datasource class in
src/datasources/extendingZabbixRESTDataSource. - Schema Organization: Place GraphQL SDL files in the
schema/directory. Use descriptive comments in SDL as they are used for API documentation. - Testing: Write reproduction tests for bugs and cover new features with both unit and integration tests in
src/test/.