Non-opinionated TypeScript starter for Next.js 16. All the tools you need to build your next project ⚡️
See the code
@ prefixThe best way to start with this template is using Create Next App.
# pnpm
pnpm create next-app -e https://github.com/jpedroschmitz/typescript-nextjs-starter
# yarn
yarn create next-app -e https://github.com/jpedroschmitz/typescript-nextjs-starter
# npm
npx create-next-app -e https://github.com/jpedroschmitz/typescript-nextjs-starter
To start the project locally, run:
pnpm dev
Open http://localhost:3000 with your browser to see the result.
“This starter is by far the best TypeScript starter for Next.js. Feature packed but un-opinionated at the same time!”
— Arafat Zahan
“Brilliant work!”
— Soham Dasgupta
List of websites that started off with Next.js TypeScript Starter:
.github — GitHub configuration including the CI workflow..husky — Husky configuration and hooks.public — Static assets such as robots.txt, images, and favicon.src — Application source code, including pages, components, styles.pnpm dev — Starts the application in development mode at http://localhost:3000.pnpm build — Creates an optimized production build of your application.pnpm build:analyze — Analyze the production build to see the bundle size.pnpm start — Starts the application in production mode.pnpm type-check — Validate code using TypeScript compiler.pnpm lint — Runs Oxlint for all files in the src directory.pnpm lint:fix — Runs Oxlint fix for all files in the src directory.pnpm format — Runs Oxfmt for all files in the src directory.pnpm format:check — Check Oxfmt list of files that need to be formatted.pnpm format:ci — Oxfmt check for CI.TypeScript are pre-configured with custom path mappings. To import components or files, use the @ prefix.
import { Button } from '@/components/Button';
// To import images or other files from the public folder
import avatar from '@/public/avatar.png';
This starter uses pnpm by default, but this choice is yours. If you'd like to switch to Yarn/npm, delete the pnpm-lock.yaml file, install the dependencies with Yarn/npm, change the CI workflow, and Husky Git hooks to use Yarn/npm commands.
Note: If you use Yarn, make sure to follow these steps from the Husky documentation so that Git hooks do not fail with Yarn on Windows.
We use T3 Env to manage environment variables. Create a .env.local file in the root of the project and add your environment variables there.
When adding additional environment variables, the schema in ./src/lib/env/client.ts or ./src/lib/env/server.ts should be updated accordingly.
To add redirects, update the redirects array in ./redirects.ts. It's typed, so you'll get autocompletion for the properties.
The Content Security Policy (CSP) is a security layer that helps to detect and mitigate certain types of attacks, including Cross-Site Scripting (XSS) and data injection attacks. The CSP is implemented in the next.config.ts file.
It contains a default and minimal policy that you can customize to fit your application needs. It's a foundation to build upon.
Husky is a tool that helps us run scrips before Git events. We have 3 hooks:
pre-commit — (Disabled by default) Runs lint-staged to lint and format the files.commit-msg — Runs commitlint to check if the commit message follows the conventional commit message format.post-merge — Runs pnpm install to update the dependencies if there was a change in the pnpm-lock.yaml file.Important note: Husky is disabled by default in the pre-commit hook. This is intention because most developers don't want to run lint-staged on every commit. If you want to enable it, run
echo 'HUSKY_ENABLED=true' > .husky/_/pre-commit.options.
This project is licensed under the MIT License - see the LICENSE.md file for more information.
430 followers · starred Jul 2022
26 followers · starred Jul 2024
33 followers · starred Apr 2023
101 followers · starred Dec 2025
Non-opinionated TypeScript starter for Next.js 16. All the tools you need to build your next project ⚡️
See the code
@ prefixThe best way to start with this template is using Create Next App.
# pnpm
pnpm create next-app -e https://github.com/jpedroschmitz/typescript-nextjs-starter
# yarn
yarn create next-app -e https://github.com/jpedroschmitz/typescript-nextjs-starter
# npm
npx create-next-app -e https://github.com/jpedroschmitz/typescript-nextjs-starter
To start the project locally, run:
pnpm dev
Open http://localhost:3000 with your browser to see the result.
“This starter is by far the best TypeScript starter for Next.js. Feature packed but un-opinionated at the same time!”
— Arafat Zahan
“Brilliant work!”
— Soham Dasgupta
List of websites that started off with Next.js TypeScript Starter:
.github — GitHub configuration including the CI workflow..husky — Husky configuration and hooks.public — Static assets such as robots.txt, images, and favicon.src — Application source code, including pages, components, styles.pnpm dev — Starts the application in development mode at http://localhost:3000.pnpm build — Creates an optimized production build of your application.pnpm build:analyze — Analyze the production build to see the bundle size.pnpm start — Starts the application in production mode.pnpm type-check — Validate code using TypeScript compiler.pnpm lint — Runs Oxlint for all files in the src directory.pnpm lint:fix — Runs Oxlint fix for all files in the src directory.pnpm format — Runs Oxfmt for all files in the src directory.pnpm format:check — Check Oxfmt list of files that need to be formatted.pnpm format:ci — Oxfmt check for CI.TypeScript are pre-configured with custom path mappings. To import components or files, use the @ prefix.
import { Button } from '@/components/Button';
// To import images or other files from the public folder
import avatar from '@/public/avatar.png';
This starter uses pnpm by default, but this choice is yours. If you'd like to switch to Yarn/npm, delete the pnpm-lock.yaml file, install the dependencies with Yarn/npm, change the CI workflow, and Husky Git hooks to use Yarn/npm commands.
Note: If you use Yarn, make sure to follow these steps from the Husky documentation so that Git hooks do not fail with Yarn on Windows.
We use T3 Env to manage environment variables. Create a .env.local file in the root of the project and add your environment variables there.
When adding additional environment variables, the schema in ./src/lib/env/client.ts or ./src/lib/env/server.ts should be updated accordingly.
To add redirects, update the redirects array in ./redirects.ts. It's typed, so you'll get autocompletion for the properties.
The Content Security Policy (CSP) is a security layer that helps to detect and mitigate certain types of attacks, including Cross-Site Scripting (XSS) and data injection attacks. The CSP is implemented in the next.config.ts file.
It contains a default and minimal policy that you can customize to fit your application needs. It's a foundation to build upon.
Husky is a tool that helps us run scrips before Git events. We have 3 hooks:
pre-commit — (Disabled by default) Runs lint-staged to lint and format the files.commit-msg — Runs commitlint to check if the commit message follows the conventional commit message format.post-merge — Runs pnpm install to update the dependencies if there was a change in the pnpm-lock.yaml file.Important note: Husky is disabled by default in the pre-commit hook. This is intention because most developers don't want to run lint-staged on every commit. If you want to enable it, run
echo 'HUSKY_ENABLED=true' > .husky/_/pre-commit.options.
This project is licensed under the MIT License - see the LICENSE.md file for more information.
430 followers · starred Jul 2022
26 followers · starred Jul 2024
33 followers · starred Apr 2023
101 followers · starred Dec 2025