Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

Adds authentication via OAuth providers and Stripe integration for monthly subscription payments to access premium content.

Authentication (NextAuth.js)

  • Google and GitHub OAuth providers
  • JWT session strategy with subscription status tracking
  • Custom sign-in page with provider buttons
  • Header component with auth status, avatar, and premium badge

Stripe Payments

  • Monthly subscription checkout ($9.99/month)
  • Webhook handler for subscription lifecycle events (checkout.session.completed, customer.subscription.updated/deleted, invoice.payment_failed)
  • Customer portal for subscription management
  • Test card numbers displayed on subscription page for development

Configuration

  • .env.example template with all required variables
  • Updated SETUP.md with OAuth and Stripe setup instructions
  • next.config.ts updated to support API routes (static export disables auth/payments)
# Required environment variables
NEXTAUTH_SECRET=...
GOOGLE_CLIENT_ID=... / GITHUB_ID=...
STRIPE_SECRET_KEY=...
STRIPE_MONTHLY_PRICE_ID=...

Note: Subscription data uses in-memory storage for demo purposes. Replace with database for production.

GitHub Pages Deployment

Created a custom build script (scripts/build-github-pages.sh) that enables GitHub Pages deployment with static export:

  • Temporarily excludes API routes during static export build (incompatible with static sites)
  • Sets DEPLOY_ENV=github-pages environment variable to enable static export mode
  • Restores API routes after build completes
  • GitHub Actions workflow configured to use this script for automated deployments

This allows the site to be deployed to GitHub Pages (without auth/payment features) while maintaining full functionality when deployed to platforms supporting Next.js API routes (Vercel, Netlify, etc.).

Screenshots

Sign In Subscription Test Cards

[!WARNING]

Original prompt

This section details on the original issue you should resolve

<issue_title>Create auth layer + connect to Stripe for payments</issue_title>
<issue_description>- Login with Google or GitHub

  • Connection to Stripe to collect payment (monthly subscription to access reponses to questions)
  • Make Stripe integration testable with a fake card number in test mode somehow</issue_description>

Comments on the Issue (you are @copilot in this section)


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

Copilot AI changed the title [WIP] Add authentication layer and Stripe payment connection Add auth layer with Google/GitHub OAuth and Stripe subscription payments Dec 3, 2025
Copilot AI requested a review from mbianchidev December 3, 2025 16:58
@mbianchidev
Copy link
Owner

@copilot ensure that Actions deploys with the environment set as github-pages

Copy link
Contributor Author

Copilot AI commented Dec 13, 2025

@copilot ensure that Actions deploys with the environment set as github-pages

Updated in commit 4625f1a. Created a build script that sets DEPLOY_ENV=github-pages and temporarily excludes API routes during static export build. The workflow now uses scripts/build-github-pages.sh which enables static export mode while preserving auth/payment functionality for non-static deployments.

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.

Create auth layer + connect to Stripe for payments

2 participants