- Introduced FormHistoryModal and ProcessHistoryModal components for viewing and restoring previous versions of forms and processes. - Implemented version tracking in the backend with new API endpoints for fetching and restoring historical data. - Added database migrations for form and process history tables to support versioning functionality. - Enhanced form and process update logic to save previous versions before modifications. - Updated documentation to include details on the new history system and its benefits for data management. - Improved user experience with intuitive modals for accessing historical data and restoring previous versions.
10 KiB
System Architecture
This document provides a technical overview of the Corrad ProcessMaker architecture, detailing how the different components interact and the data flows through the system.
High-Level Architecture
The application follows a modern web architecture pattern:
┌────────────────────────────────────────────────────────────────┐
│ User Interface │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Form Builder │ │Process Build│ │ Execution UI│ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└────────────────────────────────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────────────┐
│ State Management │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Form Store │ │Process Store│ │Variable Store│ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└────────────────────────────────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────────────┐
│ API Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Form API │ │ Process API │ │ User API │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└────────────────────────────────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────────────┐
│ Data Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │Form Database│ │Process DB │ │ User DB │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└────────────────────────────────────────────────────────────────┘
Frontend Architecture
The frontend of Corrad ProcessMaker is built with Nuxt 3 and Vue 3, using the Composition API. It follows a component-based architecture with state management powered by Pinia.
UI Components
-
Rose UI Components
- Prefixed with
Rs
(e.g.,RsButton
,RsCard
) - Form the foundation of the UI
- Implemented using Tailwind CSS
- Located in
/components/
- Prefixed with
-
Process Builder Components
- Located in
/components/process-flow/
- Use Vue Flow for visualization
- Main components:
ProcessFlowCanvas.vue
: Main canvasProcessFlowNodes.js
: Node definitionsGatewayConditionManager.vue
: Condition managementFormSelector.vue
: Form selection in form tasks
- Located in
-
Form Builder Components
- Located in
/components/
(root) - Main components:
FormBuilderCanvas.vue
: Main canvasFormBuilderComponents.vue
: Component libraryFormBuilderConfiguration.vue
: Property editorComponentPreview.vue
: Form preview
- Located in
State Management
State is managed with Pinia stores:
-
Process Builder Store (
/stores/processBuilder.js
)- Manages process definitions
- Handles node and edge operations
- Manages process saving and loading
-
Variable Store (
/stores/variableStore.js
)- Manages process variables
- Handles variable scopes (global, process, task)
-
Form Builder Store (
/stores/formBuilder.js
)- Manages form definitions
- Handles component operations
- Manages form saving and loading
Routing and Pages
The application uses Nuxt's file-based routing:
/pages/process-builder/index.vue
: Process Builder UI/pages/process-builder/manage.vue
: Process management/pages/form-builder/index.vue
: Form Builder UI/pages/form-builder/manage.vue
: Form management
Backend Architecture
The backend is powered by Nitro.js (part of Nuxt 3) and uses Prisma as the ORM.
API Endpoints
API routes are defined in the /server/api/
directory:
-
Form Endpoints
/api/forms
: CRUD operations for forms/api/forms/[id]
: Operations on a specific form
-
Process Endpoints
/api/processes
: CRUD operations for processes/api/processes/[id]
: Operations on a specific process/api/processes/[id]/execute
: Process execution
-
User and Authentication Endpoints
/api/auth
: Authentication endpoints/api/users
: User management
Middleware
Middleware is defined in /server/middleware/
and /middleware/
:
- Authentication middleware
- Audit logging middleware
- Error handling middleware
Database Architecture
The database schema is defined in Prisma schema (/prisma/schema.prisma
) and includes the following models:
-
User and Role Models
user
: User informationrole
: Role definitionsuserrole
: User-role associations
-
Form Model
- Stores form definitions
- Components stored as JSON
- Associated with creators
-
Process Model
- Stores process definitions
- Process nodes and edges stored as JSON
- Associated with creators
-
Task Model
- Stores task instances
- Linked to processes and forms
- Tracks task status and assignees
-
Audit Model
- Logs system actions
- Tracks changes to entities
- Associated with users
Data Flow
Form Builder Flow
- User designs a form in the Form Builder
- Form components and properties are stored in the Form Builder store
- When saved, the form definition is sent to the server via API
- The server stores the form in the database
- The form becomes available for use in processes
Process Builder Flow
- User designs a process in the Process Builder
- Process nodes, edges, and properties are stored in the Process Builder store
- When saved, the process definition is sent to the server via API
- The server stores the process in the database
- The process becomes available for execution
Process Execution Flow
- A process is started through the API
- The server creates a process instance
- As the process executes, it creates tasks
- Users are assigned tasks based on the process definition
- When form tasks are encountered, users fill out forms
- Form data is stored in process variables
- Decision Points determine the next path
- The process continues until completion
Security Architecture
-
Authentication
- Username/password authentication
- JWT tokens for session management
- Token refresh mechanism
-
Authorization
- Role-based access control
- Permission checks at API endpoints
- UI-level permission handling
-
Data Security
- Password hashing
- Input validation and sanitization
- Database query parameterization
Deployment Architecture
The application is designed to be deployed in various environments:
-
Development
- Local development server
- Hot module replacement
- Development database
-
Production
- Server-side rendering
- Static asset optimization
- Database connection pooling
- PM2 process management
Integration Points
The system offers several integration points:
-
API Endpoints
- RESTful API for external system integration
- Webhook support for notifications
-
Database
- Direct database access for reporting
- Database triggers for advanced integrations
-
Authentication
- Potential for SSO integration
- External identity provider support
Performance Considerations
-
Frontend Optimization
- Component lazy loading
- State management optimization
- UI rendering performance
-
Backend Optimization
- Database query optimization
- API response caching
- Server-side rendering
-
Database Optimization
- Indexing strategy
- Query optimization
- Connection pooling
Future Architecture Considerations
-
Microservices
- Potential split into microservices for better scaling
- Separate services for forms, processes, and user management
-
Real-time Features
- WebSocket integration for real-time updates
- Notification system
-
Scalability
- Horizontal scaling for API servers
- Database sharding and replication
- Caching layer