A complete electronic signature platform with blockchain payments, document management, and real-time collaboration.
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
npm install -g pnpm@9)# 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:
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=...
# 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
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
For the backend API, you have several options:
Option 1: GitHub Actions + SSH (Recommended)
Set up GitHub secrets for auto-deployment:
SERVER_HOST, SERVER_USER, SERVER_SSH_KEY.github/workflows/deploy.ymlOption 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
βββββββββββββββββββββββββββββββββββββββββββ
β 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) β
βββββββββββββββββββββββββββββββββββββββββββ
POST /api/auth/register - Register new userPOST /api/auth/login - Login userPOST /api/auth/logout - Logout userGET /api/auth/session - Get current sessionGET /api/documents - List user documentsPOST /api/documents/upload - Upload documentGET /api/documents/:id - Get document detailsGET /api/documents/download?key=... - Download documentDELETE /api/documents/:id - Delete documentPOST /api/payments/initiate - Start paymentPOST /api/payments/confirm - Confirm paymentPOST /api/signatures/sign - Sign documentGET /api/signatures/:id - Get signature detailsGET /api/health - Health check (for monitoring)Key tables:
User - User accounts with authenticationTeam - Team management & collaborationDocument - Document metadata & storageSignature - Digital signatures with verificationPayment - X402 blockchain payment recordsSession - NextAuth session trackingAuditLog - Security audit trailSee packages/db/prisma/schema.prisma for full schema.
# Build the entire project (validates all types)
pnpm build
# This will catch TypeScript errors across all packages
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?
Base Sepolia, RPC URL https://sepolia.base.org, Chain ID 84532git checkout -b feature/your-featuregit commit -m "feat: description"git push origin feature/your-featureMIT License
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
[!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:
1505d92cdf88e984e83b328725c6ed2f01606301