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:
| Layer | Technology | Purpose |
|---|---|---|
| Framework | Next.js 14 | Full-stack React framework with App Router |
| Language | TypeScript | Type-safe development |
| Database | PostgreSQL + Prisma | Relational data with type-safe ORM |
| Payments | Stripe | Subscriptions & one-time payments |
| Storage | Cloudflare R2 | Media file storage |
| Resend + Stalwart | Transactional & marketing emails | |
| AI | OpenAI-compatible relay | AI-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
| Category | Paths | Description |
|---|---|---|
| Authenticated | /dashboard, /site/*, /post/* | Require user login |
| SSO | /sso-bridge | Single sign-on handling |
| Public Platform | /home/*, /blog, /pricing | Marketing & public pages |
| Tenant Sites | *.postions.app, custom domains | User-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
| Domain | Key Models | Purpose |
|---|---|---|
| User System | User, Account, Session, UserProfile | Authentication & profiles |
| Site System | Site, Template, TemplatePricing | Multi-tenant publications |
| Content | Post, Tag, PostPricing | Content management |
| Subscriptions | Plan, Subscription, Transaction | Monetization |
Subscribe, EmailCampaign, EmailSend | Newsletter campaigns | |
| CRM | FanRelationship, FanTag, FanSegment | Fan management |
| API | ApiKey, ApiUsage, Webhook | Developer 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 : hasStripe 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?
- Public API Documentation: Build integrations with our REST API
- Webhooks Guide: Receive real-time event notifications
- Custom Domains: Connect your own domain