Admin Dashboard Deployment
Guide for deploying the admin dashboard to production.
Build
- Install dependencies
npm install
- Set environment variables
Create .env.production:
REACT_APP_API_URL=https://api.thepluggnamibia.com
- Build for production
npm run build
This creates an optimized production build in the build/ directory.
Deployment Options
Netlify
- Connect repository to Netlify
- Build command:
npm run build - Publish directory:
build - Add environment variables in Netlify dashboard
Vercel
- Connect repository to Vercel
- Framework preset: Create React App
- Build command:
npm run build - Output directory:
build - Add environment variables
AWS S3 + CloudFront
- Build the app
npm run build
- Upload to S3
aws s3 sync build/ s3://your-bucket-name --delete
- Configure CloudFront
- Create distribution
- Point to S3 bucket
- Configure caching
- Set up custom domain (optional)
Traditional Web Server
- Build the app
- Upload
build/directory contents to web server - Configure web server (nginx, Apache) to serve static files
- Set up routing for client-side routing
Nginx Configuration Example:
server {
listen 80;
server_name admin.thepluggnamibia.com;
root /var/www/admin/build;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
Environment Configuration
Set production API URL:
REACT_APP_API_URL=https://api.thepluggnamibia.com
Security Considerations
- HTTPS: Always use HTTPS in production
- API Key: Store API key securely, never in client code
- CORS: Configure CORS on backend to allow admin domain
- Authentication: Implement proper admin authentication
- Rate Limiting: Backend should rate limit admin API calls
Monitoring
- Set up error tracking (Sentry, etc.)
- Monitor API response times
- Track user actions (analytics)
- Set up uptime monitoring
Updates
After deploying updates:
- Clear browser cache
- Verify API endpoints are accessible
- Test critical functionality
- Monitor for errors