-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add Temporal Project Structure Rule documentation #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c1a4014
feat: Add Temporal Project Structure Rule documentation
anatolyshipitz 5b3e42e
fix: Update description in Temporal Project Structure Rule documentation
anatolyshipitz 78cd124
refactor: Rename 'workers-shared' directory to 'common' in Temporal P…
anatolyshipitz 9002989
Merge branch 'main' into chore/add-temporal-structure-mdc
anatolyshipitz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| --- | ||
| description: "Defines and enforces standardized directory structure and documentation requirements for Temporal-based workflows and workers" | ||
| globs: ["workers/**/*", "docs/user-guide/temporal/**/*"] | ||
| alwaysApply: false | ||
| --- | ||
| # Temporal Project Structure Rule | ||
|
|
||
| ## Purpose | ||
| Defines the required directory and documentation structure for Temporal-based workflows and workers in this repository. | ||
|
|
||
| ## Project Structure | ||
|
|
||
| The project follows a modular structure with workers as independent packages: | ||
|
|
||
| ``` | ||
| . | ||
| ├── workers/ # Root directory for all Temporal workers | ||
| │ ├── main/ # Main worker package | ||
| │ │ ├── src/ # Source code | ||
| │ │ │ ├── activities/ # Activity implementations | ||
| │ │ │ ├── workflows/ # Workflow definitions | ||
| │ │ │ ├── index.ts # Worker entry point | ||
| │ │ │ └── types.ts # Worker-specific types | ||
| │ │ ├── package.json # Worker dependencies | ||
| │ │ ├── tsconfig.json # TypeScript configuration | ||
| │ │ └── README.md # Worker documentation | ||
| │ └── [other-workers]/ # Additional worker packages | ||
| ├── common/ # Shared utilities, types, and configuration for all workers | ||
| ├── docs/ # Project documentation | ||
| │ └── user-guide/ # User guides and documentation | ||
| ├── docker-compose.yml # Docker compose configuration | ||
| └── Dockerfile.temporal # Base Temporal worker Dockerfile | ||
| ``` | ||
|
|
||
| All Temporal workers must be placed under `workers/<worker-name>/` and include: | ||
|
|
||
| - `workflows/` — workflow definitions for this worker | ||
| - `activities/` — activity implementations for this worker | ||
| - `index.ts` — worker entry point (registers workflows/activities, sets task queue) | ||
| - `types.ts` — (optional) worker-specific types | ||
| - `README.md` — brief usage and development instructions | ||
|
|
||
| ### Shared Utilities | ||
|
|
||
| Shared utilities, types, and configuration that are used by multiple workers should be placed in the `workers-shared/` directory at the project root. This directory is intended for code that is not specific to a single worker but is reused across multiple workers to avoid duplication and promote consistency. | ||
|
|
||
| - `workers-shared/` — shared modules, types, and configuration for all workers | ||
| - Utilities and helpers | ||
| - Common type definitions | ||
| - Shared configuration files | ||
|
|
||
| ## Documentation | ||
|
|
||
| Each worker must have a dedicated documentation file at: | ||
| `docs/user-guide/temporal/workers/<worker-name>.md` | ||
|
|
||
| Documentation must include: | ||
|
|
||
| - Purpose and responsibilities of the worker | ||
| - List and description of workflows and activities | ||
| - Required environment variables | ||
| - Integration points (e.g., databases, APIs) | ||
| - Best practices and troubleshooting | ||
|
|
||
| ## Best Practices | ||
|
|
||
| - Keep workflow and activity logic modular and well-tested. | ||
| - Use clear, descriptive names for workflows, activities, and task queues. | ||
| - Update documentation with every significant change to workflows or activities. | ||
| - New workers must not duplicate logic already present in shared modules. | ||
| - Place all shared code in `workers-shared/` to maximize reuse and maintainability. | ||
|
|
||
| ## Enforcement | ||
|
|
||
| - PRs introducing new Temporal workers or workflows **must** follow this structure and update documentation accordingly. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.