This is a Next.js project bootstrapped with create-next-app
and modified with some useful utilities, components, and settings that we (Input Logic) often need.
Start by creating a .env.local
file in the project root. You can use the 1Password Generator to create a random session secret easily.
NEXT_PUBLIC_ENV=dev
API_URL=http://localhost:8000 or http://localhost:8000/api depending on your setup
SESSION_SECRET=[RANDOM-32-CHARACTER-STRING]
Now install and run the project:
npm install
npm run dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying pages/index.js
. The page auto-updates as you edit the file.
Now that your frontend is running, you'll need an API. For a local development API, setup the Ninja Starter.
If you'd like to skip this step, simply update your .env.local
file to point to our staging API on Heroku:
API_URL=https://ninja-starter-9ee94834650e.herokuapp.com
To learn more, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API
- Learn Next.js - an interactive Next.js tutorial
- React useState - learn about the useState hook in React
- React useEffect - learn about the useEffect hook in React
Next Starter supports Storybook, a component documentation tool. Adding stories for components is entirely optional, but it is encouraged for any components that are reused in many locations.
run storybook:
npm run storybook
see https://storybook.js.org/ for more info.