This guide will walk you through deploying your full-stack Rent Management System to Vercel.
- Vercel Account: Sign up at vercel.com
- GitHub Repository: Your code should be in a GitHub repository
- Supabase Project: Have your Supabase database ready with credentials
Ensure all the deployment files are committed:
git add .
git commit -m "feat: Add Vercel deployment configuration"
git push origin main- Go to vercel.com/dashboard
- Click "New Project"
- Import your GitHub repository
- Vercel will detect it as a Node.js project
# Install Vercel CLI globally
npm install -g vercel
# Login to Vercel
vercel login
# Deploy from your project directory
cd /path/to/Rent-Management-System
vercel --prodIn your Vercel dashboard, go to Project Settings → Environment Variables and add:
SUPABASE_URL=https://your-project-id.supabase.co
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
SUPABASE_JWT_SECRET=your_supabase_jwt_secret
NODE_ENV=production
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_email_app_password
PESAPAL_CONSUMER_KEY=your_pesapal_consumer_key
PESAPAL_CONSUMER_SECRET=your_pesapal_consumer_secret
PESAPAL_BASE_URL=https://cybqa.pesapal.com/pesapalv3
SMS_PROVIDER=africastalking
AT_USERNAME=your_africastalking_username
AT_API_KEY=your_africastalking_api_key
AT_SENDER_ID=your_approved_sender_id
- Custom Domain (Optional): In Vercel dashboard → Domains, add your custom domain
- Default URL: Vercel provides a URL like
https://rent-management-system.vercel.app
Ensure your Supabase database is properly configured:
- Row Level Security (RLS): Enable RLS on all tables
- Policies: Set up proper security policies for your tables
- API Keys: Use the Service Role key for server-side operations
- Visit your Vercel URL
- Test the main functionality:
- User authentication
- Property management
- Tenant management
- Payment recording
- Build Errors: Check Vercel build logs for specific error messages
- Environment Variables: Ensure all required env vars are set in Vercel
- Database Connection: Verify Supabase credentials and network access
- API Routes: Check that serverless functions are working at
/api/*
- Check Logs: Vercel → Functions tab shows runtime logs
- Test API: Visit
https://your-app.vercel.app/api/healthfor health check - Build Locally: Run
npm run build:vercelto test build process
- Code Splitting: The build shows chunks > 500KB - consider dynamic imports
- Image Optimization: Use Vercel's Image component for better performance
- Caching: Implement proper caching strategies for API responses
// Instead of direct imports
import { SomeComponent } from './components/SomeComponent';
// Use dynamic imports
const SomeComponent = lazy(() => import('./components/SomeComponent'));- Environment Variables: Never commit
.envfiles - Security: Review all API endpoints for proper authentication
- Monitoring: Set up error tracking (Sentry, etc.)
- Backups: Ensure regular Supabase backups are configured
If you encounter issues:
- Check Vercel documentation: vercel.com/docs
- Review build logs in Vercel dashboard
- Test locally with production environment variables
- ✅ Frontend build configured and working
- ✅ Basic serverless API health check
⚠️ Full API integration requires additional setup- ✅ Environment variables configured
- ✅ Build process optimized
The current setup provides a basic API health check. For full backend functionality, you have several options:
Convert your Express routes to individual Vercel API routes:
api/
auth/
login.js
user.js
tenants/
index.js
[id].js
properties/
index.js
[id].js
payments/
index.js
- Railway: Excellent for full Express.js apps
- Render: Great for full-stack Node.js applications
- DigitalOcean App Platform: Supports both frontend and backend
Adapt the Express server to work with Vercel's serverless functions by restructuring routes.
After deployment, visit:
- Frontend:
https://your-app.vercel.app - API Health:
https://your-app.vercel.app/api/health
Note: The current deployment focuses on getting the frontend live quickly. The API placeholder provides a foundation for further backend integration.