nextjs-redux-api-core
v1.0.0
Published
π Next.js 16 Enterprise Starter Kit with Redux Toolkit, RTK Query, NextAuth v5, and Clean Architecture. Production-ready boilerplate for building scalable web applications.
Maintainers
Readme
β¨ Features
| Feature | Description | |---------|-------------| | β‘ Next.js 16 | Latest App Router with Turbopack for lightning-fast development | | π NextAuth v5 | Secure authentication with JWT & session support | | ποΈ Redux Toolkit | Efficient state management with RTK Query for API calls | | π¨ Tailwind CSS v4 | Modern utility-first CSS with tw-animate-css | | π± Responsive | Mobile-first design with shadcn/ui components | | ποΈ Clean Architecture | Feature-sliced design for scalable codebase | | π Token Monitor | Built-in token refresh and session management | | π Progress Bar | NProgress integration for page transitions | | π Dark Mode | Built-in theme switching with next-themes | | π‘οΈ TypeScript | Full type safety throughout the codebase |
π Quick Start
Create a New Project
# Using npx (recommended)
npx nextjs-redux-api-core my-app
# Or using npm
npm exec nextjs-redux-api-core my-app
# Or install globally
npm install -g nextjs-redux-api-core
create-nxcore my-appStart Development
cd my-app
npm run devOpen http://localhost:4000 to see your app.
π Project Structure
my-app/
βββ π app/ # Next.js App Router
β βββ (auth)/ # Auth routes (sign-in, sign-up)
β βββ (root)/ # Protected routes
β βββ api/ # API routes
β βββ layout.tsx # Root layout
β βββ globals.css # Global styles
β
βββ π components/ # Shared UI components
β βββ layout/ # Layout components
β βββ molecules/ # Composite components
β βββ ui/ # Base UI components (shadcn)
β
βββ π config/ # App configuration
β βββ constants.ts # App constants
β βββ env.ts # Environment config
β βββ routes.ts # Route definitions
β βββ modules.ts # Module registry
β
βββ π infrastructure/ # Technical layer
β βββ api/ # RTK Query base config
β βββ auth/ # NextAuth configuration
β βββ hooks/ # Global hooks
β βββ providers/ # App providers
β βββ store/ # Redux store setup
β
βββ π modules/ # Feature modules
β βββ auth/ # Authentication module
β β βββ api/ # Auth API endpoints
β β βββ components/ # Auth UI components
β β βββ hooks/ # Auth hooks
β β βββ services/ # Auth business logic
β β βββ store/ # Auth state slice
β β βββ types/ # Auth types
β βββ menu/ # Menu module
β
βββ π lib/ # Utility functions
β βββ utils.ts # General utilities
β βββ formatters.ts # Data formatters
β βββ validators.ts # Validation helpers
β
βββ π types/ # Global type definitions
β βββ global.d.ts # Global types
β βββ next-auth.d.ts # NextAuth type extensions
β
βββ π assets/ # Static assets
βββ styles/ # Global stylesheetsποΈ Architecture Overview
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β APP LAYER β
β Next.js App Router - Routes, Layouts, Pages β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FEATURE MODULES β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Auth β β Menu β β [Your] β β
β β Module β β Module β β Module β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β Components β’ Hooks β’ Services β’ Store β’ Types β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INFRASTRUCTURE LAYER β
β Redux Store β’ NextAuth β’ RTK Query β’ Providers β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SHARED COMPONENTS β
β UI Components β’ Layout β’ Molecules β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββπ Environment Variables
Create a .env.local file in the root directory:
# App Configuration
NEXT_PUBLIC_APP_NAME="Your App Name"
NEXT_PUBLIC_APP_URL="http://localhost:4000"
NEXT_PUBLIC_API_URL="http://localhost:4000/api"
# Authentication (Required)
AUTH_SECRET="your-secret-key" # Generate: openssl rand -base64 32
AUTH_URL="http://localhost:4000"
# Database (Optional)
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"π οΈ Available Scripts
| Command | Description |
|---------|-------------|
| npm run dev | Start development server on port 4000 |
| npm run build | Build for production |
| npm run start | Start production server |
| npm run lint | Run ESLint |
π Feature Module Template
Create new features following this structure:
modules/
[feature-name]/
βββ components/ # UI components
β βββ [Feature]Page.tsx
β βββ index.ts
βββ hooks/ # React hooks
β βββ use[Feature].ts
βββ services/ # Business logic
β βββ [feature].service.ts
βββ store/ # Redux slice (optional)
β βββ [feature]Slice.ts
βββ api/ # RTK Query endpoints
β βββ [feature]Api.ts
βββ types/ # TypeScript types
β βββ index.ts
βββ index.ts # Public exportsπ€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Next.js - The React Framework
- Redux Toolkit - State Management
- NextAuth.js - Authentication
- Tailwind CSS - Styling
- shadcn/ui - UI Components
