A modern, production-ready Next.js template implementing hexagonal architecture patterns with the latest tools and best practices.
- 🏗️ Hexagonal Architecture - Clean, maintainable code structure
- ⚡ Next.js 15.4.1 - Latest App Router with server components
- 🎨 TailwindCSS v4 - Modern utility-first CSS framework
- 🧩 shadcn/ui - Beautiful, customizable components
- 📝 TypeScript - Type-safe development
- 🔍 Zod - Runtime type validation
- 🧪 Vitest - Fast unit testing
- 🎭 Cypress - End-to-end testing
- 🛠️ Biome.js - Unified linter and formatter
- 📦 Bun - Fast package manager and runtime
- 🎛️ React Hook Form - Performant form handling
/
├── public/
│ └── favicon.svg
│ └── images/
├── src/
│ ├── components/
│ │ └── ui/ # shadcn/ui components
│ │ ├── button.tsx
│ │ ├── card.tsx
│ │ ├── input.tsx
│ │ └── label.tsx
│ ├── e2e/
│ │ └── tests/
│ │ └── app.cy.ts # E2E tests
│ ├── lib/
│ │ └── utils.ts # Utility functions
│ ├── styles/
│ │ └── globals.css # TailwindCSS v4 styles
│ ├── app/
│ │ ├── page.tsx # Main page
│ │ ├── layout.tsx # Root layout
│ │ └── api/ # API routes
│ ├── modules/ # Hexagonal architecture modules
│ │ └── welcome/
│ │ ├── application/ # Use cases
│ │ ├── domain/ # Entities and interfaces
│ │ └── infrastructure/ # External adapters
│ │ └── tests/
│ │ └── e2e/
│ └── sections/ # UI sections by feature
│ └── welcome/
│ ├── components/ # Feature components
│ │ ├── WelcomePeopleCreate/
│ │ ├── WelcomePeopleCard/
│ │ └── WelcomePeopleList/
│ ├── context/ # React contexts
│ └── hooks/ # Custom hooks
├── biome.json # Biome configuration
├── cypress.config.ts # Cypress configuration
├── next.config.mjs # Next.js configuration
├── package.json
├── tailwind.config.ts # TailwindCSS configuration
├── tsconfig.json
└── vitest.config.ts # Vitest configuration
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
bun install |
Installs dependencies |
bun dev |
Starts local dev server at localhost:3000 |
bun build |
Build your production site to ./.next/ |
bun start |
Preview your build locally, before deploying |
bun test |
Run unit tests with Vitest |
bun run cy:open |
Open Cypress for interactive E2E testing |
bun run cy:run |
Run Cypress E2E tests in headless mode |
bun run lint |
Lint code with Biome |
bun run format |
Format code with Biome |
bun run check |
Run Biome linting and formatting check |
bun run check:fix |
Auto-fix Biome issues |
- Next.js 15.4.1 - React framework with App Router
- React 19 - UI library with latest features
- TypeScript 5 - Type-safe JavaScript
- TailwindCSS v4 - Utility-first CSS framework
- shadcn/ui - Reusable component library
- Lucide React - Beautiful icons
- React Hook Form - Performant form library
- Zod - TypeScript-first schema validation
- @hookform/resolvers - Form validation resolvers
- Biome.js - Fast linter and formatter (replaces ESLint + Prettier)
- Bun - Fast package manager and JavaScript runtime
- Vitest - Unit testing framework
- @testing-library/react - React testing utilities
- Happy-DOM - Lightweight DOM implementation for testing
- Cypress - End-to-end testing framework
- PostCSS - CSS post-processor
- Autoprefixer - CSS vendor prefixing
This template follows hexagonal architecture principles:
- Domain Layer (
modules/*/domain/
) - Core business logic and entities - Application Layer (
modules/*/application/
) - Use cases and business rules - Infrastructure Layer (
modules/*/infrastructure/
) - External dependencies and adapters - Presentation Layer (
sections/
) - UI components and user interactions
-
Clone the repository
git clone https://github.com/your-username/next-hexagonal-architecture cd next-hexagonal-architecture
-
Install dependencies
bun install
-
Start development server
bun dev
-
Open your browser Navigate to
http://localhost:3000
This template includes comprehensive testing setup:
- Unit Tests: Run with
bun test
- E2E Tests: Run with
bun run cy:run
orbun run cy:open
- Code Quality: Check with
bun run check
- ⬆️ Migrated to Bun from pnpm for faster builds
- 🎨 Upgraded to TailwindCSS v4 with new syntax
- 🧩 Integrated shadcn/ui components
- 🔄 Replaced yup with Zod for better TypeScript integration
- 🛠️ Migrated to Biome.js from ESLint + Prettier
- 🗑️ Removed unused dependencies for cleaner project
- 🎯 Enhanced UI/UX with modern design patterns
- ✅ Fixed all tests and maintained 100% test coverage
Please leave a star if you liked the repo and feel free to submit PRs or open issues!
This project is open source and available under the MIT License.