Welcome to the MyGovernment sample app! MyGovernment is written using Node.js (server) and React (client), and shows a possible integration by a government agency with Docusign eSignature.
You can find a live instance running at https://mygovernment.sampleapps.docusign.com/.
MyGovernment demonstrates the following:
- Authentication with Docusign via JSON Web Token (JWT) Grant.
- Apply for a small business loan: The user can apply for a government-backed small business loan through an embedded signing session. Then, depending on how much their loan amount is, the user will receive an email addressed to a government employee named either "Sage Small Lender" or "Blaire Big Lender" to approve the loan application. Features in this use case:
- Branding
- Conditional recipients
- Document visibility
- Embedded signing
- Receive a traffic ticket: The user receives a simlulated traffic ticket in an embedded signing session and chooses what they would like to do with the ticket. They can pay the fine, request a mitigation hearing, or request a contested hearing. If the user chooses to request either a mitigation hearing or a contested hearing, then the user will receive an email addressed to a court clerk named either "Millie Mitigation" or "Cody Contested." The court clerk/second recipient of the envelope is a Certified Delivery recipient, which means the user only has to view the envelope in order to complete it. Features in this use case:
- Certified Delivery recipients
- Conditional recipients
- Embedded signing
- Payment
- Apply for a passport: The user receives an email with a passport application, but they must first verify their identity using IDV before filling out the application. They can then pay the associated fees. Features in this use case:
- IDV (Identity Verification)
- Payment
- Remote signing
- Signer attachment tab
Before you can run this sample app on your local machine, you must first create a new integration with a Docusign developer account.
- If you don't already have one, create a free developer account.
- Log into your developer account, and navigate to My Apps & Keys.
- Select Add App and Integration Key.
- Create a new integration that is configured to use JSON Web Token (JWT) Grant.
You will need the integration key itself and its RSA key pair. To use this application, you must add your application's Redirect URI to your integration key. See our video, Creating an Integration Key for JWT Authentication for a demonstration of how to create an integration key (client ID) for a user application like this example.
- Save the integration key and private RSA key pair somewhere safe as you will need these later.
- Add the following as redirect URIs for your app:
- A free Docusign developer account.
- Integration key and corresponding RSA key pair from the integration you created above.
- Node.js v14+
The following must be enabled on your developer account in order to run all of the examples:
- Payment: You must have a Payment gateway set up, see the Payments section below for further instructions.
- SMS delivery: Follow the instructions in the Docusign eSignature Admin Guide under the Fields and Properties section. Make sure "Allow SMS delivery to recipients" is checked.
- Conditional routing: Follow the instructions in the Introduction to Conditional Routing under the Getting started with conditional routing section. Make sure "Enable conditional routing" is checked.
- CertifiedDelivery recipients: Follow the instructions on this Docusign eSignature Admin Guide under the Recipient Roles section. Make sure "Enable needs to view role" is checked.
- Document visibility: Follow the instructions on this Docusign eSignature Admin Guide under the Fields and Properties section. Set your settings to "Must sign to view, unless sender," and make sure "Allow sender to specify document visibility" is checked.
- IDV: Follow the instructions in the Docusign Identify - ID Verification Q&A to enable IDV on your account.
- Download or clone this repository to your workstation in a new folder named sample-app-mygovernment-nodejs.
- Navigate to that folder:
cd sample-app-mygovernment-nodejs
- Navigate to the client folder:
cd client
- Install dependencies using the npm package manager:
npm install
- Navigate to the server folder:
cd ../server
- Install dependencies:
npm install
- Rename the .env_example file in the root directory to .env, and update the file with the integration key and other settings.
Note: Protect your integration key and client secret. You should make sure that the .env file will not be stored in your source code repository.
- Rename the example_private.key file to private.key, and paste your complete private RSA key into this file (including the header and footer of the key).
The traffic ticket and passport application use cases require a payment gateway to be active on your developer account. For these examples, the Stripe gateway service is used. Follow the instructions below to set up payments on your account.
- Select the Stripe button on the Payments page in your developer account.
- For development, you can skip the Stripe account application by using the Skip this account form link at the top of the page. An enabled Stripe payment gateway is now associated with your Docusign developer account and is shown under Payment Gateway.
- Save the Gateway Account ID GUID to your .env file and update the other relevant settings under Payment configuration.
- Navigate to the application folder:
cd sample-app-mygovernment-nodejs
- Navigate to the server folder:
cd server
- To start the server and client at the same time:
npm run dev
- Or, to run the server and client separately:
- In one terminal, navigate to the server folder (
cd server
) and runnpm run server
- In a separate terminal, navigate to the client folder (
cd client
) and runnpm start
- In one terminal, navigate to the server folder (
- Open a browser to http://localhost:3000
This repository uses the MIT License. See the LICENSE file for more information.