LicenseChain Architecture
LicenseChain uses a unified architecture where all components share the same database and API, ensuring data consistency across the entire ecosystem.
🏗️ System Architecture
┌─────────────────────────────────────────────────────────────┐
│ LicenseChain Ecosystem │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────┼─────────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Website │ │ Dashboard │ │ API │
│ (Marketing) │ │ (Admin UI) │ │ (Backend) │
│ │ │ │ │ │
│ - Blog │ │ - Admin UI │ │ - REST API │
│ - Help │ │ - Analytics │ │ - Auth │
│ - Careers │ │ - Management │ │ - Validation │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
└─────────────────────┼─────────────────────┘
│
│
│
▼
┌────────────────┐
│ PostgreSQL │
│ │
│ - Users │
│ - Licenses │
│ - Apps │
│ - Products │
│ - Webhooks │
│ - Analytics │
└────────────────┘
▲
│
┌─────────────────────┼─────────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌────────────────┐ ┌──────────────┐
│ 27+ SDKs │ │ Integrations │ │ Webhooks │
│ (All Langs) │ │ (Stripe, etc) │ │ (Events) │
│ │ │ │ │ │
│ - NodeJS │ │ - Stripe │ │ - Events │
│ - Python │ │ - Resend │ │ - Callbacks │
│ - Go │ │ - Cloudflare │ │ - Logs │
│ - Rust │ │ │ │ │
│ - ... │ │ │ │ │
└──────────────┘ └────────────────┘ └──────────────┘ 🗄️ Database Architecture
Shared Database
All three main components (API, Dashboard, Website) connect to the same PostgreSQL database:
- Single Source of Truth: One database for all data
- Unified Schema: All components use identical Prisma schema
- Data Consistency: Changes are immediately visible across all apps
- Coordinated Migrations: Schema changes must be synchronized
Schema Structure
Shared Models (All Repos)
User- Central user model with authenticationLicense- License keys and management
Dashboard Models
Account- NextAuth OAuth accountsSession- NextAuth sessionsApp- Dashboard applicationsApiUsageLog- API usage tracking
API Models
Product- API products for saleWebhook- Webhook configurationsWebhookLog- Webhook delivery logs
Website Models
BlogPost- Blog contentHelpArticle- Help center articlesCareerPosition- Job postingsFAQ- Frequently asked questions
🔗 API Architecture
RESTful API
The LicenseChain API is a RESTful service built with Fastify:
- Base URL:
https://api.licensechain.app - Version: All endpoints prefixed with
/v1 - Authentication: JWT tokens or API keys
- Format: JSON request/response
- Rate Limiting: Built-in rate limiting
- CORS: Configured for cross-origin requests
SDK Connection
All SDKs connect to the API:
SDK → https://api.licensechain.app/v1 → API → Database
Example:
SDK calls: client.licenses.verify('KEY')
SDK sends: POST /v1/licenses/verify
API processes: Validates against database
API returns: License status 🔄 Data Flow
License Creation Flow
1. User creates license via Dashboard
↓
2. Dashboard calls API: POST /v1/licenses
↓
3. API validates request and creates license in database
↓
4. License available to:
- Dashboard (via API or direct DB access)
- SDKs (via API)
- Website (via API, if public) License Validation Flow
1. SDK calls: POST /v1/licenses/verify
↓
2. API validates license key against database
↓
3. API checks:
- License exists
- License is active
- License not expired
- Hardware ID matches (if required)
↓
4. API returns license status and details 🔐 Authentication Flow
SDK → API
- SDK makes request to
/v1/auth/login - API validates credentials against database
- API returns JWT token
- SDK includes token in
Authorization: Bearer <token>header - API validates token on subsequent requests
Dashboard → Database
- User logs in via NextAuth
- NextAuth creates session in database
- Dashboard reads user data from database
- Dashboard can also call API endpoints
📊 Deployment Architecture
Production
- Hosting: DigitalOcean App Platform
- CDN: Cloudflare
- Database: PostgreSQL (Managed)
- Email: Resend.com
- Payments: Stripe
CI/CD
- Version Control: GitHub
- CI/CD: GitHub Actions
- Deployment: Automatic on push
- Testing: Automated tests in CI
🛠️ Technology Stack
Backend
- Fastify (Node.js)
- TypeScript
- Prisma ORM
- PostgreSQL
- JWT Authentication
Frontend
- Next.js
- React
- TypeScript
- Tailwind CSS
- NextAuth.js
Infrastructure
- DigitalOcean
- Cloudflare
- GitHub Actions
- Docker
- Vercel (Docs)
⚠️ Important Notes
- All SDKs automatically prepend
/v1to API endpoints - API endpoints are versioned for backward compatibility