Appearance
Deployment
Deploy your Mini App to make it accessible in MiniPay. This guide covers deployment requirements, build configuration, and how to verify your deployment.
Requirements
HTTPS Required
MiniPay requires all Mini Apps to be served over HTTPS. Your deployment must:
- ✅ Use HTTPS (not HTTP)
- ✅ Have a valid SSL certificate
- ✅ Be publicly accessible
CORS Configuration
If your app makes API calls, ensure CORS is properly configured:
javascript
// Example CORS headers (adjust for your server)
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-TypeBuild Configuration
Vite
For Vite projects, ensure your build is configured correctly:
ts
// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
build: {
outDir: "dist",
sourcemap: false, // Set true only if you use error reporting (e.g. Sentry) that needs source maps; otherwise keeps builds smaller and avoids exposing source
},
});Build your app:
bash
npm run buildEnvironment Variables
Set environment variables for your deployment:
bash
# Production
VITE_API_URL=https://api.example.com
VITE_CHAIN_ID=42220Access in your app:
ts
const apiUrl = import.meta.env.VITE_API_URL;Testing Your Deployment
- Test HTTPS: Verify your app loads over HTTPS
- Test in MiniPay: Use Developer Mode to load your deployed URL
- Test wallet connection: Ensure auto-connect works
- Test transactions: Verify transactions work on the deployed version
Performance Optimization
Optimize your deployment for performance:
- Enable compression: Gzip/Brotli compression
- Cache static assets: Set appropriate cache headers
- Minify code: Ensure build process minifies JavaScript/CSS
- Optimize images: Compress and optimize images
- Code splitting: Use dynamic imports for code splitting
Security Considerations
- Environment variables: Never commit secrets to your repository
- HTTPS only: Ensure all traffic uses HTTPS
- Content Security Policy: Configure CSP headers if needed
- Dependencies: Keep dependencies up to date
Troubleshooting
App not loading in MiniPay
- ✅ Check HTTPS is enabled
- ✅ Verify URL is publicly accessible
- ✅ Check browser console for errors
- ✅ Ensure CORS is configured correctly
Build errors
- ✅ Check Node.js version matches requirements
- ✅ Verify all dependencies are installed
- ✅ Check build configuration
- ✅ Review build logs for specific errors
Environment variables not working
- ✅ Use the same
VITE_prefix as in Environment variables above (if using Vite) - ✅ Rebuild after changing environment variables
- ✅ Check hosting provider's environment variable configuration
Next Steps
- Test your deployment in MiniPay Developer Mode
- Submit your Mini App for listing
- Review best practices for production apps