Lý thuyết
30 phút
Bài 13/15

Deployment & Hosting

Deploy và host AI applications với custom domains

🚀 Deployment & Hosting

Deploy AI app của bạn lên production.

Deployment Options

Platform Comparison

Text
1┌─────────────┬───────────────┬───────────────┐
2│ Platform │ Hosting │ Custom Domain │
3├─────────────┼───────────────┼───────────────┤
4│ Bubble │ Built-in │ Yes (paid) │
5│ Glide │ Built-in │ Pro plan │
6│ FlutterFlow │ Firebase/AWS │ Yes │
7│ Softr │ Built-in │ Yes (paid) │
8└─────────────┴───────────────┴───────────────┘

Bubble Deployment

Development vs Production

Text
1Bubble has 2 versions:
2
3Development (free subdomain):
4- yourapp.bubbleapps.io/version-test
5- For testing
6- Not indexed
7
8Production (live):
9- yourapp.bubbleapps.io (or custom domain)
10- Public access
11- SEO indexed

Deploy to Live

Text
1Steps:
21. Go to Deployment tab
32. Click "Deploy to Live"
43. Review changes
54. Confirm deployment
65. App is now live!

Version Control

Text
1Bubble versions:
2- Save current as named version
3- Roll back if issues
4- Compare versions
5- Restore previous states

Custom Domain Setup

Buy Domain

Text
1Domain providers:
2- Namecheap
3- GoDaddy
4- Google Domains
5- Cloudflare
6
7Choose:
8- .com for business
9- .ai for AI products
10- .app for applications

DNS Configuration

Text
1In your DNS provider:
2
3For root domain (yourdomain.com):
4- Type: A
5- Host: @
6- Value: Bubble's IP
7
8For www:
9- Type: CNAME
10- Host: www
11- Value: yourapp.bubbleapps.io

Bubble Custom Domain

Text
1In Bubble:
21. Settings → Domain/Email
32. Enter your domain
43. Verify DNS settings
54. Enable HTTPS
65. Wait for propagation (up to 48h)

SSL/HTTPS

Why HTTPS?

Text
1Required for:
2- Security (encrypted traffic)
3- User trust
4- SEO ranking
5- API calls
6- Payment processing

Bubble SSL

Text
1Bubble includes free SSL:
21. Custom domain configured
32. SSL auto-enabled
43. Redirects HTTP → HTTPS

Environment Variables

API Keys Management

Never Expose API Keys
Text
1Development keys:
2- Can be less secure
3- Lower rate limits
4
5Production keys:
6- Secure and protected
7- Higher rate limits
8- Different billing

Bubble API Keys

Text
1Settings → API:
2- Development key
3- Live key (different!)
4
5Switch automatically based on version

App Settings per Environment

Text
1Use Option Sets or Settings:
2
3Setting: openai_api_key
4- Dev value: sk-dev-xxx
5- Live value: sk-live-xxx
6
7Reference: Get setting's value

Performance Optimization

Page Load Speed

Text
1Optimize:
21. Minimize workflows on load
32. Lazy load images
43. Optimize repeating groups
54. Use pagination
65. Compress assets

Database Queries

Text
1Best practices:
21. Add constraints to searches
32. Use indexes effectively
43. Avoid unnecessary "Do a search"
54. Cache frequent queries

API Call Optimization

Text
1For AI features:
21. Implement caching
32. Use appropriate model sizes
43. Limit context length
54. Batch requests when possible

SEO Setup

Basic SEO

Text
1Settings → SEO / metatags:
2
3- App title
4- Description
5- Keywords
6- OG image (for social sharing)
7- Favicon

Page-Level SEO

Text
1Each page:
2- Unique title
3- Meta description
4- OG tags
5- Structured data (if needed)

Sitemap

Text
1Bubble auto-generates sitemap:
2- yourapp.com/sitemap.xml
3- Submit to Google Search Console

Analytics

Google Analytics

Text
1Setup:
21. Create GA4 property
32. Get Measurement ID (G-xxx)
43. Bubble Settings → SEO
54. Add GA ID
65. Or use plugin for more control

Tracking Events

Text
1Track important actions:
2- Sign ups
3- Upgrades
4- AI generations
5- Feature usage
6
7Use: Google Analytics plugin
8Custom events in workflows

Error Monitoring

Track Errors

Text
1Monitor production errors:
2- Server logs in Bubble
3- Third-party: Sentry, LogRocket
4- Set up alerts

Error Alerts

Text
1Get notified when:
2- API calls fail
3- Payments fail
4- High error rate
5- Performance drops

Security Checklist

Security Before Launch
Text
1☐ Privacy rules configured
2☐ API keys not exposed
3☐ User data protected
4☐ Payment integration tested
5☐ Rate limiting enabled
6☐ Input validation
7☐ XSS prevention
8☐ HTTPS enforced

Pre-Launch Checklist

Before Going Live
Text
1Functionality:
2☐ All features work
3☐ Forms submit correctly
4☐ Payments process
5☐ Emails send
6☐ AI features respond
7
8Performance:
9☐ Page loads < 3s
10☐ Mobile responsive
11☐ No console errors
12☐ Images optimized
13
14Content:
15☐ Terms of Service
16☐ Privacy Policy
17☐ Contact information
18☐ Help/FAQ page
19
20Technical:
21☐ Custom domain working
22☐ SSL certificate active
23☐ Analytics installed
24☐ Error monitoring set up
25☐ Backups configured

Scaling Considerations

Bubble Plans

Text
1Choose plan based on:
2- Number of users
3- Workflow runs
4- Database size
5- Server capacity
6
7Free: Learning/testing
8Starter: Small apps
9Growth: Production apps
10Team/Professional: High-traffic

When to Scale

Text
1Upgrade when:
2- Slow page loads
3- Workflow limits hit
4- Database growing
5- More capacity needed

Backup Strategy

Database Backups

Text
1Bubble includes:
2- Automatic backups
3- Point-in-time recovery
4- Manual backup option
5
6Best practice:
7- Regular exports
8- External backup storage
9- Test restoration

Maintenance Mode

Enable Maintenance

Text
1When doing major updates:
21. Enable maintenance mode
32. Show "Under Maintenance" page
43. Make changes
54. Test
65. Disable maintenance mode

Bài Tập

Deploy Your App

Complete deployment:

  1. Test all features thoroughly
  2. Configure custom domain
  3. Set up SSL
  4. Add analytics
  5. Create error monitoring
  6. Complete pre-launch checklist
  7. Deploy to live
  8. Verify everything works

Tiếp theo: Bài 14 - Monetization Strategies