|
1 | | -This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). |
| 1 | +# PluteoJS Next.js Starter |
| 2 | + |
| 3 | +A production-ready Next.js TypeScript starter template with Redux Toolkit, Axios services, and shadcn/ui components. |
| 4 | + |
| 5 | +Created by [Muhammad Swalah](https://swalahamani.com) at [HeedLabs](https://heedlabs.com). |
| 6 | + |
| 7 | +> **Looking for a full-stack solution?** Check out the [PluteoJS Full-Stack Monorepo Template](https://github.com/PluteoJS/pluteojs-template) with Next.js, Express API, Drizzle ORM, and Turborepo. |
| 8 | +
|
| 9 | +## Tech Stack |
| 10 | + |
| 11 | +- **Framework**: Next.js 16 with App Router |
| 12 | +- **Language**: TypeScript 5.9+ (strict mode) |
| 13 | +- **Styling**: Tailwind CSS 4, shadcn/ui |
| 14 | +- **State Management**: Redux Toolkit |
| 15 | +- **HTTP Client**: Axios with interceptors |
| 16 | +- **Code Quality**: ESLint 9, Prettier, Husky |
| 17 | +- **Git Workflow**: Commitlint, standard-version |
2 | 18 |
|
3 | 19 | ## Getting Started |
4 | 20 |
|
5 | | -First, run the development server: |
| 21 | +### Prerequisites |
| 22 | + |
| 23 | +- Node.js 20.9 or higher |
| 24 | +- Yarn 4.7+ |
| 25 | + |
| 26 | +### Installation |
6 | 27 |
|
7 | 28 | ```bash |
8 | | -npm run dev |
9 | | -# or |
10 | | -yarn dev |
11 | | -# or |
12 | | -pnpm dev |
13 | | -# or |
14 | | -bun dev |
| 29 | +# Clone the repository |
| 30 | +git clone https://github.com/PluteoJS/next-js-typescript-starter.git |
| 31 | +cd next-js-typescript-starter |
| 32 | + |
| 33 | +# Install dependencies |
| 34 | +yarn install |
15 | 35 | ``` |
16 | 36 |
|
17 | | -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
| 37 | +### Development |
18 | 38 |
|
19 | | -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. |
| 39 | +```bash |
| 40 | +# Start development server with Turbopack |
| 41 | +yarn start:dev |
| 42 | +``` |
20 | 43 |
|
21 | | -This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. |
| 44 | +Open [http://localhost:3000](http://localhost:3000) to view the application. |
22 | 45 |
|
23 | | -## Learn More |
| 46 | +### Build |
| 47 | + |
| 48 | +```bash |
| 49 | +# Create production build |
| 50 | +yarn build |
| 51 | + |
| 52 | +# Start production server |
| 53 | +yarn start:production |
| 54 | +``` |
| 55 | + |
| 56 | +### Code Quality |
| 57 | + |
| 58 | +```bash |
| 59 | +# Run ESLint and TypeScript checks |
| 60 | +yarn lint |
| 61 | + |
| 62 | +# Check code formatting |
| 63 | +yarn format |
| 64 | +``` |
| 65 | + |
| 66 | +## Project Structure |
| 67 | + |
| 68 | +``` |
| 69 | +src/ |
| 70 | +├── app/ # Next.js App Router pages |
| 71 | +│ ├── layout.tsx # Root layout |
| 72 | +│ ├── page.tsx # Home page |
| 73 | +│ └── globals.css # Global styles |
| 74 | +├── components/ # React components |
| 75 | +│ ├── lib/shadcn/ # shadcn/ui components (DO NOT MODIFY) |
| 76 | +│ └── ... # Custom components |
| 77 | +├── services/ # API services |
| 78 | +│ └── api/ |
| 79 | +│ ├── PluteoJS/ # Axios instance & interceptors |
| 80 | +│ └── index.ts # Service exports |
| 81 | +├── store/ # Redux Toolkit |
| 82 | +│ ├── index.ts # Store configuration |
| 83 | +│ ├── Hooks.ts # Typed hooks |
| 84 | +│ └── example/ # Example slice |
| 85 | +├── utils/ # Helper utilities |
| 86 | +└── customTypes/ # TypeScript type definitions |
| 87 | +``` |
| 88 | + |
| 89 | +## Key Features |
| 90 | + |
| 91 | +### Redux Toolkit |
| 92 | + |
| 93 | +Pre-configured state management with typed hooks: |
| 94 | + |
| 95 | +```tsx |
| 96 | +import { useAppSelector, useAppDispatch } from "@/store/Hooks"; |
| 97 | + |
| 98 | +const user = useAppSelector((state) => state.example.value); |
| 99 | +const dispatch = useAppDispatch(); |
| 100 | +``` |
24 | 101 |
|
25 | | -To learn more about Next.js, take a look at the following resources: |
| 102 | +### Axios Services |
| 103 | + |
| 104 | +API service architecture with request/response interceptors: |
| 105 | + |
| 106 | +```tsx |
| 107 | +import { apiServer } from "@/services/api/PluteoJS"; |
| 108 | + |
| 109 | +const response = await apiServer.get("/endpoint"); |
| 110 | +``` |
| 111 | + |
| 112 | +### shadcn/ui Components |
| 113 | + |
| 114 | +Install components using the CLI: |
| 115 | + |
| 116 | +```bash |
| 117 | +npx shadcn-ui@latest add button |
| 118 | +npx shadcn-ui@latest add dialog |
| 119 | +``` |
| 120 | + |
| 121 | +Import from the configured path: |
| 122 | + |
| 123 | +```tsx |
| 124 | +import { Button } from "@/components/lib/shadcn/ui/button"; |
| 125 | +``` |
| 126 | + |
| 127 | +> **Note:** Do not modify files in `src/components/lib/shadcn/ui/`. Create wrapper components instead. |
| 128 | +
|
| 129 | +### Git Workflow |
| 130 | + |
| 131 | +- **Husky**: Pre-commit hooks for linting and formatting |
| 132 | +- **Commitlint**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) |
| 133 | +- **standard-version**: Automated versioning and changelog |
| 134 | + |
| 135 | +## Useful Commands |
| 136 | + |
| 137 | +| Command | Description | |
| 138 | +| -------------------- | ---------------------------------------- | |
| 139 | +| `yarn start:dev` | Start development server with Turbopack | |
| 140 | +| `yarn build` | Create production build | |
| 141 | +| `yarn start:production` | Start production server | |
| 142 | +| `yarn lint` | Run ESLint and TypeScript checks | |
| 143 | +| `yarn format` | Check code formatting with Prettier | |
| 144 | +| `yarn check-types` | Run TypeScript type checking | |
| 145 | + |
| 146 | +## Configuration |
| 147 | + |
| 148 | +### Environment Variables |
| 149 | + |
| 150 | +Copy `.env.development` for local development: |
| 151 | + |
| 152 | +```bash |
| 153 | +NEXT_PUBLIC_API_URL=http://localhost:3000/api |
| 154 | +``` |
| 155 | + |
| 156 | +### TypeScript |
| 157 | + |
| 158 | +Strict mode is enabled with custom naming conventions: |
| 159 | +- Interfaces: `iInterfaceName` (prefix with `i`) |
| 160 | +- Types: `typeNameType` (suffix with `Type`) |
| 161 | + |
| 162 | +### ESLint |
| 163 | + |
| 164 | +Uses ESLint 9 flat config with: |
| 165 | +- TypeScript support |
| 166 | +- React hooks rules |
| 167 | +- Import ordering |
| 168 | +- Prettier integration |
| 169 | + |
| 170 | +## Learn More |
26 | 171 |
|
27 | | -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. |
28 | | -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. |
| 172 | +- [Next.js Documentation](https://nextjs.org/docs) |
| 173 | +- [Redux Toolkit Documentation](https://redux-toolkit.js.org/) |
| 174 | +- [shadcn/ui Documentation](https://ui.shadcn.com) |
| 175 | +- [Tailwind CSS Documentation](https://tailwindcss.com/docs) |
29 | 176 |
|
30 | | -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! |
| 177 | +## Related Projects |
31 | 178 |
|
32 | | -## Deploy on Vercel |
| 179 | +- [PluteoJS Full-Stack Template](https://github.com/PluteoJS/pluteojs-template) - Complete monorepo with Next.js, Express API, Drizzle ORM, and Turborepo |
33 | 180 |
|
34 | | -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. |
| 181 | +## License |
35 | 182 |
|
36 | | -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. |
| 183 | +MIT |
0 commit comments