Every time I create a NextJS project, I find that some time is spent in migrating to TypeScript and installing common packages that I use most of the time. This is an opinionated NextJS starter template that I made for my ease of use so that I can start the development process quicker.
The starter template includes, out of the box:
- Typescript support
- Common packages (
axios
,formik
,yup
) - Material UI (
@material-ui/core
and@material-ui/lab
) - FontAwesome Icons
- Opinionated
Layout
,Header
andFooter
components
- Clone the repo
- Run
yarn
ornpm install
to install the packages - Modify the
"dev": "next dev -p 1337",
command inpackage.json
. The defaultport
is specified to be1337
. - Run
yarn dev
ornpm run dev
- The development server should be accessible at
http://localhost:1337
if you didn't change anything, orhttp://localhost:${PORT}
if you changed thePORT
to something else.
API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js
.
The 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!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.