Skip to content

Convert deployment from Vercel to GitHub Pages static export#3

Merged
AshenWijesingha merged 2 commits into
mainfrom
copilot/fix-issues-and-deploy-web-page
Mar 15, 2026
Merged

Convert deployment from Vercel to GitHub Pages static export#3
AshenWijesingha merged 2 commits into
mainfrom
copilot/fix-issues-and-deploy-web-page

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 15, 2026

Next.js app was configured for Vercel deployment with API routes and dynamic server-side rendering — incompatible with GitHub Pages. Converts the entire app to a fully client-side static export.

Static export configuration (next.config.ts)

  • output: "export", trailingSlash: true, images.unoptimized: true
  • basePath/assetPrefix driven by NEXT_PUBLIC_BASE_PATH env var

Eliminate server-side dependencies

  • Removed src/app/api/create-doc/route.ts — API routes don't work in static export. Document creation now writes directly to Firestore from the client in page.tsx.
  • Replaced Buffer with btoa/atob in encryption.tsBuffer is Node-only.

Restructure dynamic route to query params

Dynamic doc/[id]/page.tsx requires generateStaticParams in static export, which is impossible for arbitrary doc IDs. Replaced with doc/page.tsx using useSearchParams():

# Before (server-rendered dynamic route)
/doc/abc123

# After (static page + client-side fetch)
/doc/?id=abc123

The viewer component (DocumentViewer.tsx) and not-found view (NotFoundView.tsx) are now pure client components — no notFound() server function.

GitHub Pages workflow (.github/workflows/nextjs.yml)

  • Replaced Vercel CLI deploy with actions/upload-pages-artifact@v3 + actions/deploy-pages@v4
  • Requires Settings → Pages → Source: GitHub Actions to be enabled on the repo

ESLint fixes

  • Fixed react-hooks/set-state-in-effect error by initializing state from searchParams directly instead of setting it in useEffect
  • Removed unused docId prop from DocumentViewer

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/SecureDoc-Portal/SecureDoc-Portal/node_modules/.bin/next build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Configure next.config.ts for static export (output: 'export', basePath, trailingSlash)
- Replace Node.js Buffer API with browser-compatible btoa/atob in encryption.ts
- Move document creation logic from API route to client-side Firebase operations
- Restructure doc viewer from dynamic route [id] to query params (?id=)
- Replace Vercel deployment workflow with GitHub Pages deployment workflow
- Fix ESLint error (setState in effect) and remove unused docId parameter
- Update README.md with GitHub Pages deployment instructions

Co-authored-by: AshenWijesingha <66056859+AshenWijesingha@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues and deploy web page on GitHub Pages Convert deployment from Vercel to GitHub Pages static export Mar 15, 2026
Copilot AI requested a review from AshenWijesingha March 15, 2026 17:40
@AshenWijesingha
Copy link
Copy Markdown
Member

Required Secrets for Deployment:
VERCEL_TOKEN
VERCEL_ORG_ID
VERCEL_PROJECT_ID
Required Environment Variable:
NEXT_PUBLIC_BASE_URL (Vercel project variable)
Manual deployment instructions using Vercel CLI

Instead of using vercel, please develop this completely hosted within GitHub Pages. @copilot

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 15, 2026

Required Secrets for Deployment:
VERCEL_TOKEN
VERCEL_ORG_ID
...

This is already done in commit 6dfa9be. The entire Vercel deployment has been removed and replaced with GitHub Pages:

  • Workflow uses actions/upload-pages-artifact@v3 + actions/deploy-pages@v4 — no Vercel secrets/CLI needed
  • next.config.ts set to output: "export" with basePath/assetPrefix for GitHub Pages
  • API routes removed — all Firebase operations are client-side
  • README updated with GitHub Pages setup instructions (Settings → Pages → GitHub Actions)
  • CI passed on this branch

To complete setup: go to Settings → Pages and select GitHub Actions as the source, then merge to main.

@AshenWijesingha AshenWijesingha marked this pull request as ready for review March 15, 2026 17:47
@AshenWijesingha AshenWijesingha merged commit 35e3505 into main Mar 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants