Skip to content

Commit cb680b7

Browse files
committed
initial commit
1 parent cf92820 commit cb680b7

21 files changed

+647
-63
lines changed

example/.gitignore

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,23 @@
1-
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2-
3-
# dependencies
41
node_modules/
5-
6-
# Expo
72
.expo/
83
dist/
9-
web-build/
10-
11-
# Native
12-
*.orig.*
4+
npm-debug.*
135
*.jks
146
*.p8
157
*.p12
168
*.key
179
*.mobileprovision
18-
19-
# Metro
20-
.metro-health-check*
21-
22-
# debug
23-
npm-debug.*
24-
yarn-debug.*
25-
yarn-error.*
10+
*.orig.*
11+
web-build/
2612

2713
# macOS
2814
.DS_Store
29-
*.pem
3015

31-
# local env files
32-
.env*.local
16+
# Temporary files
17+
*.cache
18+
.metro-bundler-cache-*
19+
.metro-bundler-info
3320

34-
# typescript
35-
*.tsbuildinfo
21+
# Environment
22+
.env
23+
.env.local

example/.npmrc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
engine-strict=false
2-
fund=false
3-
audit=false
4-
update-notifier=false
1+
registry=https://registry.npmjs.org/

example/README-DEPLOYMENT.md

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# Deploying to Vercel (Free Tier)
2+
3+
This guide shows you how to deploy the Cloudinary React Native example app to Vercel's free tier.
4+
5+
## 🚀 Quick Deployment Steps
6+
7+
### 1. Push to GitHub (if not already done)
8+
9+
```bash
10+
git add .
11+
git commit -m "Prepare for Vercel deployment"
12+
git push
13+
```
14+
15+
### 2. Deploy to Vercel
16+
17+
**Option A: Deploy via Vercel Dashboard (Easiest)**
18+
19+
1. Go to [vercel.com](https://vercel.com)
20+
2. Sign in with GitHub
21+
3. Click "Add New" → "Project"
22+
4. Import your repository
23+
5. Configure the project:
24+
- **Root Directory:** `example`
25+
- **Build Command:** `npx expo export --platform web`
26+
- **Output Directory:** `dist`
27+
6. Click "Deploy"
28+
7. Done! Your app will be live at `https://your-project.vercel.app`
29+
30+
**Option B: Deploy via Vercel CLI**
31+
32+
```bash
33+
# Install Vercel CLI
34+
npm install -g vercel
35+
36+
# Login
37+
vercel login
38+
39+
# Deploy from the example directory
40+
cd example
41+
vercel
42+
43+
# Follow the prompts - defaults should work fine
44+
```
45+
46+
### 3. Access Your App
47+
48+
After deployment completes, Vercel will provide you with a URL like:
49+
- Production: `https://your-project.vercel.app`
50+
- Preview URLs for each PR/commit
51+
52+
Share this URL with anyone - they can access it from anywhere!
53+
54+
---
55+
56+
## 📝 Configuration
57+
58+
The `vercel.json` file in the example directory already contains the correct configuration:
59+
60+
```json
61+
{
62+
"buildCommand": "npm install && npx expo export --platform web",
63+
"outputDirectory": "dist",
64+
"devCommand": "npx expo start --web",
65+
"cleanUrls": true,
66+
"trailingSlash": false,
67+
"rewrites": [
68+
{
69+
"source": "/(.*)",
70+
"destination": "/index.html"
71+
}
72+
]
73+
}
74+
```
75+
76+
This handles:
77+
- Building the Expo web app
78+
- Routing (all routes go to index.html for SPA behavior)
79+
- Clean URLs
80+
81+
---
82+
83+
## 🧪 Test Locally Before Deploying
84+
85+
```bash
86+
# Navigate to example directory
87+
cd example
88+
89+
# Build the web version
90+
npx expo export --platform web
91+
92+
# Serve it locally to test
93+
npx serve dist -p 3000
94+
```
95+
96+
Then visit `http://localhost:3000` to test before deploying.
97+
98+
---
99+
100+
## 🎯 Vercel Free Tier Benefits
101+
102+
**Unlimited bandwidth**
103+
**Automatic HTTPS**
104+
**Global CDN (Edge Network)**
105+
**Automatic deployments** from Git
106+
**Preview URLs** for each PR
107+
**Custom domains** (free)
108+
**100GB bandwidth/month**
109+
**No credit card required**
110+
111+
---
112+
113+
## 🔧 Advanced Configuration
114+
115+
### Custom Domain
116+
117+
1. Go to your project in Vercel dashboard
118+
2. Click "Settings" → "Domains"
119+
3. Add your custom domain
120+
4. Follow DNS instructions
121+
5. Done! Your app will be at `https://yourdomain.com`
122+
123+
### Environment Variables
124+
125+
If your app needs environment variables:
126+
127+
1. Go to "Settings" → "Environment Variables"
128+
2. Add your variables (e.g., `CLOUDINARY_CLOUD_NAME`)
129+
3. Redeploy
130+
131+
### Automatic Deployments
132+
133+
Vercel automatically:
134+
- Deploys **production** when you push to `main` branch
135+
- Creates **preview** deployments for every PR/branch
136+
137+
---
138+
139+
## 🐛 Troubleshooting
140+
141+
### Build Fails
142+
143+
**Issue:** "Module not found" errors
144+
**Solution:** Make sure the parent package is built first. You might need to adjust the build command:
145+
146+
```json
147+
{
148+
"buildCommand": "cd .. && npm install && npm run build && cd example && npm install && npx expo export --platform web"
149+
}
150+
```
151+
152+
### Blank Screen After Deploy
153+
154+
**Issue:** App loads but shows blank screen
155+
**Solution:** Check browser console for errors. Usually routing-related - the `vercel.json` rewrites should handle this.
156+
157+
### Large Bundle Size Warning
158+
159+
**Issue:** Vercel warns about bundle size
160+
**Solution:** This is normal for React Native Web apps. The free tier can handle it.
161+
162+
---
163+
164+
## 📱 Testing on Mobile
165+
166+
Once deployed, you can test on any device:
167+
1. Open the Vercel URL on your phone's browser
168+
2. The app should work just like a native app
169+
3. You can even add it to your home screen (PWA-style)
170+
171+
---
172+
173+
## 🔄 Updating Your Deployment
174+
175+
Just push to your Git repository:
176+
177+
```bash
178+
git add .
179+
git commit -m "Update app"
180+
git push
181+
```
182+
183+
Vercel will automatically rebuild and deploy! 🎉
184+
185+
---
186+
187+
## 📊 Monitoring
188+
189+
Vercel provides:
190+
- Real-time deployment logs
191+
- Analytics (views, performance)
192+
- Error tracking
193+
- Performance insights
194+
195+
Access these in your Vercel dashboard.
196+
197+
---
198+
199+
## 💡 Tips
200+
201+
1. **Use branches for testing:** Push to a feature branch to get a preview URL before merging to main
202+
2. **Add protection:** Enable "Vercel Authentication" in settings to password-protect your app
203+
3. **Speed up builds:** Add a `.vercelignore` file to exclude unnecessary files
204+
4. **Check logs:** If something goes wrong, check the deployment logs in the Vercel dashboard
205+
206+
---
207+
208+
## 🆘 Need Help?
209+
210+
- [Vercel Documentation](https://vercel.com/docs)
211+
- [Expo Web Documentation](https://docs.expo.dev/workflow/web/)
212+
- Check deployment logs in Vercel dashboard

0 commit comments

Comments
 (0)