Netlify hosted, Next.js built, Storyblok headless CMS site for giving.stanford.edu.
- Next.js 16.0.7 with App Router and React Server Components
- React 19.2 with latest concurrent features
- Storyblok headless CMS for content management
- Netlify hosting with static generation and atomic deployments
- TypeScript in strict mode
- TailwindCSS with Stanford Decanter design system
You can find Architectural Decision Records and more documentation in the docs & docs/adr directories.
For more information on what the environment variables are and do see: Environment Vars
Development
- Create a new
.envfile by cloning theexample.envfile provided:cp example.env .env - Manually find and add the
VAULT_ROLE_IDandVAULT_ROLE_IDto.env. You can likely find those values in the Netlify environment variables UI. Or, you can retrieve theVAULT_ROLE_IDandVAULT_ROLE_IDby first runningnetlify loginthennetlify link, then use thenetlify env:get VAR_NAMEcommand. After that manually add them to.envIf you can't find them, please ask another developer on the team. - After the
VAULT_ROLE_IDandVAULT_SECRET_IDenvironment variables have been added to .env, retrieve all other environment variables from the vault:npm run vault:local - Install packages using
npm ciornpm install - Then fire up your development server using Next.js
npm run dev
We use the netlify-plugin-vault-variables to fetch the correct environment variables from the vault. For more information, please see: https://github.com/SU-SWS/netlify-plugin-vault-variables/#environment-variable-strategy-with-vault
Currently Storyblok v2 doesn't allow accessing the environment with http, so to make it work, https has to be added to localhost. For your convenience we have created the certificate and key but your system may not trust this self signed cert. Once you have localhost up and running you can visit the url in the browser and proceed past the warning or you can add the certificate to your trusted list.
OSX: https://readwriteexercise.com/posts/trust-self-signed-certificates-macos/
To start:
-
Enter
nvm usein the terminal to ensure that you are using the node version specified in .nvmrc. -
Do
npm run devin the same terminal. You'll be able to view the development build in your browser at http://localhost:3000/ -
In another terminal, do
npm run https-proxy-start -
After that, you can go back to Storyblok and select the https://localhost:3010 URL in the visual editor. When you're doing this for the first time, you'll have to click the "Preview" button to pop the preview into its own tab out of the iframe and click past the browser warning to proceed to view the site.
-
You can now go back to the Storyblok visual editor and hit the reload icon button (curved arrow) and preview the site in the visual editor iframe.
To protect unpublished content, all the previews are currently for authenticated users only. Please contact the admin of this repo for login information.
We use the default Next.js eslint-config-next with the core web vitals rule set as our linting configuration.
To run ESLint:
npm run lintto check your .js, .jsx, .ts and .tsx files for warnings and errors.npm run lint:fixto fix any fixable issues and displays the ones that need to be manually fixed.
To run type heck:
npm run typecheckornpm run tscwill check for any typescript errors.
All the React components in this projects can be found under the /components directory. Components that are connected to Storyblok are in the subdirectory `/components/Storyblok'.
We installed the official TailwindCSS container query plugin, but due to no support for Safari version 15 and earlier, please only use it for progressive enhancement.
You can find details on the rendering and caching strategy for this site on Netlify using Storyblok in Google Drive.
- Create branch from
dev(or commit ref fromdev) withrelease/prefix (e.g.release/v2.0.1) - Create a pull request from your
release/v2.0.1branch intomain - Add the appropriate semver label to your PR. Availabel labels:
patch,minor,major,rc,alpha,beta - On PR approval, do a standard merge commit (not a squash commit) into
main
Merges to main will kickoff the following tasks:
- Semver version bump
- Publish github release
- Netlify production build and deploy
- Merge changes back into
dev