DocuSign

eSign Platform πŸ“

A complete electronic signature platform with blockchain payments, document management, and real-time collaboration.

Features ✨

Tech Stack πŸ› οΈ

Frontend

Backend

Infrastructure

Project Structure πŸ“

esign-platform/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ api/               # Express backend (port 4000)
β”‚   β”œβ”€β”€ web/               # Next.js frontend (port 3000)
β”‚   └── docs/              # Documentation site
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ db/                # Prisma schema & migrations
β”‚   β”œβ”€β”€ crypto/            # RSA & AES cryptography utilities
β”‚   β”œβ”€β”€ payments/          # X402 payment logic
β”‚   β”œβ”€β”€ utils/             # Shared utilities (logger, Redis)
β”‚   β”œβ”€β”€ auth/              # Authentication helpers
β”‚   β”œβ”€β”€ types/             # Shared TypeScript types
β”‚   β”œβ”€β”€ ui/                # React component library
β”‚   └── typescript-config/ # Shared tsconfig
β”œβ”€β”€ pnpm-workspace.yaml    # Workspace configuration
β”œβ”€β”€ turbo.json             # Turbo build config
└── fly.toml               # Fly.io deployment config

Getting Started πŸš€

Prerequisites

Local Development

# 1. Clone repository
git clone https://github.com/Pixeeee/DocuSign.git
cd esign-platform

# 2. Install dependencies
pnpm install

# 3. Set up environment variables
cp .env.example .env.local
# Edit .env.local with your values (JWT keys, Database URL, etc.)

# 4. Initialize database
pnpm --filter @esign/db migrate deploy

# 5. Start development server
pnpm dev

Access:

Environment Variables

See .env.example for complete list:

# Database
DATABASE_URL=postgresql://user:password@localhost:5432/esign

# JWT (Generate with: openssl rand -base64 32)
JWT_PRIVATE_KEY=...
JWT_PUBLIC_KEY=...

# NextAuth
NEXTAUTH_SECRET=...
NEXTAUTH_URL=http://localhost:3000

# X402 Payments
CHAIN_ID=84532  # Base Sepolia
PAYMENT_AMOUNT=0.0001  # ETH per signature

# AWS S3 (optional, for production)
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
AWS_REGION=us-east-1
AWS_BUCKET_NAME=...

Scripts πŸ“š

# Development
pnpm dev              # Start all dev servers
pnpm build            # Build all packages & apps
pnpm turbo build      # Build with Turbo (faster)

# Database
pnpm db:migrate       # Run Prisma migrations
pnpm db:generate      # Generate Prisma types
pnpm db:studio        # Open Prisma Studio UI

# Linting & Type Checking
pnpm lint             # Run ESLint
pnpm type-check       # Run TypeScript checks

# Deployment
pnpm turbo build      # Build for production

Deployment 🌐

GitHub Pages (Frontend)

Frontend automatically deploys to GitHub Pages on every push to main:

# Push to main branch
git push origin main

# GitHub Actions automatically:
# 1. Builds the Next.js frontend
# 2. Deploys to GitHub Pages
# 3. Available at: https://Pixeeee.github.io/DocuSign

Workflow details: .github/workflows/github-pages.yml

Backend Deployment

For the backend API, you have several options:

Option 1: GitHub Actions + SSH (Recommended)

Set up GitHub secrets for auto-deployment:

  1. Go to Settings β†’ Secrets and Variables β†’ Actions
  2. Add secrets: SERVER_HOST, SERVER_USER, SERVER_SSH_KEY
  3. Push to main β†’ Auto-deploys via .github/workflows/deploy.yml

Option 2: Manual Server Deployment

Run on your server:

cd ~/esign-platform
git pull origin main
pnpm install --frozen-lockfile && pnpm turbo build
pm2 restart esign-platform

See workflow: .github/workflows/deploy.yml


Architecture πŸ“

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     GitHub Pages (Frontend)             β”‚
β”‚  https://Pixeeee.github.io/DocuSign     β”‚
β”‚  (Auto-deployed on git push)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚ API calls
             ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Your Server (Backend API)           β”‚
β”‚     http://your-domain.com/api/*        β”‚
β”‚     (Express.js + PostgreSQL)           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

API Endpoints πŸ”Œ

Authentication

Documents

Payments (X402)

Signatures

Health

Database Schema πŸ“Š

Key tables:

See packages/db/prisma/schema.prisma for full schema.

Testing πŸ§ͺ

# Build the entire project (validates all types)
pnpm build

# This will catch TypeScript errors across all packages

Troubleshooting πŸ”§

Port already in use?

# Kill process on port 3000 or 4000
lsof -ti:3000 | xargs kill -9
lsof -ti:4000 | xargs kill -9

Database connection error?

# Check DATABASE_URL in .env.local
# Verify PostgreSQL is running
psql $DATABASE_URL

MetaMask network not detected?

Contributing 🀝

  1. Create feature branch: git checkout -b feature/your-feature
  2. Commit changes: git commit -m "feat: description"
  3. Push to GitHub: git push origin feature/your-feature
  4. Open Pull Request

License πŸ“„

MIT License

Support πŸ’¬

You can develop a specific package by using a filter:

With global turbo installed:

turbo dev --filter=web

Without global turbo:

npx turbo dev --filter=web
yarn exec turbo dev --filter=web
pnpm exec turbo dev --filter=web

Remote Caching

[!TIP] Vercel Remote Cache is free for all plans. Get started today at vercel.com.

Turborepo can use a technique known as Remote Caching to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.

By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don’t have an account you can create one, then enter the following commands:

With global turbo installed (recommended):

cd my-turborepo
turbo login

Without global turbo, use your package manager:

cd my-turborepo
npx turbo login
yarn exec turbo login
pnpm exec turbo login

This will authenticate the Turborepo CLI with your Vercel account.

Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:

With global turbo installed:

turbo link

Without global turbo:

npx turbo link
yarn exec turbo link
pnpm exec turbo link

Learn more about the power of Turborepo: