How docusign/sample-app-workflows-node works
Project Type and Purpose
• This is a full-stack sample application built with React (client) and Node.js/Express (server) that demonstrates how to integrate with the DocuSign Maestro API. It provides a web UI for users to authenticate (JWT & ACG flows), list available workflows, trigger them, and view results.
High-Level Architecture Components
a. Frontend (React/Vite)
• Runs in the browser (or as a Dockerized static site behind NGINX in production).
• Implements pages (Hero, TriggerWorkflow, TriggerWorkflowForm), UI components (login form, workflow list/description/forms, popups), a Redux store (actions/reducers) and API client layer (client/src/api/index.js).
b. Backend (Node.js/Express)
• Exposes REST endpoints under /auth and /workflows.
• Uses controllers (server/controllers/*) to handle incoming requests, middlewares for JWT/ACG auth, services (server/services/workflowsService.js) to encapsulate business logic, and utils for logging and generic helpers.
• Reads configuration & secrets from .env and RSA private key, and templates/workflows from server/assets.
c. Infrastructure
• NGINX (infra/nginx) as a reverse proxy/SSL terminator and static file server for production.
• Docker Compose (docker-compose.local.yaml) orchestrates three containers: NGINX, Client, Server.
• Environment (local vs. Docker) controlled by .env and compose overrides.
d. External Services
• DocuSign OAuth & Maestro APIs for authentication and workflow execution.
Relationships and Data Flows
1. User (browser) ↔ HTTP(S) ↔ NGINX
• In prod, NGINX serves the React app and proxies API calls to the Express server.
2. React App → Express API
• Login requests (/auth) → server issues JWT or performs ACG.
• Workflow list/trigger requests (/workflows) → server orchestrates DocuSign Maestro calls.
3. Express Server → DocuSign API
• Uses RSA key to obtain access tokens (JWT grant).
• Calls Maestro endpoints to list/trigger workflows and returns results to client.
Architectural Patterns and Principles
• Separation of concerns: UI vs. API vs. infra.
• Layered backend: routes → controllers → services → utilities.
• Stateful Redux store on client to manage auth status and workflow data.
• Environment-driven configuration for local vs. Docker vs. prod.
Technologies & Frameworks to Annotate
• Frontend: React, Vite, Redux (store/actions/reducers), Axios/fetch (api client).
• Backend: Node.js, Express, jsonwebtoken, middleware pattern, template assets.
• Infra: Docker, Docker Compose, NGINX.