UNPKG

create-codehuddle-nextjs

Version:

๐Ÿš€ Interactive CLI tool to generate modern Next.js 15 apps with authentication, payments, dashboard, PWA, and more. Choose your stack with TypeScript, Tailwind CSS, shadcn/ui, and enterprise features.

417 lines (321 loc) โ€ข 13.2 kB
# ๐Ÿš€ create-codehuddle-nextjs [![npm version](https://img.shields.io/npm/v/create-codehuddle-nextjs.svg?style=flat-square)](https://www.npmjs.com/package/create-codehuddle-nextjs) [![Downloads](https://img.shields.io/npm/dm/create-codehuddle-nextjs.svg?style=flat-square)](https://www.npmjs.com/package/create-codehuddle-nextjs) [![License](https://img.shields.io/npm/l/create-codehuddle-nextjs.svg?style=flat-square)](https://github.com/Code-Huddle/create-codehuddle-nextjs/blob/main/LICENSE) [![Node.js Version](https://img.shields.io/node/v/create-codehuddle-nextjs.svg?style=flat-square)](https://nodejs.org/) > **The ultimate CLI tool for generating modern, production-ready Next.js applications with enterprise-grade features, modular architecture, and best practices built-in.** ## โœจ What Makes This Special? **create-codehuddle-nextjs** is not just another Next.js starter template. It's a **modular, interactive CLI tool** that lets you build exactly what you need, when you need it. Choose your authentication, payments, features, and more through an intuitive command-line interface. ### ๐ŸŽฏ **Interactive Project Generation** ```bash npx create-codehuddle-nextjs my-app # โœจ Interactive prompts guide you through: # ๐Ÿ” Authentication: NextAuth.js, Supabase, or None # ๐Ÿ’ณ Payments: One-time, Subscriptions, or None # ๐Ÿ“Š Dashboard: Include analytics dashboard # ๐Ÿ“ฑ PWA: Progressive Web App features # ๐Ÿ“š Storybook: Component development # ๐Ÿณ Docker: Containerization # ๐Ÿ” Sentry: Error monitoring # ๐ŸŒ™ Dark Mode: Theme switching ``` ## ๐Ÿš€ Quick Start ### Prerequisites - **Node.js** >= 20.0.0 - **npm**, **yarn**, or **pnpm** ### Complete CLI Flow Run the command and follow the interactive prompts: ```bash npx create-codehuddle-nextjs my-awesome-app ``` **Here's the complete interactive flow you'll experience:** ```bash ๐ŸŒŸ Welcome to create-codehuddle-nextjs! Let's create your modern Next.js application ๐Ÿ” Choose your authentication provider: โฏ NextAuth.js - Complete auth with OAuth providers Supabase Auth - Real-time auth with database None - Add authentication later ๐Ÿ‘ฅ Enable Role-Based Authentication (Admin/User roles)? โฏ No ๐ŸŒ™ Enable dark mode toggle in your app? โฏ Yes ๐Ÿ’ณ Choose your Stripe integration: โฏ None - Add payments later One-time payments - Single payments and purchases Subscriptions - Recurring billing and subscriptions ๐Ÿ“ฉ Include Email module (Nodemailer) for transactional emails? โฏ Yes ๐Ÿ“Š Include a Dashboard page (graphs, tables, stats)? โฏ Yes ๐Ÿ“š Include Storybook for UI component development? โฏ Yes ๐Ÿ“ฑ Include PWA (Progressive Web App) support? โฏ Yes ๐Ÿณ Include Docker configuration for containerization? โฏ Yes ๐Ÿ” Include Sentry for error monitoring and performance tracking? โฏ Yes ๐Ÿš€ Creating project in 'my-awesome-app'... ๐ŸŽ‰ Project created successfully! ๐Ÿ“‹ Configuration Summary: ๐Ÿ” Auth: NextAuth ๐Ÿ’ณ Payments: None ๐Ÿ“ฉ Email: Enabled ๐Ÿ“Š Dashboard: Enabled ๐Ÿ“ฑ PWA: Enabled ๐Ÿ“š Storybook: Enabled ๐Ÿณ Docker: Enabled ๐Ÿ” Sentry: Enabled ๐ŸŒ™ Dark Mode: Enabled ๐Ÿš€ Next Steps: cd my-awesome-app npm install cp .env.example .env.local # Configure environment variables in .env.local npm run dev ๐Ÿ’ก Tip: Visit http://localhost:3000 to see your app! Made with ๐Ÿ’œ by CodeHuddle Lets build the future together!โšก ``` ### Setup & Run ```bash cd my-awesome-app npm install cp .env.example .env.local npm run dev ``` **๐ŸŽ‰ That's it!** Visit [http://localhost:3000](http://localhost:3000) to see your application. ## ๐Ÿ—๏ธ Architecture & Features ### ๐Ÿ” **Modular Authentication System** Choose from multiple authentication providers, each with complete implementations: | Provider | Features | Best For | |----------|----------|----------| | **NextAuth.js** | OAuth, credentials, session management | Full-featured apps with multiple providers | | **Supabase** | Real-time auth, database integration | Modern apps with real-time features | | **Supabase + Roles** | Role-based access control (Admin/User) | Enterprise applications | | **None** | No authentication | Simple apps or custom auth later | **Example CLI Flow:** ```bash ๐Ÿ” Choose your authentication provider: โฏ NextAuth.js - Complete auth with OAuth providers Supabase Auth - Real-time auth with database None - Add authentication later ``` ### ๐Ÿ’ณ **Flexible Payment Integration** Integrated Stripe payments with complete flows: | Integration | Features | Pages Included | |-------------|----------|----------------| | **One-time Payments** | Single payments, purchases | `/test-payment`, `/payment/success`, `/payment/cancel` | | **Subscriptions** | Recurring billing, subscription management | `/test-subscription`, `/payment/success`, `/payment/cancel` | | **None** | No payment integration | - | **Interactive Landing Page:** When you select Stripe integration, your landing page automatically includes clickable links to test payment functionality. ### ๐Ÿ“Š **Optional Dashboard Module** Modern analytics dashboard with: - **KPI Cards** with metrics and trends - **Interactive Charts** using Recharts - **Activity Timeline** for user actions - **Sales Table** with data visualization - **Responsive Design** with sidebar navigation ### ๐Ÿ“ฑ **Progressive Web App (PWA)** Complete PWA implementation: - **Web App Manifest** for app-like experience - **Service Worker** for offline functionality - **Install Prompt** component for app installation - **Offline Support** with caching strategies ### ๐Ÿ“š **Storybook Integration** Component development environment: - **Pre-configured** Storybook setup - **Component Stories** for UI development - **Interactive Documentation** for your design system - **Visual Testing** capabilities ### ๐Ÿณ **Docker Containerization** Production-ready containerization: - **Multi-stage Build** for optimized images - **Development Environment** with hot reloading - **Production Configuration** for deployment - **Generic Templates** - easily customizable ### ๐Ÿ” **Sentry Error Monitoring** Comprehensive error tracking and performance monitoring: - **Error Tracking** with automatic error capture - **Performance Monitoring** for optimization insights - **Source Maps** for detailed stack traces - **Session Replay** for debugging user interactions - **Custom Configuration** - easily customizable ### ๐ŸŒ™ **Smart Dark Mode** Intelligent theme system: - **System Preference Detection** - **localStorage Persistence** - **Smooth Transitions** with CSS variables - **Conditional Inclusion** - only adds toggle if enabled ## ๐Ÿ› ๏ธ Technology Stack ### **Core Framework** - **Next.js 15** - Latest React framework with App Router - **React 19** - Latest React with concurrent features - **TypeScript** - Full type safety - **Tailwind CSS v4** - Utility-first styling ### **UI & Components** - **shadcn/ui** - Beautiful, accessible components - **Radix UI** - Low-level UI primitives - **Lucide React** - Beautiful icon library - **Class Variance Authority** - Component variants ### **State Management** - **Zustand** - Lightweight state management - **TanStack Query** - Server state management - **React Hook Form** - Performant forms - **Zod** - TypeScript-first validation ### **Development Tools** - **Vitest** - Fast unit testing - **Playwright** - E2E testing - **ESLint** - Code linting - **Prettier** - Code formatting - **Husky** - Git hooks - **Commitizen** - Conventional commits ### **Production Ready** - **Bundle Analysis** with @next/bundle-analyzer - **Docker** configuration - **CI/CD** templates - **SEO Optimization** - **Performance Monitoring** ready ## ๐Ÿ“ Project Structure ``` my-awesome-app/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ app/ # Next.js App Router โ”‚ โ”‚ โ”œโ”€โ”€ [locale]/ # Internationalization โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ (auth)/ # Authentication routes โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ sign-in/ # Sign in pages โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ sign-up/ # Sign up pages โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ dashboard/ # Dashboard (if enabled) โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ admin/ # Admin routes (Supabase Roles) โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ user/ # User routes (Supabase Roles) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ test-payment/ # Stripe test pages โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ test-subscription/ # Subscription test โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ test-email/ # Email testing โ”‚ โ”‚ โ””โ”€โ”€ api/ # API routes โ”‚ โ”œโ”€โ”€ components/ # Reusable components โ”‚ โ”‚ โ”œโ”€โ”€ ui/ # shadcn/ui components โ”‚ โ”‚ โ”œโ”€โ”€ auth/ # Authentication components โ”‚ โ”‚ โ””โ”€โ”€ dashboard/ # Dashboard components โ”‚ โ”œโ”€โ”€ lib/ # Utility libraries โ”‚ โ”œโ”€โ”€ hooks/ # Custom React hooks โ”‚ โ”œโ”€โ”€ stores/ # Zustand stores โ”‚ โ”œโ”€โ”€ types/ # TypeScript definitions โ”‚ โ”œโ”€โ”€ validations/ # Zod schemas โ”‚ โ””โ”€โ”€ locales/ # Translation files โ”œโ”€โ”€ public/ # Static assets โ”œโ”€โ”€ tests/ # Test files โ”œโ”€โ”€ .storybook/ # Storybook configuration โ””โ”€โ”€ docs/ # Documentation ``` ## ๐ŸŽฏ Available Scripts | Script | Description | |--------|-------------| | `npm run dev` | Start development server with Turbo | | `npm run build` | Build for production | | `npm run start` | Start production server | | `npm run lint` | Run ESLint | | `npm run lint:fix` | Fix ESLint errors | | `npm run test` | Run unit tests with Vitest | | `npm run test:e2e` | Run E2E tests with Playwright | | `npm run storybook` | Start Storybook development | | `npm run generate:component` | Generate new component | | `npm run build-stats` | Build with bundle analysis | ## ๐ŸŒ Internationalization Built-in i18n support with **next-intl**: - **Multiple Languages** - English, French, and more - **Locale-based Routing** - `/en/`, `/fr/` paths - **Dynamic Translations** - Server and client components - **SEO-friendly** - Proper meta tags per locale ## ๐Ÿงช Testing Strategy Comprehensive testing setup: ### **Unit Testing** (Vitest) ```bash npm run test # Fast unit tests with React Testing Library ``` ### **E2E Testing** (Playwright) ```bash npm run test:e2e # End-to-end testing across browsers ``` ### **Component Testing** (Storybook) ```bash npm run storybook # Visual component development and testing ``` ## ๐Ÿ”ง Configuration Examples ### **Environment Variables** The CLI automatically generates `.env.example` with the right variables for your selected modules: ```bash # Authentication (NextAuth.js) NEXTAUTH_SECRET=your-secret-here NEXTAUTH_URL=http://localhost:3000 # Supabase NEXT_PUBLIC_SUPABASE_URL=your-supabase-url NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key # Stripe NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_... STRIPE_SECRET_KEY=sk_test_... # Email (Nodemailer) RESEND_API_KEY=re_... ``` ## ๐Ÿš€ Production Deployment ### **Vercel** (Recommended) ```bash # Deploy to Vercel npx vercel # Set environment variables in Vercel dashboard ``` ### **Docker** ```bash # Build Docker image docker build -t my-app . # Run container docker run -p 3000:3000 my-app ``` ### **Other Platforms** - **Netlify** - Static site generation - **Railway** - Full-stack deployment - **AWS** - Container deployment - **DigitalOcean** - App Platform ## ๐Ÿค Contributing We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details. ## ๐Ÿ“„ License This project is licensed under the ISC License - see the [LICENSE](LICENSE) file for details. ## ๐Ÿ‘ฅ Developers Meet the team behind create-codehuddle-nextjs: <table> <tr> <td align="center"> <a href="https://linkedin.com/in/kashiekzmi"> <img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn" /> </a> <br /> <strong>Kashif Abbas Kazmi</strong> <br /> <em>Software Engineer</em> </td> <td align="center"> <a href="https://www.linkedin.com/in/haris-ahmed-software-engineer/"> <img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn" /> </a> <br /> <strong>Haris Ahmed</strong> <br /> <em>Software Engineer</em> </td> </tr> </table> ## ๐Ÿ™ Acknowledgments - **Next.js Team** - For the amazing framework - **Vercel** - For hosting and deployment - **shadcn/ui** - For beautiful components - **Radix UI** - For accessible primitives - **Tailwind CSS** - For utility-first styling --- <div align="center"> **๐Ÿ’œ Made with โ™ฅ by CodeHuddle** **๐Ÿš€ Happy coding โ€ข Join our amazing community!** [โญ Star us on GitHub](https://github.com/Code-Huddle/create-codehuddle-nextjs) โ€ข [๐Ÿ“ฆ NPM Package](https://www.npmjs.com/package/create-codehuddle-nextjs) โ€ข [๐Ÿฆ Follow us](https://twitter.com/codehuddle) </div>