Why One App Wasn't Enough
The business started as a single-city beauty studio. As it expanded into an international network, the architecture had to evolve - or become the bottleneck.
Single-App Bottleneck
Everything lived in one repository - booking, content, admin, AI, analytics. Every deployment risked the entire system, and teams stepped on each other's changes.
CRM Wasn't Enough
Altegio handled basic booking but had no support for multi-language content, loyalty programs, payment processing, or marketing attribution. The business was outgrowing its tools.
Multi-Country Complexity
Each new country needed its own domain, local SEO, currency, payment integration, and localized content. The architecture wasn't built for this kind of expansion.
No Data Visibility
There was no way to track a user from their first ad click through to a completed booking and beyond. Marketing spend decisions were based on gut feeling, not attribution data.
Ecosystem Architecture
Multiple services, four databases, one connected system. Click any node to explore how it fits into the bigger picture.
Shared Infrastructure
All services deploy independently on Vercel. They share contracts (Prisma types, API conventions, webhook formats) but have zero shared runtime dependencies. Four PostgreSQL databases isolate workloads: product data, analytics events, AI embeddings (pgvector), and CMS content.
Key Architectural Decisions
Every major design choice had a context, alternatives, and specific reasoning. Here's what I chose and why.
Brain-first AI architecture (not FSM)
The AI agent needs to guide users toward booking, but people ask questions in unpredictable order - price before studio, FAQ mid-booking, changing their mind halfway through.
Implemented a tool-calling LLM architecture where the model dynamically orchestrates tools based on user intent, rather than following rigid conversational trees.
Deterministic FSM with fixed state transitions.
Users don't follow linear flows. A brain-first approach handles multi-intent messages naturally - "Wroclaw, women, laser hair removal" triggers 4 sequential tool calls in one request.
Flexible conversations. The LLM was custom fine-tuned with iterative quality-first approach. Four response patterns (pass-through, merge, speaking, silent) cover every UX scenario.
Independent analytics with its own database
Needed marketing attribution and lifecycle tracking, but product database queries are optimized for transactional workloads, not analytical ones.
Deployed a dedicated PostgreSQL database for analytics, ingesting real-time events via Vercel Analytics Drain and the Admin API.
Google Analytics 4, Mixpanel, or embedded analytics in the admin panel.
GA4 can't do cross-domain session stitching with booking lifecycle data. We needed full control over the attribution model and the ability to sync leads to bookings by phone number.
19 dashboard widgets. Multi-touch attribution with first-touch and non-direct-last-click. Lead lifecycle tracking from first web event to completed booking.
Per-studio Stripe integration
Each studio might operate under a different legal entity in a different country, each with its own currency and banking.
Built a per-studio Stripe integration model where each studio provides its own API keys, allowing fully decentralized payment processing.
Single Stripe account with Connected Accounts.
Different jurisdictions, different currencies, different regulatory requirements. Per-studio keys give complete flexibility without Stripe Connect complexity.
Multi-currency payments (EUR/PLN/GBP/UAH). Full lifecycle tracking (PENDING โ SUCCEEDED โ REFUNDED). Automated email chains triggered by payment state changes.
Cron-driven automation layer
Multiple business processes need scheduled execution: feedback collection, payment cleanup, analytics sync, exchange rate updates, stale lead expiration.
Distributed 15 zero-infrastructure Vercel Cron jobs across three services to handle all scheduled automation without maintaining a separate worker queue.
Event-driven queue (SQS, RabbitMQ).
Vercel Cron is zero-infrastructure - no queue to manage, no workers to scale. Each job is isolated in its own repository. Sufficient for current scale with room to grow.
Automated feedback chains (visit โ treatment), stale lead expiration, daily analytics aggregation, knowledge base sync - all running without any manual intervention.
AI-assisted editorial engine: ~70 articles/week across 5 countries
The business needed 14+ blog articles per week across 5 countries in the beauty and medical niche. Manual writing couldn't scale, and generic AI content risked hallucinations in a domain where medical accuracy matters.
Built an AI-assisted editorial pipeline inside the Admin Panel. Tavily discovers trending topics per country, editors curate and assign them, then GPT-5 generates articles in two stages -structured metadata first, long-form body second -all grounded in actual service and device data from the database. Hero images auto-generated via GPT Image 1.5. Editors review and publish.
Hire copywriters for each country (~5 FTE), or use generic AI tools like Jasper that hallucinate freely in medical domains.
Manual writing can't produce 70+ localized articles per week. Generic AI tools hallucinate -dangerous in medical content. By grounding generation in Tavily research and real service/device data from the database, every article is factually anchored.
Reduced editorial effort from full-time writing to curation and review. 6 content formats, zone-aware rotation to prevent repetition, medical safety filters with circuit breaker, cost tracking per article. Editors control topic selection and publication -AI handles the heavy lifting.
How Data Flows Through the System
Six cross-service flows show how user actions, business events, and data move through the ecosystem - each one connecting multiple repositories into a coherent pipeline.
Acquisition โ Conversion
From first visit to completed booking
User lands on a regional domain (loveepil.pl, .de, .es...) via organic search or paid ads
Tracking pixels fire - GTM, Facebook, TikTok - events flow to Vercel Analytics Drain โ Analytics platform
User browses localized domains, finds a studio via Google Maps, reads blog content from Strapi
Clicks "Book Now" โ handed off to core frontend โ multi-step booking wizard with Payments & profile
Completes payment via Stripe โ webhook โ admin processes โ confirmation email โ feedback cron in 24h
What the Ecosystem Delivers
One developer. Seven services. A connected system serving 18 studios across 5 countries.
Scale
- โ18 studios across 5 countries managed through one ecosystem
- โ30K+ monthly active users across 6 localized domains
- โMulti-currency payments (EUR/PLN/GBP/UAH) via per-studio Stripe
- โNew country launch: config + translations + domain, no core changes
Intelligence
- โAI consultant: 21 tools, 4 channels, custom fine-tuned model
- โAI editorial engine: trend discovery โ GPT-5 generation โ medical safety โ editor review โ publication, ~70 articles/week
- โCustom attribution: first-touch + non-direct-last-click across 19 dashboards
- โLead lifecycle: web event โ phone match โ booking โ revenue attribution
- โAutomated feedback chains: booking โ 24h visit review โ 18d treatment review
Automation
- โ15 cron jobs handle feedback, cleanup, analytics sync, content generation, and email triggers
- โAI-powered editorial pipeline across 5 countries: 6 formats, zone rotation, cost tracking, hero image generation -editors curate and publish
- โStripe webhook pipeline: payment โ purchase โ loyalty โ confirmation email
- โDeepL bulk translation across 6 locales with human review workflow
- โFull delivery: 8 services and 3 AI systems, architected, built, and maintained by one developer