Docs
Platform Architecture Overview

Platform Architecture Overview

Understand Postion's multi-tenant architecture, routing system, and core technical infrastructure. A technical deep-dive for developers and advanced users.

Technical Foundation

Postion is built on a modern, high-performance technology stack designed for scalability, security, and developer experience. This document provides an overview of our platform architecture.

This document is intended for developers, technical users, and those curious about how Postion works under the hood.

Core Technology Stack

Our platform leverages industry-leading technologies:

LayerTechnologyPurpose
FrameworkNext.js 14Full-stack React framework with App Router
LanguageTypeScriptType-safe development
DatabasePostgreSQL + PrismaRelational data with type-safe ORM
PaymentsStripeSubscriptions & one-time payments
StorageCloudflare R2Media file storage
EmailResend + StalwartTransactional & marketing emails
AIOpenAI-compatible relayAI-powered writing assistance

Multi-Tenant Architecture

Postion uses a multi-tenant architecture where each user can create multiple independent sites (publications). This is the foundation of our "User → Site → Content" hierarchy.

How It Works

┌─────────────────────────────────────────────────────┐
│                    User Account                      │
│  (Billing, Profile, Global Settings)                │
├─────────────────────────────────────────────────────┤
│                                                      │
│   ┌─────────────┐  ┌─────────────┐  ┌─────────────┐ │
│   │   Site A    │  │   Site B    │  │   Site C    │ │
│   │ (Tech Blog) │  │ (Portfolio) │  │ (Newsletter)│ │
│   ├─────────────┤  ├─────────────┤  ├─────────────┤ │
│   │ • Posts     │  │ • Posts     │  │ • Posts     │ │
│   │ • Tags      │  │ • Tags      │  │ • Tags      │ │
│   │ • Templates │  │ • Templates │  │ • Templates │ │
│   │ • Subs      │  │ • Subs      │  │ • Subs      │ │
│   └─────────────┘  └─────────────┘  └─────────────┘ │
│                                                      │
└─────────────────────────────────────────────────────┘

Key Characteristics

🌐 Independent Domains

Each site can have its own subdomain (blog.postions.app) or custom domain (yourblog.com).

👥 Separate Subscribers

Subscriber lists are isolated per site. A user subscribing to Site A is not automatically subscribed to Site B.

💳 Unified Billing

While sites are separate, billing and payout settings are managed at the user account level.

🎨 Unique Branding

Each site has its own templates, colors, fonts, and appearance settings.

Routing Architecture

Our middleware-based routing system intelligently handles requests based on the hostname.

Request Flow

flowchart TD
    A[Incoming Request] --> B{Check Hostname}
    B -->|postion.app| C[Main Platform Routes]
    B -->|Other Domain| D[Tenant Site Routes]
    
    C --> E{Path Check}
    E -->|/dashboard, /login, /site, /post| F[Authenticated Routes]
    E -->|/sso-bridge| G[SSO Handling]
    E -->|Other| H[Rewrite to /home/*]
    
    D --> I[Rewrite to /domain/*]
    I --> J[Render Tenant Site]

Route Categories

CategoryPathsDescription
Authenticated/dashboard, /site/*, /post/*Require user login
SSO/sso-bridgeSingle sign-on handling
Public Platform/home/*, /blog, /pricingMarketing & public pages
Tenant Sites*.postions.app, custom domainsUser-created publications

Content Security

We take content protection seriously. Postion includes built-in anti-piracy features to protect your paid content.

Security Features

Watermarking: A watermark overlay shows the site name and the logged-in viewer's name.

Copy Protection: Optional copy/paste and right-click protection for sensitive content.

Note: Content security features are available on the Pro plan. They are enabled site-wide in your site's general settings.

Database Architecture

Our database is designed around 42+ models organized into logical domains:

Core Domains

DomainKey ModelsPurpose
User SystemUser, Account, Session, UserProfileAuthentication & profiles
Site SystemSite, Template, TemplatePricingMulti-tenant publications
ContentPost, Tag, PostPricingContent management
SubscriptionsPlan, Subscription, TransactionMonetization
EmailSubscribe, EmailCampaign, EmailSendNewsletter campaigns
CRMFanRelationship, FanTag, FanSegmentFan management
APIApiKey, ApiUsage, WebhookDeveloper platform

Data Relationships

erDiagram
    USER ||--o{ SITE : owns
    SITE ||--o{ POST : contains
    SITE ||--o{ PLAN : offers
    PLAN ||--o{ SUBSCRIPTION : has
    SUBSCRIPTION ||--o{ TRANSACTION : generates
    POST ||--o| POST_PRICING : has
    POST ||--o{ POST_PURCHASE : has
    USER ||--o| SETTLEMENT_ACCOUNT : has

Stripe Integration

Payment processing is handled entirely through Stripe, using two key features:

Stripe Subscriptions

For recurring revenue from your subscribers:

  • Monthly and annual billing cycles
  • Automatic payment retry
  • Subscription management portal

Creator Payouts

Payments are collected by Postion and recorded in each creator's balance:

  • Platform fee by plan (Free 5%, Launch 2%, Pro 0%), with card processing passed through at cost
  • Withdrawals to a bank account, PayPal or a USDT wallet once the balance reaches $100
  • Every ledger entry shows its platform and processing fees

Learn more in Payouts & Fees.

Storage Infrastructure

Media files are stored using cloud object storage:

  • Primary: Cloudflare R2 for reliable, scalable storage
  • CDN: Global content delivery for fast load times
  • Formats: Support for images, videos, documents, and more

Storage is subject to fair use. Check our Storage Quotas documentation for details.

Performance & Scalability

Postion is built for performance at scale:

⚡ Edge Caching

Public pages are cached at the CDN edge for minimal latency worldwide.

📦 Smart Caching

Intelligent caching of static content and API responses.

🔄 Incremental Rendering

Public sites use incremental static regeneration to stay fresh and fast.

Need More Technical Details?