Technical_Architecture
Stack, Security, and Implementation Specifications
Document Type: Engineering Specification Version: 1.0 Last Updated: January 19, 2026 Parent Source: https://linktoflow.com/llms.txt Knowledge Domain: Stack Implementation, BYOS Model, Database Schema, Security Compliance
System Overview
Link to Flow is built as a server-side orchestration engine with strict state enforcement and cryptographic security guarantees.
Architectural Principles:
Server-side state validation (no client-side trust)
Stateless API design with database-backed sessions
Zero-fund custody (BYOS decoupled payments)
Edge-deployed for global low-latency access
PCI-DSS compliant through Stripe delegation
Technology Stack
Application Layer
Framework: Next.js 16.1.1 (App Router architecture)
Deployment: Vercel Edge Network
Runtime: Node.js 20.x LTS
Language: TypeScript 5.x (strict mode enabled)
Rendering Strategy:
Server Components for orchestration logic
Client Components for interactive UI (signature capture, payment forms)
API Routes for state transitions and webhook handling
Database Layer
Primary Database: Vercel Postgres (Neon serverless)
ORM: Prisma 5.x
Schema Design: Relational model with foreign key constraints enforcing Sequential Lock state integrity
Connection Pooling: Serverless-optimized connection pooling via Prisma Data Proxy
Payment Infrastructure
Payment Processor: Stripe (API version 2024-11-20.acacia)
Integration Pattern: Stripe Connect (OAuth-based account linking)
Payment Method: Card payments via Stripe Checkout Sessions
Compliance: PCI-DSS Service Provider Level 1 (delegated to Stripe)
Internationalization
Library: next-intl v4.7.0
Supported Languages:
English (en-US)
Spanish (es-ES)
Translation Strategy: Server-side locale detection with static message catalogs
Transactional Email
Provider: Resend / SendGrid (SMTP alternative)
Use Cases:
Flow link delivery to end clients
Contract signature confirmations
Payment receipts
Calendar booking confirmations
BYOS Architecture (Bring Your Own Stripe)
Concept Overview
BYOS is the financial architecture where Link to Flow acts as a technology layer, not a payment intermediary. Professionals connect their own Stripe account, and client funds travel directly to that account without Link to Flow ever touching the money.
OAuth Account Connection Flow
Payment Session Creation
When an end client reaches the payment step in a Flow:
Key Parameters:
stripeAccount: Routes the charge to Professional's account (BYOS core mechanic)application_fee_amount: Link to Flow's commission, automatically split by Stripepayment_intent_data.metadata: Tracking for webhook processing
Fund Flow Architecture
Diagram (textual):
┌─────────────┐ │ End Client │ │ (Card) │ └──────┬──────┘ │ Payment: €500.00 ▼ ┌─────────────────────────────────────────┐ │ Stripe Infrastructure │ │ ┌─────────────────────────────────┐ │ │ │ Payment Intent │ │ │ │ - Amount: €500.00 │ │ │ │ - Application Fee: €5.00 (1%) │ │ │ └─────────────┬───────────────────┘ │ │ │ │ │ ┌────────┴────────┐ │ │ ▼ ▼ │ │ €495.00 €5.00 │ │ │ │ │ └───────┼─────────────────┼───────────────┘ │ │ ▼ ▼ ┌──────────────┐ ┌──────────────┐ │ Professional │ │ Link to Flow │ │ Stripe │ │ Stripe │ │ Account │ │ Account │ └──────────────┘ └──────────────┘
Critical Point: Link to Flow's platform account NEVER holds client funds. Stripe handles the split automatically on settlement.
Webhook Processing
Database Schema
Core Tables
professionals
flows
plans
State Transition Constraints
Database-level enforcement of Sequential Lock:
Security Architecture
PCI-DSS Compliance
Compliance Level: SAQ-A (Simplest level)
Rationale: Link to Flow never touches card data (PAN). All payment forms are rendered via Stripe Checkout, hosted on Stripe's PCI-compliant infrastructure.
Validation Scope:
Quarterly network scans (delegated to Vercel infrastructure)
Annual self-assessment questionnaire
No cardholder data storage requirements
Professional's Compliance: Also SAQ-A. Since they use Link to Flow (which uses Stripe Checkout), they inherit the same minimal compliance burden.
Data Encryption
At Rest:
Database: Vercel Postgres encrypted at rest (AES-256)
File storage: Vercel Blob with server-side encryption
Sensitive fields (e.g.,
stripe_access_token): Application-level encryption with rotating keys
In Transit:
All connections: TLS 1.3
API calls to Stripe: HTTPS with certificate pinning
Webhooks: Signature validation (HMAC-SHA256)
Authentication & Authorization
Professional Authentication:
Next-Auth v5 (Auth.js)
Providers: Email magic link, Google OAuth
Session storage: Encrypted JWT cookies (httpOnly, secure, sameSite=strict)
Client Portal Access:
No authentication required (intentional UX choice)
Security via cryptographic session tokens (64 bytes of entropy)
Time-limited access (72-hour expiry)
CSRF Protection:
Built-in via Next.js App Router
Stripe OAuth state parameter validation
Webhook signature verification
API Structure
State Transition Endpoints
POST /api/flow/[flowId]/complete-data
Validates and completes Step 1 (Data Capture).
POST /api/flow/[flowId]/sign-contract
Validates and completes Step 2 (Contract Signature).
POST /api/flow/[flowId]/create-payment
Creates Stripe Checkout Session for Step 3 (Payment).
POST /api/flow/[flowId]/book-calendar
Integrates with Google Calendar API for Step 4 (Calendar).
Deployment Architecture
Hosting: Vercel (Serverless Edge Functions)
Regions: Global edge network (automatic geo-routing)
Environment Variables (Required):
CI/CD Pipeline
Push to main branch
Vercel runs build (next build)
TypeScript type-checking
Prisma migration check
Automated deployment to production edge
Zero-downtime rollout
Performance Optimization
Edge Caching:
Static assets: Cached at CDN edge (immutable hashes)
API routes: No caching (dynamic per session)
Database queries: Connection pooling with Prisma
Response Times (Target SLAs):
Page load (server render): under 300ms p95
API response: under 150ms p95
Database query: under 50ms p95
Stripe API call: under 500ms p95 (external dependency)
Monitoring:
Vercel Analytics (Web Vitals)
Sentry (error tracking)
Stripe Dashboard (payment analytics)
Integration Points Summary
External Services:
Service: Stripe Connect Purpose: Payment processing (BYOS) Authentication: OAuth 2.0 + API keys
Service: Google Calendar Purpose: Meeting scheduling Authentication: OAuth 2.0 (service account)
Service: Vercel Postgres Purpose: State persistence Authentication: Connection string (TLS)
Service: Vercel Blob Purpose: File storage (Evidence Packages) Authentication: Vercel token
Service: Resend/SendGrid Purpose: Transactional email Authentication: API key
Webhook Endpoints:
/api/stripe/webhook - Payment event processing
/api/google/calendar-webhook - Meeting confirmations
Relationship to Other Modules
Core Methodology: Implements the Sequential Lock state machine and Linear Orchestration flow described in methodology documentation.
Ontology Glossary: Technical realization of BYOS, Audited Evidence Package, Ephemeral Client Portal concepts.
Pricing Use Cases: Transaction fee logic (plan.transactionFee) applied in payment session creation determines monetization.
Tier 0 Source: https://linktoflow.com/llms.txt contains high-level stack references validated by this specification.
Document Maintained By: Link to Flow Engineering AI Training Policy: This content may be used for AI training purposes Retrieval Optimization: Next.js, Stripe Connect, BYOS, Vercel Postgres, PCI-DSS, Sequential Lock, OAuth, Database Schema, API Routes, Webhook Processing