https://github.com/hossein-i/nextjs-rtk-starter
A modern and scalable starter template for Next.js, following best practices with clean architecture based on Feature-Sliced Design (FSD). This setup is ready to go with TypeScript, Redux Toolkit (RTK), RTK Query, ESLint, Prettier, Commitlint, and Husky.
https://github.com/hossein-i/nextjs-rtk-starter
commitizen commitlint eslint feature-sliced-design husky lint-staged nextjs nextjs-template prettier redux-toolkit rtk-query tailwindcss template typescript
Last synced: 3 months ago
JSON representation
A modern and scalable starter template for Next.js, following best practices with clean architecture based on Feature-Sliced Design (FSD). This setup is ready to go with TypeScript, Redux Toolkit (RTK), RTK Query, ESLint, Prettier, Commitlint, and Husky.
- Host: GitHub
- URL: https://github.com/hossein-i/nextjs-rtk-starter
- Owner: Hossein-i
- License: mit
- Created: 2025-05-13T03:45:20.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2025-05-18T09:19:09.000Z (5 months ago)
- Last Synced: 2025-05-30T04:59:03.863Z (4 months ago)
- Topics: commitizen, commitlint, eslint, feature-sliced-design, husky, lint-staged, nextjs, nextjs-template, prettier, redux-toolkit, rtk-query, tailwindcss, template, typescript
- Language: TypeScript
- Homepage:
- Size: 51.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Next.js RTK Starter
A modern and scalable starter template for **Next.js**, following best practices with clean architecture based on **Feature-Sliced Design (FSD)**. This setup is ready to go with **TypeScript**, **Redux Toolkit (RTK)**, **RTK Query**, **ESLint**, **Prettier**, **Commitlint**, and **Husky**.
## ๐ Features
- **Next.js** โ The production-ready React framework.
- **TypeScript** โ Static typing for JavaScript.
- **Redux Toolkit (RTK)** โ Efficient and scalable state management.
- **RTK Query** โ Built-in data fetching and caching.
- **Feature-Sliced Design (FSD)** โ Modular architecture for large applications.
- **Prettier** โ Code formatter for consistent style.
- **ESLint** โ Code linter to ensure code quality.
- **Commitlint** โ Enforce conventional commit messages.
- **Husky** โ Git hooks for pre-commit and commit-msg checks.## ๐ฆ Getting Started
### Prerequisites
- Node.js (v18 or higher)
- npm or yarn### Installation
1. Clone the repository:
```bash
git clone https://github.com/Hossein-i/nextjs-rtk-starter.git
```2. Navigate to the project directory:
```bash
cd nextjs-rtk-starter
```3. Install dependencies:
```bash
npm install
# or
yarn install
```### Running the Development Server
Start the dev server:
```bash
npm run dev
# or
yarn dev
```Then open [http://localhost:3000](http://localhost:3000) in your browser.
## ๐งฑ Project Structure (FSD)
This project uses the **Feature-Sliced Design** architecture to enhance scalability and maintainability:
```bash
src/
โโโ app/ # Next.js app router (layouts, pages)
โโโ entities/ # Business entities like user, product
โ โโโ api/ # Entity-related API logic
โ โโโ model/ # Types, stores, services
โ โโโ ui/ # Entity-specific UI components
โโโ features/ # Independent, reusable features
โ โโโ api/ # Feature-specific API calls
โ โโโ config/ # Feature-level configuration
โ โโโ lib/ # Internal libraries for the feature
โ โโโ model/ # Logic, stores, types
โ โโโ ui/ # UI for feature interactions
โโโ shared/ # Cross-cutting code (global utils, UI, config)
โ โโโ api/ # API client setup and base query
โ โโโ config/ # App-wide config and env vars
โ โโโ i18n/ # Internationalization setup
โ โโโ lib/ # Utilities and helper functions
โ โโโ styles/ # Global styles and themes
โ โโโ ui/ # Design system components
โโโ views/ # Top-level views composed of widgets/features
โโโ widgets/ # UI blocks that encapsulate full use cases
```## โ๏ธ State Management & Data Fetching
This template comes with:
- **Redux Toolkit** for managing global app state.
- **RTK Query** for fetching, caching, and managing server state with minimal boilerplate.> Store setup and slices can be found in `shared/api` and `features/model`.
## ๐งน Code Quality Tools
### Prettier
Ensures consistent code formatting:
```bash
npm run format
# or
yarn format
```### ESLint
Checks code for style and quality issues:
```bash
npm run lint
# or
yarn lint
```### Commitlint
Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all commit messages:
```bash
npm run commit
# or
yarn commit
```## ๐ Git Hooks (Husky)
Husky ensures quality checks before code is committed:
- **Pre-commit**: Runs ESLint and Prettier
- **Commit-msg**: Validates commit message format## ๐ค Contributing
We welcome contributions! To get started:
1. Fork the repo.
2. Create a new branch: `git checkout -b feature/YourFeatureName`.
3. Commit your changes: `git commit -m 'feat: Add awesome feature'`.
4. Push the branch: `git push origin feature/YourFeatureName`.
5. Open a Pull Request.## ๐ License
This project is licensed under the MIT License โ see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- [Next.js Docs](https://nextjs.org/docs)
- [Feature-Sliced Design](https://feature-sliced.design/)
- [Redux Toolkit](https://redux-toolkit.js.org/)
- [RTK Query](https://redux-toolkit.js.org/rtk-query/overview)
- [Conventional Commits](https://www.conventionalcommits.org/)