Docs
Technical Architecture & Stack
Technical Architecture & Stack
A look under the hood at Postion. Explore our system architecture, modern tech stack, and the core design principles that ensure speed, scale, and security.
1. System Architecture Diagram
Core Flow:
- A user accesses a site (
[username].postions.appor a custom domain) via the Next.js frontend. - The Cloudflare Edge Network processes the request, providing global CDN acceleration.
- API requests are sent to the backend services via Next.js API Routes.
- The backend service interacts with the PostgreSQL database using Prisma ORM to fetch content data.
- The payment process is handled by the Stripe API, and subscription statuses are synced via Webhooks.
- AI-related features (e.g., writing assistant, SEO metadata generation) are implemented through an OpenAI-compatible API relay.
- Newsletter features are implemented on a Stalwart mail server over JMAP.
2. Technology Stack
- Frontend: Next.js 14 (React), Tailwind CSS, BuouUI
- Backend: Next.js API Routes, TypeScript
- Database: PostgreSQL
- ORM: Prisma
- Payments: Stripe
- Domain: Cloudflare
- AI Services: OpenAI-compatible API relay, Vercel AI SDK
- Deployment/Hosting: Single container, deployed with Dokploy
- Authentication: NextAuth.js
- Content Delivery: Cloudflare Edge Network (CDN)
[Info] Rationale: We chose a full-stack TypeScript solution centered on Cloudflare and Next.js to achieve maximum development efficiency, and outstanding performance (especially for SEO)βa perfect fit for a content platform's needs.
3. Core Data Schema
User: Stores user information and authentication details.Site: Stores configurations for each creator's site (subdomain, custom domain, template, branding, etc.). AUsercan own multipleSites.Post: Stores article content, metadata, and publication status. Linked to aSite.Subscription: Stores user subscription relationships, linked to a StripeSubscription.Webhook: Stores the developer webhook endpoints that creators configure.
4. Key Design Principles
- Multi-tenancy: Content and configurations for different creators are isolated at the database level using a
siteId. - Performance First: We utilize Incremental Static Regeneration (ISR) and CDN caching to ensure content pages load in milliseconds.
- Security & Reliability: All payment information is handled by Stripe; we do not store sensitive payment data. We leverage platform-native security features (like Cloudflare's firewall) to prevent common attacks.
- Scalability: CDN and application caching absorb most traffic to public pages.