Overview
Sociales is configured for automated deployment to GitHub Pages using thegh-pages package. This guide covers the complete deployment process.
Prerequisites
- Git repository initialized
- GitHub account with repository access
- Node.js and npm installed
- Firebase configured (see Firebase Setup)
Deployment Configuration
Package.json Scripts
The project includes automated deployment scripts:Key Configuration Points
- homepage - Defines the base URL for GitHub Pages
- predeploy - Automatically runs build before deployment
- deploy - Publishes the
distfolder to thegh-pagesbranch
Vite Configuration
Thevite.config.js sets the base path for GitHub Pages:
Initial Setup
Deploying to GitHub Pages
Build the application
Test the production build locally:This creates an optimized production build in the
dist folder.Preview the build
Verify the build works correctly:Open the provided URL to test the production build locally.
Deploy to GitHub Pages
Run the deploy command:This command:
- Runs
npm run buildautomatically (viapredeploy) - Creates or updates the
gh-pagesbranch - Pushes the
distfolder contents to that branch
Enable GitHub Pages
If this is your first deployment:
- Go to your GitHub repository
- Navigate to Settings > Pages
- Under Source, select Deploy from a branch
- Select gh-pages branch and / (root) folder
- Click Save
Deployment Workflow
The automated deployment process:Continuous Deployment
For automated deployments on every push, you can set up GitHub Actions:Create GitHub Actions Workflow
Create.github/workflows/deploy.yml:
main branch.
Environment Variables for Production
For Firebase configuration and other secrets:Set up repository secrets
- Go to your GitHub repository
- Navigate to Settings > Secrets and variables > Actions
- Click New repository secret
- Add each Firebase configuration value:
VITE_FIREBASE_API_KEYVITE_FIREBASE_AUTH_DOMAINVITE_FIREBASE_PROJECT_ID- etc.
Troubleshooting
Blank page after deployment
Cause: Base path mismatch Solution:- Verify
baseinvite.config.jsmatches your repo name - Check
homepageinpackage.jsonis correct - Rebuild and redeploy:
npm run deploy
404 errors on page refresh
Cause: GitHub Pages doesn’t support client-side routing Solution: Ensure you’re usingHashRouter instead of BrowserRouter in src/main.jsx.
Assets not loading
Cause: Incorrect base path for assets Solution:- Check that
base: '/your-repo/'is set invite.config.js - Ensure the base path ends with a
/ - Rebuild:
npm run build && npm run deploy
Firebase authentication not working in production
Cause: Domain not authorized in Firebase Solution:- Go to Firebase Console > Authentication > Settings
- Add
username.github.ioto Authorized domains - Wait a few minutes for changes to propagate
”gh-pages not found” error
Cause: Package not installed Solution:Manual Deployment
If you prefer manual control:Using
npm run deploy is recommended as it handles all these steps automatically.Deployment Checklist
Before deploying to production:- Firebase configuration is correct and uses environment variables
- All authorized domains are added in Firebase Console
-
homepageinpackage.jsonmatches your GitHub Pages URL -
baseinvite.config.jsmatches your repository name - HashRouter is used for routing
- Application builds successfully:
npm run build - Preview works correctly:
npm run preview - No sensitive data committed to repository
- GitHub Pages is enabled in repository settings
Monitoring Deployments
GitHub Actions
If using automated deployments:- Go to the Actions tab in your repository
- View deployment logs for each workflow run
- Check for errors or warnings
GitHub Pages Status
- Go to Settings > Pages
- View the current deployment status
- See the live URL and last deployment time
Next Steps
- Configure Firebase authentication
- Review the technical architecture
- Set up custom domain (optional)
- Configure Google Analytics for usage tracking