πŸ”βŒ˜K

Start typing to search docs.

Architecture Guide

1.0.0

Design philosophy, provider decision matrix, and auth strategies.

App Factory Architecture Guide

Overview

App Factory Forge is designed to make it dead simple to create and deploy full-stack applications. This guide explains the architectural decisions and available options.

Design Philosophy

Keep It Simple

The core philosophy is simplicity over complexity:

  • βœ… One service is better than many - Fewer moving parts, less to manage
  • βœ… Defaults matter - Smart defaults get you 90% of the way
  • βœ… Progressive complexity - Start simple, add complexity only when needed
  • βœ… Developer experience first - If it's hard to use, it's wrong

Flexibility When Needed

While we default to simplicity, power users can:

  • πŸ”§ Choose different infrastructure providers
  • πŸ”§ Customize authentication strategies
  • πŸ”§ Deploy to multiple cloud providers
  • πŸ”§ Bring their own infrastructure

Infrastructure Providers

Why Supabase?

Supabase is the default and recommended provider for App Factory applications because it provides everything you need in one service:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         SUPABASE (All-in-One)                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ PostgreSQL β”‚  Auth   β”‚   Storage    β”‚    β”‚
β”‚  β”‚  Database  β”‚ (OAuth) β”‚  (S3-like)   β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                              β”‚
β”‚  βœ… ONE service, ONE bill                    β”‚
β”‚  βœ… Built-in auth (no NextAuth needed)       β”‚
β”‚  βœ… Instant database branching               β”‚
β”‚  βœ… $0-25/month total cost                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Cost Comparison:

ApproachMonthly CostServices to Manage
Supabase$0-251
AWS RDS + VPC + Clerk$74+3+
Neon + Clerk + S3$44+3+

Features Included:

  • PostgreSQL database with automatic backups
  • Authentication (OAuth, email, magic links)
  • S3-compatible storage
  • Real-time subscriptions
  • Edge functions
  • Database branching for development
  • Auto-generated REST and GraphQL APIs
  • Admin dashboard

When to Choose Supabase:

  • βœ… Building an MVP
  • βœ… Want the fastest time-to-market
  • βœ… Need built-in authentication
  • βœ… Want to minimize infrastructure management
  • βœ… Budget-conscious projects
  • βœ… Real-time features needed

Alternative: Neon (Database-Only)

Why Neon?

Neon is a serverless PostgreSQL provider with excellent developer experience:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Neon PostgreSQL      β”‚
β”‚  - Scale-to-zero       β”‚
β”‚  - Instant branching   β”‚
β”‚  - $0-19/month         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
    Need to add separately:
    - Auth (Clerk/NextAuth)
    - Storage (S3/R2)
    - Functions (Vercel/AWS)

When to Choose Neon:

  • βœ… You only need a database
  • βœ… You already have auth/storage solutions
  • βœ… You want pure PostgreSQL without extras
  • βœ… You need advanced database branching for CI/CD

Advanced: AWS/GCP (Full Control)

Why AWS/GCP?

For enterprises or teams that need full infrastructure control:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         AWS Infrastructure              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
β”‚  β”‚  RDS   β”‚   S3   β”‚  Lambda  β”‚        β”‚
β”‚  β”‚  VPC   β”‚   CDN  β”‚ Gateway  β”‚        β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
β”‚                                         β”‚
β”‚  ⚠️  Multiple services to manage        β”‚
β”‚  ⚠️  Higher complexity                  β”‚
β”‚  ⚠️  $50-200/month                      β”‚
β”‚  βœ… Full control and customization      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

When to Choose AWS/GCP:

  • βœ… Enterprise compliance requirements
  • βœ… Need specific AWS/GCP services
  • βœ… Team has cloud infrastructure expertise
  • βœ… Custom networking requirements
  • βœ… Advanced security and compliance needs

Authentication Strategies

When using Supabase, authentication is built-in:

// Sign in with Google
const { data, error } = await supabase.auth.signInWithOAuth({
  provider: 'google',
});

// Get current user
const { data: { user } } = await supabase.auth.getUser();

Features:

  • OAuth providers (Google, GitHub, Twitter, etc.)
  • Email/password authentication
  • Magic link (passwordless) login
  • Phone authentication with SMS
  • Multi-factor authentication (MFA)
  • Row Level Security integration

Alternative: NextAuth.js

For AWS/Neon setups without built-in auth:

// Configure NextAuth with providers
export const authOptions = {
  providers: [
    GoogleProvider({ ... }),
    GitHubProvider({ ... }),
  ],
};

Advanced: Clerk

For centralized auth across multiple apps:

auth.yourdomain.com β†’ Central auth service
  β”œβ”€ app1.yourdomain.com
  β”œβ”€ app2.yourdomain.com  
  └─ app3.yourdomain.com

Decision Matrix

Use this matrix to choose your infrastructure:

Your SituationRecommended ProviderWhy
Building MVPSupabaseFastest to market, lowest cost
Startup with <100K usersSupabaseBest value, scales well
Need only databaseNeonClean PostgreSQL experience
Enterprise complianceAWS/GCPFull control and security
Budget-consciousSupabaseFree tier β†’ $25/month
Real-time appsSupabaseBuilt-in real-time subscriptions
Existing AWS setupAWSLeverage existing infrastructure
Team knows GCPGCPUse familiar tooling

Architecture Patterns

Pattern 1: Simple (Supabase)

