How Tubara is Built: System Architecture Explained Simply
The Big Picture (Like a House)
Think of Tubara like a well-designed house where your family lives safely. You don't need to understand plumbing and electrical wiring to live in a house, but knowing the basics helps you trust it's built properly.
This guide explains how Tubara's "house" is constructed - the foundation, walls, security systems, and utilities - all in plain English.
1. The Three Main Parts (Frontend, Backend, Database)
The Frontend: What You See and Touch
What it is: The frontend is everything you interact with directly - buttons, menus, video players, child profiles. It's the "face" of Tubara.
Simple analogy: Think of it as the living room, kitchen, and bedrooms of your house - the spaces where you actually live and interact with things.
Built with:
-
React - A modern way to build interactive websites (like building with LEGO blocks - reusable, flexible)
-
TypeScript - A version of JavaScript that catches mistakes before they cause problems
-
Tailwind CSS - Pre-designed styling components (like having a professional interior designer)
Why this matters:
-
โ Fast and responsive (no laggy buttons)
-
โ Works on phones, tablets, and computers
-
โ Updates instantly without page refreshes
-
โ Easy to add new features
The Backend: The Behind-the-Scenes Engine
What it is: The backend is the "brain" that processes requests, checks permissions, talks to YouTube, and manages data. You never see it directly.
Simple analogy: Think of it as the plumbing, electrical wiring, and heating system hidden in your walls - essential but invisible.
Built with:
-
Express.js - A framework that handles web requests (like a restaurant manager taking orders)
-
Node.js - The programming environment that runs the backend
-
TypeScript - Same language as frontend (consistency = fewer bugs)
What it does:
-
๐ Verifies you're logged in before showing data
-
๐ฏ Checks if your child is allowed to watch specific content
-
๐ Calculates screen time limits
-
๐ Talks to YouTube's API to get video information
-
๐ณ Communicates with Stripe for payments
-
๐ Records watch history for analytics
Why this matters:
-
โ Your data is protected (not exposed to the internet)
-
โ Business rules are enforced (tier limits, age filtering)
-
โ Security checks happen server-side (can't be bypassed)
-
โ Heavy processing doesn't slow down your device
The Database: Where Everything is Stored
What it is: The database is where all your family's information lives - accounts, child profiles, approved channels, watch history.
Simple analogy: Think of it as a giant, ultra-secure filing cabinet with separate locked drawers for each family.
Built with:
-
PostgreSQL - A powerful, reliable database system (used by banks and major companies)
-
Neon - Cloud hosting service that manages the database professionally
-
Drizzle ORM - A tool that makes database interactions safer and easier
What's stored:
๐ Users Table
โโ Your email, encrypted password
โโ Subscription tier
โโ Account creation date
๐ Children Table
โโ Child names (encrypted)
โโ Ages (encrypted)
โโ Avatar and theme preferences
โโ Age restriction settings
๐ Channels Table
โโ Approved channels (YouTube channel IDs)
โโ Category and age group
โโ Approval dates
๐ Watch History Table
โโ Which child watched what
โโ When and for how long
โโ Completion status
๐ Blacklist Table
โโ Permanently blocked channels
โโ Reasons for blocking
Why this matters:
-
โ Data is organized and easy to retrieve
-
โ Multiple families can use Tubara without seeing each other's data
-
โ Backups happen automatically
-
โ Searches are fast even with thousands of records
2. How the Three Parts Work Together
A Day in the Life of a Request
Scenario: Your child clicks "Play Video" in Tubara
1. FRONTEND (Your Device)
"Child #8 wants to watch video abc123 from channel 'Blippi'"
โ
2. BACKEND (Server)
"Let me check..."
- Is this child's account active? โ
- Is this channel approved for this family? โ
- Does child have screen time remaining? โ
- Is this video age-appropriate? โ
โ
3. DATABASE (Storage)
Backend asks: "What are child #8's age restrictions?"
Database answers: "Preschool content only, max 60 min/day, 45 min used today"
โ
4. BACKEND (Processing)
"All checks passed. Generate secure YouTube embed URL."
"Record this watch session for analytics."
โ
5. FRONTEND (Your Device)
"Here's your video! Starting watch timer now."
Video plays in privacy-enhanced mode
Time elapsed: Less than 1 second
Simple analogy:
Like ordering food at a restaurant:
-
You (frontend) order a burger
-
Waiter (backend) takes order to kitchen and checks if it's available
-
Kitchen (database) provides ingredients
-
Chef (backend) prepares meal
-
Waiter brings you the burger (frontend displays video)
3. Multi-Tenant Architecture (Separate Apartments)
What "Multi-Tenant" Means
The problem: Tubara serves thousands of families. How do we keep each family's data completely separate and secure?
The solution:
Every database record includes a parent_id (your unique family identifier). This is like an apartment number in a building.
Simple analogy:
๐ข Tubara Apartment Building
Floor 100: Family #100 (The Smiths)
โโ 2 children
โโ 4 approved channels
โโ 50 watch history entries
โโ Their data only
Floor 101: Family #101 (The Johnsons)
โโ 3 children
โโ 6 approved channels
โโ 120 watch history entries
โโ Their data only
Floor 123: Family #123 (Your family)
โโ 2 children (Ben & Holly)
โโ 4 approved channels
โโ 85 watch history entries
โโ Your data only
How we enforce separation:
Every database query includes your family ID:
-- CORRECT (includes family filter)
SELECT * FROM channels WHERE parent_id = 123
-- WRONG (would show everyone's channels - we never do this!)
SELECT * FROM channels
Why this matters:
-
โ You can never accidentally see another family's data
-
โ Your children can never see other families' profiles
-
โ A security issue with one account doesn't affect others
-
โ Each family's experience is completely isolated
Proof it works:
-
1,000 families could all approve the same "Blippi" channel
-
Each gets their own separate database entry
-
Removing Blippi from your account doesn't affect anyone else
-
Your blacklist is yours alone
4. Authentication & Sessions (The Key System)
How Logging In Works
Step 1: Creating Your Account
1. You enter: email + password
โ
2. Backend immediately scrambles your password with bcrypt
(one-way encryption - even we can't unscramble it)
โ
3. Database stores: email + scrambled password hash
โ
4. Your account is created
Step 2: Logging In
1. You enter: email + password
โ
2. Backend scrambles what you typed
โ
3. Compares scrambled version to stored hash
โ
4. Match? Create a session and give you a cookie
โ
5. No match? Show "Invalid credentials" error
Simple analogy: Like a bank vault that turns your key into a unique lock pattern. The bank doesn't store your actual key - they store the pattern. When you return, they check if your key makes the right pattern.
The Session Cookie (Your Temporary Pass)
What it is: When you log in, the backend creates a session - a temporary record that says "User #123 is logged in."
Your browser gets a cookie - a small encrypted token that proves you're logged in.
Simple analogy:
Like a wristband at a theme park:
-
โ Shows you paid admission
-
โ Lets you access rides
-
โ Expires at the end of the day
-
โ Can't be transferred to someone else
Session details:
-
๐ Duration: 30 days of inactivity (then you need to log in again)
-
๐ Security: HTTP-only (JavaScript can't access it - prevents hacking)
-
๐ Encrypted: Contains only a random session ID, not your actual data
-
๐ Stored: In a special
sessiontable in the database
Every request you make:
Browser sends: "Cookie: session_id_abc123xyz"
Backend checks: "Is session abc123xyz valid? Yes! User #123."
Backend responds: "Here's your family's data."
Why this matters:
-
โ You stay logged in (don't retype password constantly)
-
โ Secure (cookie is encrypted and can't be forged)
-
โ Automatic logout after inactivity (security)
-
โ Works across multiple tabs/windows
The Parental Gate (Extra Security Layer)
The problem: Children might use a device where a parent is already logged in.
The solution: The Parent Dashboard requires a second password check that expires after 30 minutes.
How it works:
1. You're logged into Tubara (session active)
โ
2. You click "Parent Dashboard"
โ
3. System asks: "Enter password again"
โ
4. You enter password, system creates parental_access session
โ
5. Parent Dashboard unlocked for 30 minutes
โ
6. After 30 minutes: Auto-locks, requires password again
Simple analogy: Like a house with a locked office. You have the key to enter the house (login), but the office door needs a separate key (parental password) that auto-locks after 30 minutes.
Why 30 minutes? - Long enough: You can review analytics and make changes - Short enough: If you leave your device, children can't access settings
5. Hosting & Deployment (Where Tubara Lives)
The Cloud Infrastructure
Frontend Hosting: Vercel
What it is: Your browser loads the Tubara website from Vercel - a professional hosting service for modern web apps.
Simple analogy: Like a global network of identical restaurants - no matter where you are, you get the same menu, served quickly.
Benefits: - ๐ Global CDN: Files served from servers close to you (faster loading)
-
โก Instant updates: When we fix bugs or add features, they appear immediately
-
๐ Automatic scaling: If 10,000 families log in at once, Vercel handles it
-
๐ HTTPS by default: All connections encrypted
What's hosted on Vercel: - HTML, CSS, JavaScript files - Images, icons, avatars - The React application code
What's NOT hosted on Vercel: - Your data (that's in the database) - Backend logic (that's on a separate server)
Backend Hosting: Your Choice of Provider
Currently: Replit (development) or similar Node.js hosting
What it needs:
-
Node.js runtime environment
-
Ability to run Express.js server
-
Environment variables for secrets
-
HTTPS support
Production options:
-
Railway - Simple, developer-friendly
-
Render - Free tier available
-
Heroku - Classic choice (but expensive)
-
DigitalOcean - Full control via VPS
-
AWS - Enterprise-grade (complex)
Simple analogy: Like choosing where your restaurant's kitchen is located. The dining room (frontend) is on Vercel, but the kitchen (backend) can be anywhere that has the right equipment.
Database Hosting: Neon
What it is: Your database is hosted on Neon - a modern PostgreSQL hosting service designed for scalability and security.
Why Neon?
-
๐ Encrypted storage - All data encrypted at rest
-
๐ Automatic backups - Daily snapshots (can restore if something goes wrong)
-
โก Fast connections - Optimized for quick queries
-
๐ Serverless scaling - Grows with your user base
-
๐ฐ Cost-effective - Free tier for development, reasonable pricing for production
Simple analogy: Like storing your valuables in a professional bank vault instead of under your mattress. It's managed by experts with 24/7 security.
Connection security:
Backend โ[encrypted connection]โ Neon Database
โ
Your device never connects directly to database
(only backend can access it)
6. Progressive Web App (PWA) Features
What's a PWA?
Traditional websites:
-
Only work in a browser
-
Can't be "installed"
-
No offline capability
-
No home screen icon
Tubara as a PWA:
-
โ Can be installed like a native app
-
โ Gets its own icon on your home screen
-
โ Works in fullscreen (no browser bars)
-
โ Basic offline functionality
-
โ Faster loading (caches files)
Simple analogy: A regular website is like visiting a store. A PWA is like the store opening a branch in your neighborhood - still the same store, but more convenient and faster to access.
How Installation Works
On Mobile/Tablet:
-
Visit Tubara in your browser
-
Browser shows "Add to Home Screen" prompt
-
Tap "Add"
-
Tubara appears as an app icon
-
Tapping the icon opens Tubara fullscreen (looks like a real app)
On Desktop:
-
Visit Tubara in Chrome/Edge
-
Look for install icon in address bar
-
Click "Install"
-
Tubara opens in its own window
-
Pin to taskbar for quick access
What gets cached (stored locally):
-
โ App shell (layout, buttons, interface)
-
โ Avatars and theme images
-
โ Icon files
-
โ Fonts and styles
What requires internet:
-
โ Videos (stream from YouTube)
-
โ Your data (fetched from database)
-
โ Channel updates
-
โ Authentication checks
Simple analogy: Like downloading a restaurant's menu to your phone - you can browse the menu offline, but you still need to connect to place an order.
7. Data Flow Architecture (Following the Information)
Creating a Child Profile (Step-by-Step)
What you do: Click "Add Child" โ Enter name, age, select avatar โ Click "Create"
What happens behind the scenes:
1. FRONTEND (Your Device)
Collects: name="Emma", age=7, avatar="fox"
Sends encrypted HTTPS request to backend
โ
2. BACKEND (Server)
- Checks: Is user logged in? โ
- Checks: Does user have permission? โ
- Validates: Is data complete and valid? โ
- Encrypts: name="Emma" โ "U2FsdGVkX1+Qxv7jQ..."
- Encrypts: age=7 โ "U2FsdGVkX1+Mxp9kR..."
โ
3. DATABASE (Neon)
Stores new row in children table:
{
id: 10,
parent_id: 123,
encrypted_name: "U2FsdGVkX1+Qxv7jQ...",
encrypted_age: "U2FsdGVkX1+Mxp9kR...",
avatar: "fox",
theme_id: "space-explorer",
created_at: "2025-11-13T15:00:00Z"
}
โ
4. BACKEND (Server)
- Decrypts data for immediate use
- Sends response back to frontend
โ
5. FRONTEND (Your Device)
- Shows success message
- Updates child profile list
- Displays Emma's new profile card
Time elapsed: 100-300 milliseconds
Security checkpoints passed:
-
HTTPS encryption in transit
-
Session authentication
-
Permission validation
-
Input sanitization
-
Data encryption at rest
-
Audit logging
Watching a Video (Complete Journey)
1. Child selects profile (Ben, age 5)
โ
2. FRONTEND queries backend:
"Get approved channels for Ben (preschool level)"
โ
3. BACKEND queries database:
SELECT channels WHERE parent_id=123 AND is_approved=true
โ
4. DATABASE returns: 4 approved channels
โ
5. BACKEND filters by age:
- Blippi (3-5) โ passes
- Maddie Moate (3-5) โ passes
- Kurzgesagt (late-elementary) โ blocked
- Crash Course Kids (9-11) โ blocked
โ
6. FRONTEND displays: 2 channels for Ben
โ
7. Ben clicks "Blippi"
โ
8. FRONTEND queries backend:
"Get videos for Blippi channel"
โ
9. BACKEND:
- Checks cache (is data < 24 hours old?)
- If yes: return cached data
- If no: query YouTube API, cache result, return data
โ
10. YouTube API returns: List of recent videos
โ
11. BACKEND filters: Only "Made for Kids" videos
โ
12. FRONTEND displays: Grid of video thumbnails
โ
13. Ben clicks a video thumbnail
โ
14. BACKEND checks:
- Screen time remaining? 15 minutes left โ
- Channel still approved? Yes โ
- Video still exists on YouTube? Yes โ
โ
15. BACKEND creates secure embed URL:
youtube-nocookie.com/embed/VIDEO_ID?privacy_mode=on
โ
16. FRONTEND loads video player in locked frame
โ
17. Ben watches video (10 minutes)
โ
18. FRONTEND continuously reports to backend:
"Ben is watching, 2 minutes elapsed... 5 minutes... 10 minutes"
โ
19. BACKEND records to database:
INSERT INTO watch_history (child_id, video_id, duration, timestamp)
โ
20. BACKEND updates screen time counter:
Ben has 5 minutes remaining today
โ
21. Video ends, FRONTEND returns to channel view
โ
22. Parent checks analytics later:
Backend retrieves watch_history, formats report, shows in dashboard
Total checkpoints: 22 steps, multiple security validations
Technologies involved: React, Express, PostgreSQL, YouTube API, Neon hosting
8. Scalability (Growing with Users)
How Tubara Handles Growth
Current capacity:
-
Users: Designed for 10,000+ families
-
Channels: Each family can have up to 999 channels (Unlimited tier)
-
Watch history: Millions of entries
-
Concurrent users: 1,000+ families watching simultaneously
How we scale:
Frontend (Vercel):
-
โ Automatic scaling - Vercel adds servers when traffic spikes
-
โ Global CDN - Files served from 200+ locations worldwide
-
โ No limits - Can handle millions of page views
Backend (Node.js server):
-
โ Horizontal scaling - Can add more server instances
-
โ Load balancing - Distributes traffic across multiple servers
-
โ Caching - Reduces database queries by 80%
Database (Neon):
-
โ Connection pooling - Efficient database connections
-
โ Indexed queries - Fast searches even with millions of records
-
โ Automatic scaling - Storage and compute scale independently
Simple analogy:
Like a restaurant that can:
-
Add more tables when busy (horizontal scaling)
-
Hire more waiters (load balancing)
-
Prep ingredients ahead of time (caching)
-
Open new locations if needed (geographic distribution)
Performance Optimization
What we do to keep Tubara fast:
1. Caching Strategy
YouTube channel data: Cached for 24 hours
Video lists: Cached for 12 hours
User sessions: In-memory cache (Redis-compatible)
Static assets: Cached on CDN indefinitely
Why it matters:
-
Instead of asking YouTube for channel info every time, we ask once per day
-
Reduces API quota usage by 95%
-
Faster page loads for you
2. Database Optimization
Indexes on frequently searched fields:
- parent_id (every query uses this)
- youtube_channel_id (for lookups)
- child_id (for watch history queries)
- created_at (for date-based analytics)
Why it matters:
-
Finding your data in a database of 100,000 records takes milliseconds, not seconds
-
Like having an index in a book instead of reading every page
3. Lazy Loading
Load immediately:
- Your child profiles
- Approved channel count
Load on-demand:
- Video thumbnails (only when you scroll to them)
- Watch history (only when you open analytics)
- Full channel descriptions (only when clicked)
Why it matters:
-
Initial page loads in < 2 seconds
-
Doesn't waste bandwidth loading data you won't see
Simple analogy: Like a newspaper - the front page loads instantly (headlines), but you only load full articles when you click on them.
9. Reliability & Backups (What If Something Breaks?)
Automatic Backups
Database backups:
-
๐ Frequency: Daily automatic backups via Neon
-
๐ Retention: 30 days of backup history
-
โก Recovery time: Can restore within 1 hour
-
๐ Security: Backups are encrypted
What's backed up:
-
โ All user accounts
-
โ All child profiles
-
โ All approved channels
-
โ All watch history
-
โ All blacklist entries
-
โ All subscription data
What's NOT backed up:
-
โ Session cookies (temporary anyway)
-
โ Cached YouTube data (can be re-fetched)
-
โ Temporary files
Simple analogy: Like automatic photo backups on your phone - happens in the background, you never think about it until you need it.
Disaster Recovery Plan
Scenario: Database corruption or data loss
1. Problem detected (monitoring alerts us)
โ
2. Switch to read-only mode (prevent further damage)
โ
3. Assess extent of damage
โ
4. Restore from most recent backup
โ
5. Verify data integrity
โ
6. Return to normal operation
โ
7. Post-incident review and improvements
Recovery Time Objective (RTO): 2 hours maximum
Recovery Point Objective (RPO): Maximum 24 hours of data loss (one day)
What this means for you:
-
Worst case: You lose one day of watch history
-
Best case: No data loss at all (depends on timing)
-
Your child profiles and approved channels: Always safe (backed up daily)
Monitoring & Alerts
What we monitor 24/7:
System health:
-
โ Server uptime and response times
-
โ Database connection status
-
โ Error rates and types
-
โ API quota usage (YouTube)
-
โ Security scan results
Performance metrics:
-
โ Page load times
-
โ API response times
-
โ Database query speeds
-
โ Cache hit rates
Business metrics:
-
โ User signups
-
โ Active users
-
โ Subscription conversions
-
โ Content usage
When something goes wrong:
-
๐จ Automated alert sent immediately
-
๐ฑ Team notified via SMS/email
-
๐ Investigation starts
-
๐ง Fix implemented
-
๐ Post-incident analysis
Simple analogy: Like a hospital's monitoring equipment - constantly checking vital signs, alerting doctors if anything is abnormal.
10. Security Architecture (Defense in Depth)
Multiple Layers of Protection
Think of security like a castle with multiple defenses:
Layer 1: The Moat (Network Level)
-
๐ HTTPS encryption for all connections
-
๐ก๏ธ DDoS protection via Vercel/hosting provider
-
๐ซ Firewall rules blocking suspicious traffic
Layer 2: The Outer Wall (Application Level)
-
๐ Rate limiting (prevents brute force attacks)
-
โ Input validation (rejects malicious data)
-
๐งน SQL injection prevention (sanitized queries)
-
๐ญ CSRF token protection
Layer 3: The Inner Keep (Authentication)
-
๐ Bcrypt password hashing
-
๐ช HTTP-only secure session cookies
-
โฐ Automatic session expiration
-
๐ช Parental gate with separate timeout
Layer 4: The Vault (Data Encryption)
-
๐ AES-256 encryption for sensitive data (names, ages)
-
๐พ Encrypted database storage via Neon
-
๐ Environment variables for secrets (never in code)
Layer 5: The Guards (Monitoring)
-
๐๏ธ Aikido Security automated scanning
-
๐ Real-time error tracking
-
๐ Audit logs for sensitive operations
-
๐จ Automated security alerts
Simple analogy:
Like a bank with:
-
Guards at the entrance (network security)
-
Metal detectors (input validation)
-
Vault requiring passcodes (authentication)
-
Safe deposit boxes (encryption)
-
Security cameras (monitoring)
What Could Go Wrong (Honest Assessment)
Low Risk (Protected):
-
โ Password theft - encrypted, can't be reversed
-
โ Session hijacking - HTTP-only cookies, HTTPS only
-
โ SQL injection - parameterized queries
-
โ Cross-family data leaks - parent_id filter on every query
Medium Risk (Mitigated):
-
โ ๏ธ Brute force login attempts - rate limited to 5 attempts per 15 minutes
-
โ ๏ธ DDoS attacks - protected by hosting provider
-
โ ๏ธ Malicious channel submissions - safety delay + manual review
Low-Medium Risk (Requires vigilance):
-
โ ๏ธ Weak user passwords - we can't control what you choose (use strong passwords!)
-
โ ๏ธ Device theft with active session - 30-day expiration + parental gate auto-lock
-
โ ๏ธ Phishing attacks targeting users - we can't control external emails
Higher Risk (Shared responsibility):
-
๐ด Sharing login credentials - don't give children your password
-
๐ด Using public/shared devices - always log out
-
๐ด Outdated device security - keep your OS and browser updated
11. API Integration Points
External Services Tubara Connects To
YouTube Data API v3
-
Purpose: Fetch channel and video information
-
Data sent: Channel URLs, video IDs, API key
-
Data received: Metadata, thumbnails, "Made for Kids" status
-
Security: API key stored as environment variable (not in code)
-
Rate limit: 10,000 requests per day
Stripe Payment API
-
Purpose: Process subscription payments
-
Data sent: Subscription tier selection, user email
-
Data received: Payment status, customer ID, subscription ID
-
Security:
-
Your card details NEVER touch our servers
-
Stripe handles all payment info
-
Webhooks use signature verification
Neon Database
-
Purpose: Store all application data
-
Connection: Encrypted PostgreSQL connection string
-
Security:
-
Connection pooling prevents overload
-
Read-only users for analytics (defense in depth)
-
Automatic connection timeout
SendGrid (Email Service)
-
Purpose: Send password reset and notification emails
-
Data sent: Recipient email, message content
-
Security: API key authentication
Simple analogy:
Like utilities in your house:
-
YouTube API = Water supply (you don't own the source, but you control the tap)
-
Stripe = Electricity provider (handles power, sends you the bill)
-
Neon = Storage unit (your stuff, professionally managed)
-
SendGrid = Postal service (delivers messages)
12. Development & Deployment Pipeline
How Updates Happen
Development workflow:
1. NEW FEATURE IDEA
Write specification document
โ
2. CODE DEVELOPMENT
Developer writes code in TypeScript
Tests locally on development server
โ
3. CODE REVIEW
Second developer reviews changes
Checks for bugs and security issues
โ
4. AUTOMATED TESTING
Test suite runs automatically
Verifies nothing broke
โ
5. STAGING DEPLOYMENT
Deploy to test environment
Final manual testing
โ
6. PRODUCTION DEPLOYMENT
Deploy to live Tubara servers
Monitor for errors
โ
7. POST-DEPLOYMENT
Verify metrics are normal
Monitor user feedback
Simple analogy:
Like aircraft maintenance:
-
Design the fix (specifications)
-
Build the part (development)
-
Inspect quality (code review)
-
Test in simulator (automated tests)
-
Test on ground (staging)
-
Install on actual plane (production)
-
Monitor flight performance (monitoring)
Version Control (GitHub)
What it is: Every change to Tubara's code is tracked in Git - a version control system hosted on GitHub.
Why it matters:
-
๐ Complete history of every change
-
๐ Can undo bad changes instantly
-
๐ฅ Multiple developers can work simultaneously
-
๐ Can trace bugs to specific code changes
Simple analogy: Like Microsoft Word's "Track Changes" feature, but for code. We can see who changed what, when, and why - and undo it if needed.
Backup benefit: Even if every server exploded, we have the complete codebase on GitHub. We could rebuild Tubara from scratch in hours.
13. Future Architecture Plans
Phase 1 (Current): Monolithic Architecture
What it means: Frontend, backend, and database are separate, but the backend is one big application.
Pros:
-
โ Simple to develop and deploy
-
โ Easy to debug
-
โ Fast for current user base (thousands of families)
Cons:
-
โ ๏ธ Harder to scale individual components
-
โ ๏ธ One part breaking could affect everything
Phase 2 (2026): Microservices Architecture
What it means: Split the backend into specialized services:
Authentication Service (handles logins)
โ
Content Service (manages channels/videos)
โ
Analytics Service (processes watch history)
โ
Payment Service (Stripe integration)
โ
YouTube API Service (talks to YouTube)
Pros:
-
โ Each service can scale independently
-
โ Bug in one service doesn't break others
-
โ Easier to add new features
-
โ Different teams can work on different services
Cons:
-
โ ๏ธ More complex to manage
-
โ ๏ธ Higher hosting costs (more servers)
When we'll switch: When Tubara reaches 50,000+ active families - not before (don't over-engineer early).
Phase 3 (2027+): Global Distribution
What it means: Deploy Tubara in multiple geographic regions:
๐ Europe (London) - serves UK/EU users
๐ Americas (US East) - serves US/Canada users
๐ Asia-Pacific (Sydney) - serves Australia/NZ users
Benefits:
-
โก Faster for users (served from nearby servers)
-
๐ Data residency compliance (EU data stays in EU)
-
๐ก๏ธ Redundancy (if one region fails, others continue)
Simple analogy: Like McDonald's having restaurants in every city instead of one giant restaurant everyone flies to.
14. Technical Debt & Maintenance
What is Technical Debt?
Definition: Shortcuts taken during development that work now but need fixing later.
Simple analogy: Like duct-taping a leaky pipe instead of replacing it - it works temporarily but you'll need to fix it properly eventually.
Examples in Tubara:
Current workarounds:
-
Some API endpoints do multiple things (should be split)
-
Cache invalidation could be smarter
-
Some database queries could be more efficient
-
Frontend and backend share some duplicated code
Our approach:
-
๐ Track technical debt in a list
-
๐ง Fix highest-priority items quarterly
-
โ๏ธ Balance new features vs. maintenance
-
๐ Never let debt accumulate dangerously
Why this matters:
-
โ Honest about imperfections
-
โ Systematic improvement plan
-
โ Prevents future catastrophic failures
15. Open Source Components
What We Use (Standing on Giants' Shoulders)
Tubara is built with open-source software - free, community-maintained libraries.
Major dependencies:
Frontend:
-
React (Facebook/Meta) - UI framework
-
TypeScript (Microsoft) - Programming language
-
Tailwind CSS (community) - Styling
-
TanStack Query (community) - Data fetching
-
Wouter (community) - Routing
Backend:
-
Express.js (community) - Web framework
-
Passport.js (community) - Authentication
-
Bcrypt (community) - Password hashing
-
Drizzle ORM (community) - Database toolkit
Why open source?
-
โ Battle-tested by thousands of companies
-
โ Security reviewed by global community
-
โ Free (reduces costs)
-
โ Well-documented
-
โ Constantly improved
Risks:
-
โ ๏ธ Libraries can have vulnerabilities (we scan regularly)
-
โ ๏ธ Maintainers could abandon projects (we choose stable ones)
-
โ ๏ธ Breaking changes in updates (we test before upgrading)
Our responsibility:
-
๐ Update dependencies monthly
-
๐ Scan for vulnerabilities weekly (Aikido Security)
-
๐ Read changelogs before upgrading
-
๐งช Test thoroughly after updates
Simple analogy: Like building a house with pre-made bricks (open source) instead of making your own bricks from clay. Faster, cheaper, proven quality - but you need to check for cracked bricks.
16. Compliance & Standards
Technical Standards We Follow
Web Standards:
-
โ HTML5 for structure
-
โ CSS3 for styling
-
โ ES2020+ JavaScript
-
โ REST API conventions
-
โ OAuth 2.0 for third-party auth (future)
Security Standards:
-
โ OWASP Top 10 (web security best practices)
-
โ HTTPS/TLS 1.3 encryption
-
โ Content Security Policy headers
-
โ CSRF token protection
Accessibility Standards:
-
โ ๏ธ WCAG 2.1 Level AA (partial compliance)
-
๐ Ongoing improvements for screen readers
-
๐ Keyboard navigation enhancements
Data Protection:
-
โ GDPR technical requirements
-
โ COPPA data handling standards
-
โ Data minimization principles
-
โ Right to deletion implementation
Why this matters:
-
โ Industry best practices protect your data
-
โ Compliance with legal requirements
-
โ Accessible to families with disabilities
-
โ Professional-grade system architecture
Common Parent Questions
"Is Tubara's architecture suitable for thousands of families?"
Yes. The architecture is designed for 10,000+ concurrent families with room to scale.
Current tech stack (React, Express, PostgreSQL, Neon) is used by companies serving millions:
-
Netflix uses React
-
LinkedIn uses Express
-
Instagram uses PostgreSQL
-
Vercel hosts billion-dollar companies
We're not re-inventing wheels - we're using proven, battle-tested technology.
"What happens if your servers go down?"
Unlikely, but here's the plan:
Vercel (frontend) uptime: 99.99% (< 1 hour downtime per year)
Neon (database) uptime: 99.95% (< 4 hours downtime per year)
If frontend goes down:
-
You can't access Tubara at all
-
Data is safe, just inaccessible temporarily
-
Vercel's monitoring alerts them immediately
If backend goes down:
-
We're notified within 60 seconds
-
Can restore from backup server
-
Target recovery time: < 30 minutes
If database goes down:
-
Neon's team handles recovery
-
Automatic failover to backup
-
Target recovery time: < 15 minutes
Simple analogy:
Like electricity in your house - very reliable, but if it goes out, you have:
-
Generator (backup server)
-
Utility company fixing the problem fast (Vercel/Neon support)
-
Your stuff is safe when power returns (data intact)
"How do you prevent data from being lost?"
Multiple safeguards:
-
Daily backups - Can restore up to 30 days ago
-
Transaction logging - Database keeps a detailed record of changes
-
Redundant storage - Data stored in multiple locations
-
Version control - Code is backed up on GitHub
-
Monitoring - Alerts if anything looks wrong
What you can do:
-
Export your data periodically (Privacy โ Data Export)
-
Store the export file somewhere safe
-
You'll have your own backup
Probability of permanent data loss: < 0.001% (very unlikely)
"Can you see everything I do in Tubara?"
Technically yes, practically no.
What we CAN see (if we looked):
-
Your email address (visible in database)
-
Which channels you've approved (YouTube channel IDs)
-
When you logged in (timestamps)
-
How many children you have (count only)
What we CANNOT see:
-
โ Your password (encrypted hash only)
-
โ Your child's name (encrypted)
-
โ Your child's age (encrypted)
-
โ Your payment details (stored by Stripe, not us)
What we DON'T look at: Unless you report a bug and give permission, we don't access your data.
Monitoring is automated:
-
No humans read logs unless investigating issues
-
Sensitive data is filtered from error reports
-
Staff access to production database is limited and logged
Simple analogy: Like a bank - technically the staff could look at your account balance, but they don't unless you ask for help. Access is logged and requires justification.
"What if Tubara goes out of business?"
Your data:
-
โ You can export everything (Privacy โ Data Export)
-
โ We'd notify you 30 days before shutdown
-
โ Export feature would remain available during shutdown period
Your subscription:
-
โ Automatic cancellation (no further charges)
-
โ Pro-rated refunds for annual subscribers
-
โ Stripe handles refund processing
Open source option: We're considering open-sourcing Tubara if we ever shut down, so technically-capable parents could self-host.
Simple analogy: Like a gym closing - they give you notice, stop charging you, and you can take your personal training records with you.
The Bottom Line
Tubara's architecture is like a well-built house:
๐๏ธ Strong foundation (PostgreSQL database, proven frameworks)
๐งฑ Solid walls (multiple security layers)
๐ Reliable utilities (YouTube API, Stripe, hosting)
๐ช Good locks (authentication, encryption, parental controls)
๐ง Maintenance plan (monitoring, backups, updates)
๐ Room to grow (scalable design for thousands of families)
It's not perfect - no system is. But it's built with:
-
โ Industry-standard technology
-
โ Security-first principles
-
โ Scalability in mind
-
โ Your family's privacy as priority
-
โ Professional hosting and backups
-
โ Transparent, honest approach
Most importantly: The architecture supports Tubara's core mission - giving parents control over their children's educational video consumption in a safe, secure, private environment.
Questions?
Technical questions: tech-support@tubara.world
Architecture concerns: architecture@tubara.world
General inquiries: support@tubara.world
Response time: 24-48 hours
Remember: You don't need to understand the plumbing to use your house, but knowing it's built to comply with technical regulations helps you trust it. Tubara's architecture is built to industry standards which are the foundations of your family's security and privacy on the internet.
Document Version: 1.0
Last Updated: November 2025
Next Review: Quarterly
Transparency Commitment: If we make significant architectural changes, we'll update this document and notify users.