Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit bcdb1b1

Browse files
Demo e2e annotations (#9)
* feat: enhance demo with signature functionality and API integration - Added a custom signature component using `signature_pad` for drawing signatures. - Updated the demo to include document field definitions and improved event logging. - Integrated API calls for document annotation and signing, utilizing the provided API key. - Enhanced the Vite configuration for better development experience and added a README for setup instructions. - Included new dependencies in `package.json` and updated the lock file accordingly. * fix: fixed payload * feat: added proxy-server for the demo and basic workflow to test deployment - Changed the proxy target in Vite config to point to localhost for local testing. - Removed the custom signature component and replaced it with a simpler implementation. - Introduced a helper function to download response blobs as files. - Refactored API calls in the App component to streamline document signing and downloading processes. * test: temporary changing existing workflow for testing * fix: used wrong workflow * fix: replaced key var with secret * fix: added cors, fixed ci/cd process * fix: fixed linter config for server * fix: fixed workflows for github * fix: fixed linter for node server * chore: cleaning * chore: server using pnpm instead of npm * docs: update README with demo integration details and setup instructions * feat: add demo user and IP address handling in server and update signer information
1 parent 44fbcc5 commit bcdb1b1

17 files changed

Lines changed: 1461 additions & 105 deletions
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Deploy Proxy Server
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
PROJECT_ID: ${{ vars.GCP_PROJECT_ID }}
8+
REGION: ${{ vars.GCP_REGION }}
9+
SERVICE_NAME: ${{ vars.GCP_SERVICE_NAME }}
10+
SUPERDOC_SERVICES_API_KEY: ${{ secrets.SUPERDOC_SERVICES_API_KEY }}
11+
SUPERDOC_SERVICES_BASE_URL: ${{ vars.SUPERDOC_SERVICES_BASE_URL }}
12+
13+
jobs:
14+
deploy:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
id-token: write
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v5
23+
24+
- name: Auth to Google Cloud
25+
uses: google-github-actions/auth@v2
26+
with:
27+
credentials_json: ${{ secrets.GCP_SA_KEY }}
28+
29+
- name: Setup gcloud
30+
uses: google-github-actions/setup-gcloud@v2
31+
with:
32+
project_id: ${{ env.PROJECT_ID }}
33+
34+
- name: Build and push container with Cloud Build
35+
run: |
36+
REGION="${REGION:-us-central1}"
37+
SERVICE_NAME="${SERVICE_NAME:-esign-demo-proxy-server}"
38+
IMAGE="gcr.io/${PROJECT_ID}/${SERVICE_NAME}:${GITHUB_SHA}"
39+
40+
echo "REGION=${REGION}" >> $GITHUB_ENV
41+
echo "SERVICE_NAME=${SERVICE_NAME}" >> $GITHUB_ENV
42+
echo "IMAGE=${IMAGE}" >> $GITHUB_ENV
43+
44+
gcloud builds submit demo/server --tag "${IMAGE}"
45+
env:
46+
PROJECT_ID: ${{ env.PROJECT_ID }}
47+
REGION: ${{ env.REGION }}
48+
SERVICE_NAME: ${{ env.SERVICE_NAME }}
49+
50+
- name: Deploy container to Cloud Run
51+
run: |
52+
REGION="${REGION:-us-central1}"
53+
SERVICE_NAME="${SERVICE_NAME:-esign-demo-proxy-server}"
54+
IMAGE="${IMAGE}"
55+
SUPERDOC_SERVICES_BASE_URL="${SUPERDOC_SERVICES_BASE_URL:-https://api.superdoc.dev}"
56+
57+
gcloud run deploy "${SERVICE_NAME}" \
58+
--image "${IMAGE}" \
59+
--region "${REGION}" \
60+
--memory=1Gi \
61+
--cpu=1 \
62+
--allow-unauthenticated \
63+
--set-env-vars SUPERDOC_SERVICES_BASE_URL="${SUPERDOC_SERVICES_BASE_URL}" \
64+
--set-secrets="SUPERDOC_SERVICES_API_KEY=esign-demo-sd-services-api-key:latest"
65+
env:
66+
IMAGE: ${{ env.IMAGE }}
67+
REGION: ${{ env.REGION }}
68+
SERVICE_NAME: ${{ env.SERVICE_NAME }}
69+
SUPERDOC_SERVICES_API_KEY: ${{ env.SUPERDOC_SERVICES_API_KEY }}
70+
SUPERDOC_SERVICES_BASE_URL: ${{ env.SUPERDOC_SERVICES_BASE_URL }}

demo/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Demo
2+
3+
This demo shows how to integrate `@superdoc-dev/esign` into a React application. The frontend sends signing and download requests to a proxy server, which securely communicates with the SuperDoc Services API.
4+
5+
## Prerequisites
6+
7+
You'll need a SuperDoc Services API key. [Get your API key here](https://docs.superdoc.dev/api-reference/authentication/register).
8+
9+
## Setup
10+
11+
1. Build the main package (from repo root):
12+
```bash
13+
pnpm build
14+
```
15+
16+
2. Install dependencies:
17+
```bash
18+
cd demo
19+
pnpm install
20+
cd server
21+
pnpm install
22+
```
23+
24+
3. Create `.env` file in `demo/server/`:
25+
```
26+
SUPERDOC_SERVICES_API_KEY=your_key_here
27+
```
28+
29+
4. Update `demo/vite.config.ts` to proxy to localhost:
30+
```ts
31+
proxy: {
32+
'/v1': {
33+
target: 'http://localhost:3001',
34+
changeOrigin: true,
35+
},
36+
},
37+
```
38+
39+
## Running
40+
41+
Start the proxy server:
42+
```bash
43+
cd demo/server
44+
pnpm start
45+
```
46+
47+
In a separate terminal, start the frontend:
48+
```bash
49+
cd demo
50+
pnpm dev
51+
```

demo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@superdoc-dev/esign": "link:../.",
1212
"react": "^18.3.1",
1313
"react-dom": "^18.3.1",
14+
"signature_pad": "^5.1.1",
1415
"superdoc": "^0.35.3"
1516
},
1617
"devDependencies": {

demo/pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/server/.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
npm-debug.log
3+
.env
4+
.env.*
5+
Dockerfile
6+
.dockerignore

demo/server/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PORT=3003
2+
SUPERDOC_SERVICES_API_KEY=replace-with-your-superdoc-api-key
3+
SUPERDOC_SERVICES_BASE_URL=https://api.superdoc.dev

demo/server/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM node:20-alpine
2+
3+
WORKDIR /app
4+
5+
COPY package.json ./
6+
RUN corepack enable && pnpm install --prod --no-lockfile
7+
8+
COPY . .
9+
10+
# Cloud Run/Functions set PORT; default to 8080
11+
ENV PORT=8080
12+
13+
CMD ["pnpm", "start"]

demo/server/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "esign-proxy-server",
3+
"private": true,
4+
"type": "module",
5+
"main": "server.js",
6+
"scripts": {
7+
"start": "node server.js",
8+
"dev": "node server.js"
9+
},
10+
"dependencies": {
11+
"cors": "^2.8.5",
12+
"dotenv": "^16.4.5",
13+
"express": "^4.19.2"
14+
}
15+
}

0 commit comments

Comments
 (0)