byuweb
v0.2.10
Published
Scaffold BYU-themed Next.js apps
Readme
BYU Web CLI
A lightweight command-line tool to scaffold BYU-themed Next.js applications with or without authentication.
🚀 Quick Start
You do not need to install this globally.
Just run:
npx byuweb@latestOr specify your app name directly:
npx byuweb@latest my-app🔧 CLI Options
You can skip prompts using flags: • --with-auth – Use the “Next.js with Auth” template • --without-auth – Use the “Next.js without Auth” template
Example usage:
npx byuweb@latest my-auth-app --with-auth
npx byuweb@latest my-basic-app --without-auth🧰 What This CLI Does • Prompts you for: • App name (or accepts it via arguments) • Template type (or uses flags) • BYU Client ID (if using Auth) • Creates a new Next.js app using one of two templates: • ✅ with-auth: BYU-themed site with NextAuth.js + BYU PKCE auth • 🚫 without-auth: Base BYU-themed Next.js template • Generates environment config files: • Optionally adds a secure AUTH_SECRET using Node’s crypto module • Installs all dependencies • Gets you up and running with npm run dev
⸻
🔐 Setting Up BYU Auth (for with-auth template)
If you choose the with-auth template (or pass --with-auth), the CLI will prompt you for your BYU OAuth Client ID.
Here’s how to get it:
- Visit https://tcm.byu.edu
- Log in with your BYU NetID
- Create a new client:
- Use “Auth Code + PKCE”
- Set the redirect URL to:
http://localhost:3000/api/auth/callback/byu-pkce
- Copy the Client ID and paste it into the CLI when prompted
- When asked if you’d like to generate an
AUTH_SECRET, you can:- Choose Yes to let the CLI generate one for you using Node’s
cryptomodule - Choose No and manually add one later to your
.envfile
- Choose Yes to let the CLI generate one for you using Node’s
🛠 Requirements • Node.js v18 or higher • npm (or compatible Node package manager)
Changing for production
Once you are ready to deploy the app to production you just need to make a few changes. First you need to change the AUTH_URL in .env to match your production site url.
Next you need to update tcm.byu.edu OAuth Client to include the hostnameurl in the redirect URLs (you can just add new and keep the localhost one) to be https://webname.byu.edu/api/auth/callback/byu-pkce
