This is my personal Next.js project skeleton. It is a fresh install of Next.js, with the following additions:
src
directory- Jsconfig with preset aliases for
- contexts
- components
- hooks
- public
- helpers
- Eslint preconfigured for
- Next's base ruleset
- Next's stricter core-web-vitals ruleset
- Prettier code formatting rules
- jsx-a11y's strict ruleset
- Next.js preconfigured with
- React strict mode enabled
- Locale pre-set to en-GB
- Linting on all code directories
- Webpack config set up to support symlinking local packages
- Tailwind CSS preconfigured with
- Class-based dark mode
- rjackson/rjds – my personal design system
- Pre-commit linting
- Fathon Analytics (referral URL)
- Requires
NEXT_PUBLIC_FATHOM_CUSTOM_DOMAIN
andNEXT_PUBLIC_FATHOM_TRACKING_CODE
environmental variables to be set
- Requires
TODO:
- Example consumption of api folder (react-query, swr?)
- Example pre-build script
- Example data refresh script, with (disabled-by-default) GitHub Action
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying src/pages/index.js
. The page auto-updates as you edit the file.
API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in src/pages/api/hello.js
.
The src/pages/api
directory is mapped to /api/*
. Files in this directory are treated as API routes instead of React pages.
To learn more about Next.js, 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.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!