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.app
or 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, summary generation) are implemented by calling the OpenAI/Gemini API.
- newsletter features (use mailgun to implemented)
- workflow features (use n8n to implemented)
2. Technology Stack
- Frontend: Next.js 15 (React), Tailwind CSS, BuouUI
- Backend: Next.js API Routes (Serverless Functions), TypeScript
- Database: PostgreSQL
- ORM: Prisma
- Payments: Stripe
- Domain: Cloudflare
- AI Services: OpenAI API (GPT-4/GPT-3.5),Gemini API, Vercel AI SDK
- Deployment/Hosting: Deployment
- Authentication: NextAuth.js
- Content Delivery: Cloudflare Edge Network (CDN)
- Workflow: n8n
[Info] Rationale: We chose a full-stack TypeScript solution centered on Cloudflare and Next.js to achieve maximum development efficiency, outstanding performance (especially for SEO), and seamless serverless scalability—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.). AUser
can own multipleSites
.Post
: Stores article content, metadata, and publication status. Linked to aSite
.Subscription
: Stores user subscription relationships, linked to a StripeSubscription
.WebhookEvent
: Logs webhook events from external services like Stripe to ensure data consistency.
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: The serverless architecture allows for automatic scaling based on traffic, eliminating the need for server management.