This document outlines the deployment process for CodeStorm Hub using GitHub Pages with the official Next.js deployment workflow.
CodeStorm Hub is deployed using GitHub Pages with Next.js static export functionality. The deployment process is fully automated through GitHub Actions using the official Next.js workflow template.
- Framework: Next.js 15 with static export (
output: 'export') - Deployment Platform: GitHub Pages
- Automation: GitHub Actions workflow (official Next.js template)
- Branch:
main(production deployment) - Build Output: Static HTML/CSS/JS files in
/outdirectory
The application is configured for static export with GitHub Pages compatibility:
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
// Enable static export for GitHub Pages
output: "export",
// Disable trailing slash for better GitHub Pages compatibility
trailingSlash: false,
// Configure images for static export
images: {
unoptimized: true,
remotePatterns: [
{
protocol: "https",
hostname: "github.com",
pathname: "/CodeStorm-Hub/**",
},
],
},
};
export default nextConfig;Uses the official Next.js workflow template with:
- Automatic package manager detection (npm/yarn)
- Smart caching for faster builds
- Built-in Next.js configuration inference
- Proper permissions and concurrency handling
- Deployment to GitHub Pages using official actions
Ensure the following GitHub repository settings are configured:
- Navigate to Settings → Pages
- Source: GitHub Actions
- The workflow will automatically create deployments
- Navigate to Settings → Actions → General
- Ensure "Allow all actions and reusable workflows" is selected
- Under "Workflow permissions", select "Read and write permissions"
- Trigger: Push changes to the
mainbranch - Build: GitHub Actions runs the Next.js build process
- Export: Next.js generates static files in
/outdirectory - Deploy: Files are deployed to GitHub Pages automatically
- Live: Site is available at the GitHub Pages URL
You can manually trigger deployment:
- Go to the repository's Actions tab
- Select "Deploy Next.js site to Pages" workflow
- Click "Run workflow" on the main branch
To test the build locally:
# Install dependencies
npm install
# Development server
npm run dev
# Production build (same as CI)
npm run build
# Serve the static files (optional)
npx serve outA separate CI workflow (.github/workflows/ci.yml) runs on all pushes and pull requests to:
- Lint the codebase
- Run type checking
- Test builds across multiple Node.js versions (18, 20, 22)
- Package manager detection (npm/yarn)
- Next.js configuration inference
- Smart caching for faster builds
- Proper GITHUB_TOKEN permissions
- Concurrency control to prevent conflicts
- Optimized build caching
- Static file generation for fast loading
- Clear build logs in Actions tab
- Deployment status tracking
- Error reporting and debugging
-
Build Fails
- Check the Actions tab for detailed error logs
- Ensure all dependencies are properly listed in
package.json - Verify TypeScript compilation passes locally with
npx tsc --noEmit
-
Deployment Fails
- Verify repository Pages settings are configured for "GitHub Actions" source
- Check that workflow permissions are set correctly
- Ensure the workflow has proper
pages: writeandid-token: writepermissions
-
404 Errors
- Verify all pages are properly exported as static files
- Check that Next.js routing is compatible with static export
- The 404.html page is automatically generated for fallback routing
After deployment, verify:
- Site loads at the GitHub Pages URL
- All pages are accessible and properly rendered
- Images and assets load correctly
- Navigation works properly
- No console errors in browser developer tools
- Responsive design works across devices
Regular maintenance tasks:
- Monitor GitHub Actions workflow runs
- Keep dependencies updated
- Review build performance and optimize as needed
- Test deployment after major Next.js or dependency updates
To use a custom domain:
- Add a
CNAMEfile to the repository root with your domain - Configure DNS records with your domain provider
- Update the domain in repository Pages settings
- GitHub Pages will automatically handle HTTPS certificates
For questions or issues with deployment, please refer to the GitHub Pages documentation or Next.js deployment documentation.