Overview
This guide covers exporting the DPM Delivery Mobile app for web deployment using Expo and hosting it on various static hosting platforms.Prerequisites
- Node.js 18 or higher
- npm or yarn installed
- Expo CLI
- Static hosting platform account (Vercel, Netlify, AWS S3, etc.)
Web Configuration
App Configuration
The web configuration is defined inapp.json:
Output Type
- Output:
static- Generates static HTML/CSS/JS files - Favicon: Custom favicon from
./src/assets/images/favicon.png
App Metadata
- Name: dpm-parcel-delivery-app
- Slug: dpm-parcel-delivery-app
- Version: 1.0.0
- Scheme:
dpmparceldeliveryapp
Export for Web
Basic Export
Export the app for web deployment:- Builds optimized production bundles
- Generates static HTML, CSS, and JavaScript files
- Outputs to
dist/directory by default - Includes favicon and manifest files
Development Web Server
Run the web app in development mode:http://localhost:8081
Custom Output Directory
Specify a custom output directory:Production Build Options
--clear: Clear the output directory before building--output-dir: Specify output directory--dev: Create development build instead of production
Environment Variables
Setup Environment Variables
Create environment-specific files: .env.production:Access Environment Variables
In your code:Build with Environment
Load environment variables during build:Favicon and Manifest
Favicon Configuration
The favicon is configured inapp.json:
- Format: PNG or ICO
- Size: 16x16, 32x32, or 48x48 pixels (or larger, will be resized)
- Location:
./src/assets/images/favicon.png
Web Manifest
Expo automatically generates amanifest.json file with:
Custom Manifest Values
Add custom manifest configuration toapp.json:
Static Hosting Setup
Vercel Deployment
-
Install Vercel CLI:
-
Build and Deploy:
-
Configure vercel.json:
-
Add Build Script to package.json:
Netlify Deployment
-
Install Netlify CLI:
-
Create netlify.toml:
-
Deploy:
AWS S3 + CloudFront
-
Build the app:
-
Upload to S3:
-
Configure S3 bucket:
- Enable static website hosting
- Set index document:
index.html - Set error document:
index.html(for SPA routing)
-
Setup CloudFront:
- Create CloudFront distribution
- Set origin to S3 bucket
- Configure custom error responses (404 → /index.html)
- Add custom domain and SSL certificate
GitHub Pages
-
Install gh-pages:
-
Add deploy script to package.json:
-
Deploy:
Firebase Hosting
-
Install Firebase CLI:
-
Initialize Firebase:
-
Configure firebase.json:
-
Deploy:
Performance Optimization
Enable Compression
Most hosting providers automatically enable gzip/brotli compression. Verify by checking response headers:Asset Optimization
- Images are automatically optimized by Expo
- Use
expo-imagefor optimized image loading - Enable lazy loading for routes
Caching Strategy
Configure cache headers: For Vercel (vercel.json):Custom Domain Setup
Vercel Custom Domain
- Go to Vercel dashboard
- Select your project
- Go to Settings > Domains
- Add your custom domain
- Configure DNS records:
- Type: A, Name: @, Value: 76.76.21.21
- Type: CNAME, Name: www, Value: cname.vercel-dns.com
Netlify Custom Domain
- Go to Netlify dashboard
- Select your site
- Go to Domain Settings
- Add custom domain
- Configure DNS:
- Type: A, Name: @, Value: 75.2.60.5
- Type: CNAME, Name: www, Value: your-site.netlify.app
SSL Certificate
Most platforms provide automatic SSL:- Vercel: Automatic via Let’s Encrypt
- Netlify: Automatic via Let’s Encrypt
- CloudFront: Use AWS Certificate Manager
- Firebase: Automatic SSL provisioning
Monitoring and Analytics
Add Analytics
Integrate web analytics:Error Tracking
Add error tracking service:Continuous Deployment
GitHub Actions for Vercel
GitHub Actions for Netlify
Troubleshooting
Build Fails
Clear cache and rebuild:Assets Not Loading
- Verify asset paths are relative
- Check favicon path in
app.json - Ensure assets are included in bundle
- Check browser console for 404 errors
Routing Issues
- Configure hosting platform for SPA routing
- All routes should redirect to
index.html - Verify
expo-routerconfiguration
Environment Variables Not Working
- Prefix web env vars with
EXPO_PUBLIC_ - Rebuild after changing env vars
- Verify env vars in hosting platform settings
Performance Issues
- Enable compression (gzip/brotli)
- Implement code splitting
- Use lazy loading for routes
- Optimize images and assets
- Enable CDN caching
Next Steps
- Set up automated deployments
- Configure custom domain with SSL
- Implement analytics and monitoring
- Set up error tracking
- Optimize for Core Web Vitals
- Add PWA features (service workers, offline support)