Best for: MVPs, startups, indie hackers

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Supabase   β”‚ ← Everything in one place
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
   β”Œβ”€β”€β”€β”΄β”€β”€β”€β”€β”
   β”‚        β”‚
β”Œβ”€β”€β–Όβ”€β”€β”  β”Œβ”€β–Όβ”€β”€β”€β”€β”
β”‚ Web β”‚  β”‚Mobileβ”‚
β””β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜

Setup time: 5-10 minutes
Monthly cost: $0-25
Services to manage: 1

Pattern 2: Database + Custom Auth (Neon)

Best for: Custom requirements, existing auth

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Neon   β”‚  β”‚  Clerk/  β”‚
β”‚    DB    β”‚  β”‚NextAuth  β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
     β”‚              β”‚
     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
        β”Œβ”€β”€β”€β”΄β”€β”€β”€β”€β”
        β”‚        β”‚
    β”Œβ”€β”€β”€β–Όβ”€β”€β”  β”Œβ”€β–Όβ”€β”€β”€β”€β”
    β”‚ Web  β”‚  β”‚Mobileβ”‚
    β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜

Setup time: 15-30 minutes
Monthly cost: $19-44
Services to manage: 2-3

Pattern 3: Full Stack (AWS/GCP)

Best for: Enterprises, compliance needs

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     AWS Infrastructure       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚RDS β”‚ S3  β”‚Lambdaβ”‚  CDN β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                β”‚
    β”Œβ”€β”€β”€β–Όβ”€β”€β”      β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”
    β”‚ Web  β”‚      β”‚  Mobile   β”‚
    β””β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Setup time: 30-60 minutes
Monthly cost: $50-200+
Services to manage: 5-10

Migration Paths

From AWS to Supabase

Why migrate?

  • Reduce costs by 60-70%
  • Simplify infrastructure
  • Get built-in features (auth, storage, real-time)

Steps:

  1. Export data from RDS
  2. Create Supabase project via Forge CLI
  3. Import data using SQL
  4. Update connection strings in Doppler
  5. Migrate to Supabase Auth (optional)
  6. Test thoroughly
  7. Destroy AWS resources

Estimated time: 2-4 hours

From Supabase to AWS

Why migrate?

  • Enterprise compliance requirements
  • Need specific AWS services
  • Custom networking needs

Steps:

  1. Export Supabase data
  2. Provision AWS infrastructure via Pulumi
  3. Import data to RDS
  4. Set up separate auth service (Clerk/NextAuth)
  5. Set up S3 for storage
  6. Update all app configurations
  7. Test thoroughly

Estimated time: 4-8 hours

Environment Management

All infrastructure is managed through Pulumi + Doppler:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Pulumi    │───▢│   Doppler    │───▢│  Your Apps  β”‚
β”‚ (Provision) β”‚    β”‚   (Secrets)  β”‚    β”‚  (Consume)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Benefits:

  • Infrastructure as code
  • Automatic secret syncing
  • Environment-specific configs
  • Version control for infrastructure

Template Catalog Metadata

The configuration lives in ops/apps.yaml. Each app entry doubles as a template definition that powers the dashboard gallery and CLI scaffolding. The metadata block now exposes structured fields so downstream services can render consistent cards:

  • persona β€” primary customer or operator profile the template targets.
  • category β€” high-level grouping used for filtering (e.g. Productivity, Developer Tools).
  • summary β€” short marketing blurb rendered in galleries and tooltips.
  • tags β€” keyword array for search and faceted navigation; must contain at least one value.
  • heroImage β€” relative asset path or URL for the template preview image.
  • maintainer / lastUpdated β€” optional stewardship details retained for ops handoffs.

These fields are validated via @app-factory/config's template parser and surfaced through the dashboard API at GET /api/templates. The API returns a read-only JSON array sourced from the bundled apps.yaml, so any new template metadata must be committed to the configuration file to reach production.

Cost Optimization

Tips for Keeping Costs Low

  1. Start with Supabase free tier

    • 500MB database, 50K MAU
    • Upgrade to Pro ($25) only when needed
  2. Use Neon for database-only needs

    • Free tier includes 500MB
    • Scale-to-zero saves compute costs
  3. Avoid AWS for MVP

    • Minimum ~$30/month even without traffic
    • VPC and networking costs add up quickly
  4. Clean up unused resources

    • Regular audit of Pulumi stacks
    • Destroy development environments when not in use

Cost Monitoring

# List all Pulumi stacks
pulumi stack ls

# Check stack costs (if configured)
pulumi stack output --show-costs

# Destroy unused stacks
pulumi destroy

Best Practices

DO βœ…

  • Start with Supabase for new projects
  • Use Doppler for all secrets and environment variables
  • Version control everything (except secrets)
  • Test in development before production
  • Monitor costs regularly
  • Clean up unused resources

DON'T ❌

  • Don't overcomplicate infrastructure for MVP
  • Don't commit secrets to git
  • Don't use AWS unless you need it
  • Don't skip backups (Supabase does this automatically)
  • Don't mix providers unnecessarily
  • Don't ignore cost alerts

Getting Help

Documentation

Support

Summary

  1. Use Supabase as your default provider
  2. Leverage Pulumi for infrastructure as code
  3. Store secrets in Doppler
  4. Start free, upgrade when needed
  5. Scale simply without complexity

When to Deviate

Only use more complex setups when you have specific requirements:

  • Enterprise compliance needs β†’ AWS/GCP
  • Database-only needs β†’ Neon
  • Existing infrastructure β†’ Keep what works

Remember: The best architecture is the one that ships fast and costs less. πŸš€