A specialized visualization tool for Rewst workflow templates.
Rewst Workflow Viewer is a React/TypeScript application that allows users to upload Rewst workflow JSON templates and visualize them as interactive node graphs. The application provides a detailed view of workflow tasks, their connections, and properties, making it easier to understand complex workflows.
- File Upload: Upload Rewst workflow JSON templates
- GitHub Integration: Browse and visualize workflows directly from GitHub repositories
- Interactive Visualization: View workflows as interactive node graphs
- Task Details: Expand nodes to see detailed information about each task
- Visual Indicators: Different colors and icons for various task types and properties
- Export Options: Save visualizations as SVG or PNG
- Responsive Design: Works on various screen sizes
- Persistent Browsing: Maintain your browsing context while viewing workflows
- Efficient Caching: Minimize GitHub API calls with local storage caching
- Bundle-Focused Browsing: Automatically filter repositories to show only folders with workflow bundles
- React 18 with TypeScript
- Vite for fast development and building
- ReactFlow for graph visualization
- Tailwind CSS for styling
- html-to-image for export functionality
- Node.js (v18+)
- npm or yarn
- Clone the repository
- Install dependencies:
npm install
- Start the development server:
npm run dev
- Open your browser to the local development server (typically http://localhost:5173)
npm run build
The built files will be in the dist
directory.
- Launch the application
- Upload a Rewst workflow JSON template using the file upload interface
- The workflow will be visualized as an interactive graph
- Hover over nodes to see basic information
- Click on nodes to expand and see detailed information
- Use the controls to pan and zoom the graph
- Use the export buttons to save the visualization as SVG or PNG
- Scroll down to the "Featured Workflows from GitHub" section
- Browse through the featured GitHub contributors
- Click on a contributor to view their repositories
- Navigate through repository folders to find workflow bundles
- README files will be displayed automatically when available
- Click on a workflow bundle file (_.json or _.bundle.json) to visualize it
- The GitHub browser remains visible while viewing workflows, allowing you to:
- Easily return to browsing after viewing a workflow
- Toggle the browser visibility with the "Hide/Show Browser" button
- Navigate to different folders without losing your place
The project follows a standardized component-based structure:
src/components/
: UI components organized in dedicated directoriessrc/lib/
: Utility functions and shared logicsrc/types/
: TypeScript type definitionssrc/styles/
: Global styles and theme configuration
src/components/FileUpload/
: Handles JSON file uploadsFileUpload.tsx
: Main componenttypes.ts
: TypeScript interfacesconstants.ts
: Component constants
src/components/GitHubRepoBrowser/
: Provides GitHub repository browsing functionalityGitHubRepoBrowser.tsx
: Main componenttypes.ts
: TypeScript interfacesconstants.ts
: Component constants
src/components/WorkflowViewer/
: Main visualization componentsWorkflowViewer.tsx
: Main component for rendering the workflow graphcomponents/
: Sub-components for the workflow viewerhooks/
: Custom hooks for workflow processingutils/
: Utility functions for workflow visualizationconstants/
: Constants for the workflow viewer
src/components/TaskNode/
: Components for rendering task nodesTaskNode.tsx
: Main component for rendering task nodesTaskNodeHeader.tsx
: Header component for task nodesTaskNodeDetails.tsx
: Component for displaying task detailsuseTaskNode.ts
: Hook for task node functionality
src/components/ui/
: Shared UI componentsbutton.tsx
: Button componentcard.tsx
: Card componenttabs.tsx
: Tabs component- And more reusable UI components
src/lib/utils.ts
: Shared utility functionssrc/lib/workflow-validation.ts
: Workflow validation utilitiessrc/types/workflow.ts
: TypeScript interfaces for workflow data
The project uses the @/
path alias to reference files from the src
directory, making imports cleaner and more maintainable.
The application parses and visualizes Rewst workflow templates in JSON format. The parsing process involves:
- Validation: Verifying the JSON structure matches the expected Rewst workflow format
- Processing: Converting workflow tasks into nodes and transitions into edges
- Layout: Automatically positioning nodes if no position data is available
- Rendering: Displaying the workflow as an interactive graph
{
"version": number, // Version of the workflow format (1 or 2)
"exportedAt": string, // Timestamp when the workflow was exported
"objects": { // Map of workflow objects
[key: string]: {
"type": string, // Object type (e.g., "workflow", "action", etc.)
"content_hash": string,
"hash": string,
"fields": {
"tasks": [ // Array of workflow tasks
{
"id": string, // Unique identifier for the task
"type": string, // Task type
"name": string, // Display name
"description": string,
"action": { // Action to perform
"id": string,
"ref": string // Reference to action definition
},
"next": [ // Transitions to next tasks
{
"id": string,
"label": string,
"do": string[]
}
],
// Additional task properties...
}
],
// Additional workflow fields...
},
"nonfunctional_fields": {
// Metadata and display properties
}
}
},
"references": {
// References to external objects
}
}
The workflow parsing process follows these steps:
-
Bundle Validation (
isValidWorkflowBundle
inworkflow-validation.ts
):- Checks for required top-level properties (version, exportedAt, objects)
- Verifies version is supported (1 or 2)
- Ensures at least one workflow object with tasks exists
-
Workflow Processing (
useWorkflowProcessor
hook):- Identifies the selected workflow from the bundle
- Extracts tasks and converts them to nodes
- Processes transitions into edges
- Adds trigger connections if applicable
- Applies automatic layout if position data is missing
-
Visualization (
WorkflowViewer
component):- Renders the processed nodes and edges using ReactFlow
- Provides interactive controls for navigation
- Enables expanding/collapsing task details
- Supports zooming, panning, and exporting
The viewer supports both version 1 and version 2 of the Rewst workflow format, with automatic detection and appropriate handling of each version's specific features.
The application can browse and visualize workflows directly from GitHub repositories. By default, it connects to featured GitHub contributors who have shared Rewst workflows.
- Smart Repository Filtering: Automatically identifies and displays only folders containing
.bundle.json
files - Rewst Repository Discovery: Finds repositories with "rewst" in their name
- Efficient Caching: Minimizes API calls with local storage caching (24-hour expiration)
- Repository Browsing: Navigate through repository folders
- README Rendering: Automatically displays documentation when available
- Direct Visualization: One-click workflow bundle loading
- External Links: Quick access to view files on GitHub
- Persistent Context: Maintain browsing state while viewing workflows
- Custom Repository Input: Enter specific repositories for each contributor
The GitHub integration uses the public GitHub API with the following considerations:
- Rate Limiting: Implements caching to minimize API calls and avoid rate limits
- Authentication: Uses unauthenticated API access (subject to lower rate limits)
- Cache Management: Provides a "Clear Cache" button to refresh data when needed
- Error Handling: Gracefully handles API errors with informative messages
To add new GitHub contributors to the featured list:
- Identify users with repositories containing
.bundle.json
files - Add them to the
FEATURED_USERS
array insrc/components/GitHubRepoBrowser/constants.ts
- Provide their GitHub username, display name, and description
- Issue: Workflow loads but doesn't display any nodes
- Solution: Check that the JSON format matches the expected structure. The workflow must have a
tasks
array with valid task objects.
- Issue: Error message about GitHub API rate limit
- Solution:
- Wait for the rate limit to reset (time is shown in the error message)
- Clear the cache to use cached data if available
- Consider implementing GitHub authentication for higher rate limits
- Issue: Nodes overlap or are positioned poorly in large workflows
- Solution:
- Use the layout controls to adjust the layout
- Try different layout algorithms
- Manually adjust node positions by dragging
- Issue: Slow performance with very large workflows
- Solution:
- Close other browser tabs/applications
- Use the latest version of Chrome, Firefox, or Edge
- Consider splitting very large workflows into smaller sub-workflows
If you encounter issues not covered here, please report them on the GitHub repository's Issues page with:
- A description of the problem
- Steps to reproduce
- Expected vs. actual behavior
- Browser and OS information
- Screenshots if applicable
- Sample workflow JSON if possible (with sensitive data removed)
We welcome contributions to improve the Rewst Workflow Viewer! See CONTRIBUTING.md for detailed guidelines.
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/workflow-vizualizer.git
- Install dependencies:
npm install
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes
- Run tests:
npm test
- Commit with a descriptive message:
git commit -m "Add feature: your feature description"
- Push to your fork:
git push origin feature/your-feature-name
- Create a Pull Request
- Search/Filter: Add functionality to search and filter large workflows
- Workflow Comparison: Implement side-by-side comparison of workflow versions
- Multiple Workflow Management: Add ability to save/load multiple workflows
- Mini-Map: Add a mini-map for navigation in large workflows
- Accessibility Improvements: Enhance keyboard navigation and screen reader support
- Test Coverage: Add comprehensive unit and integration tests
- GitHub Authentication: Add support for authenticated GitHub API access
- Custom Themes: Allow users to customize the visualization appearance
- Workflow Analytics: Add metrics and statistics about workflow complexity
- All workflow processing happens client-side in the browser
- No workflow data is sent to any server
- GitHub API requests are made directly from the browser
- Cached data is stored in the browser's localStorage
- Keep sensitive data out of workflow templates shared publicly
- Review workflows before uploading to ensure they don't contain secrets
- Clear browser cache and localStorage when working with sensitive workflows
- Use the latest browser version with security updates
GNU General Public License v3.0
- ReactFlow for the graph visualization library
- Tailwind CSS for styling
- Vite for the build system
- Lucide Icons for the icon set
- All contributors who have helped improve this project