nextforge-cli
v1.4.2
Published
Forge your next full-stack Next.js app with Hono, Prisma, TanStack Query, Zustand, BullMQ and more
Maintainers
Readme
🔥 NextForge CLI
Forge your next full-stack Next.js TypeScript application with a single command.
Features
- Next.js 14 with App Router
- Hono - Fast, lightweight API framework
- Prisma - Type-safe database ORM
- TanStack Query - Data fetching and caching
- Zustand - Lightweight state management
- React Hook Form + Zod - Form handling with validation
- Tailwind CSS + shadcn/ui - Beautiful, accessible components
- next-themes - Dark mode support
- Recharts - Data visualization
- Winston - Logging
Optional Features
- Authentication
- Credentials (email/password)
- LDAP / Active Directory
- OAuth (Google, GitHub, etc.)
- Stripe - Payment processing
- Nodemailer - Email functionality
- BullMQ + Redis - Background job processing
- Docker - Container deployment
Installation
# Using npx (recommended)
npx nextforge-cli my-app
# Or install globally
npm install -g nextforge-cli
nextforge my-appUsage
Run the CLI and answer the prompts:
npx nextforge-cliYou'll be asked about:
- Project name
- Database type (PostgreSQL, MySQL, SQL Server, SQLite)
- Authentication (and which type)
- Stripe integration
- Email functionality
- Background jobs (BullMQ)
- Docker files
- Package manager
Project Structure
my-app/
├── app/ # Next.js App Router pages
│ ├── layout.tsx
│ ├── page.tsx
│ ├── login/
│ ├── register/
│ └── dashboard/
├── components/
│ └── ui/ # shadcn/ui components
├── features/ # Feature modules
│ ├── auth/
│ │ └── server/
│ │ └── route.ts # Hono API routes
│ └── stripe/ # (if enabled)
├── lib/ # Shared utilities
│ ├── auth.ts
│ ├── logger.ts
│ ├── prisma.ts
│ ├── rpc.ts
│ ├── store.ts
│ └── utils.ts
├── middleware/
│ └── auth-middleware.ts
├── providers/
│ └── providers.tsx # React Query + Theme
├── workers/ # (if BullMQ enabled)
├── prisma/
│ └── schema.prisma
├── index.ts # Hono API server
├── docker-compose.yml # (if Docker enabled)
├── Dockerfile # (if Docker enabled)
└── package.jsonDevelopment
# Install dependencies
npm install
# Generate Prisma client
npx prisma generate
# Push schema to database
npx prisma db push
# Start development servers
npm run devThis starts:
- API server on http://localhost:3000
- Next.js app on http://localhost:3001
Scripts
| Script | Description |
|--------|-------------|
| npm run dev | Start API and UI in development |
| npm run dev:api | Start only the API server |
| npm run dev:ui | Start only the Next.js app |
| npm run dev:worker | Start the BullMQ worker (if enabled) |
| npm run build | Build for production |
| npm run start | Start production servers |
| npm run db:push | Push Prisma schema to database |
| npm run db:generate | Generate Prisma client |
| npm run db:studio | Open Prisma Studio |
Environment Variables
Copy .env.example to .env and configure:
# Required
DATABASE_URL=
JWT_SECRET=
# Optional (based on features)
LDAP_URL=
STRIPE_SECRET_KEY=
SMTP_HOST=
REDIS_HOST=Docker
If Docker was enabled:
# Start all services
docker-compose up -d
# Build and start
docker-compose up -d --buildAPI Routes
All API routes are prefixed with /api:
POST /api/auth/login- LoginPOST /api/auth/register- RegisterPOST /api/auth/logout- LogoutGET /api/auth/me- Get current userGET /api/auth/users- Get all users (admin)
If Stripe is enabled:
POST /api/stripe/checkout- Create checkout sessionPOST /api/stripe/portal- Create billing portal sessionPOST /api/stripe/webhook- Stripe webhook handler
Tech Stack
| Category | Technology | |----------|------------| | Frontend | Next.js 14, React 18, TypeScript | | API | Hono, Zod | | Database | Prisma | | State | Zustand, TanStack Query | | UI | Tailwind CSS, Radix UI, Lucide Icons | | Forms | React Hook Form, Zod | | Auth | JWT, bcrypt | | Logging | Winston |
License
MIT
