nextforge-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +187 -0
- package/bin/cli.js +666 -0
- package/package.json +45 -0
- package/templates/auth/ldap/ldap-service.ts +146 -0
- package/templates/base/app/dashboard/page.tsx +97 -0
- package/templates/base/app/globals.css +59 -0
- package/templates/base/app/layout.tsx +27 -0
- package/templates/base/app/login/page.tsx +118 -0
- package/templates/base/app/page.tsx +48 -0
- package/templates/base/app/register/page.tsx +164 -0
- package/templates/base/components/ui/button.tsx +52 -0
- package/templates/base/components/ui/card.tsx +78 -0
- package/templates/base/components/ui/input.tsx +24 -0
- package/templates/base/components/ui/label.tsx +23 -0
- package/templates/base/features/auth/server/route.ts +160 -0
- package/templates/base/index.ts +75 -0
- package/templates/base/lib/auth.ts +74 -0
- package/templates/base/lib/logger.ts +66 -0
- package/templates/base/lib/prisma.ts +15 -0
- package/templates/base/lib/rpc.ts +35 -0
- package/templates/base/lib/store.ts +53 -0
- package/templates/base/lib/utils.ts +6 -0
- package/templates/base/middleware/auth-middleware.ts +42 -0
- package/templates/base/next.config.js +10 -0
- package/templates/base/postcss.config.js +6 -0
- package/templates/base/providers/providers.tsx +32 -0
- package/templates/base/tailwind.config.ts +58 -0
- package/templates/base/tsconfig.json +26 -0
- package/templates/email/email-service.ts +120 -0
- package/templates/stripe/route.ts +147 -0
- package/templates/stripe/stripe-service.ts +117 -0
package/README.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# 🔥 NextForge CLI
|
|
2
|
+
|
|
3
|
+
Forge your next full-stack Next.js TypeScript application with a single command.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Next.js 14** with App Router
|
|
8
|
+
- **Hono** - Fast, lightweight API framework
|
|
9
|
+
- **Prisma** - Type-safe database ORM
|
|
10
|
+
- **TanStack Query** - Data fetching and caching
|
|
11
|
+
- **Zustand** - Lightweight state management
|
|
12
|
+
- **React Hook Form + Zod** - Form handling with validation
|
|
13
|
+
- **Tailwind CSS + shadcn/ui** - Beautiful, accessible components
|
|
14
|
+
- **next-themes** - Dark mode support
|
|
15
|
+
- **Recharts** - Data visualization
|
|
16
|
+
- **Winston** - Logging
|
|
17
|
+
|
|
18
|
+
## Optional Features
|
|
19
|
+
|
|
20
|
+
- **Authentication**
|
|
21
|
+
- Credentials (email/password)
|
|
22
|
+
- LDAP / Active Directory
|
|
23
|
+
- OAuth (Google, GitHub, etc.)
|
|
24
|
+
- **Stripe** - Payment processing
|
|
25
|
+
- **Nodemailer** - Email functionality
|
|
26
|
+
- **BullMQ + Redis** - Background job processing
|
|
27
|
+
- **Docker** - Container deployment
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Using npx (recommended)
|
|
33
|
+
npx nextforge-cli my-app
|
|
34
|
+
|
|
35
|
+
# Or install globally
|
|
36
|
+
npm install -g nextforge-cli
|
|
37
|
+
nextforge my-app
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
Run the CLI and answer the prompts:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx nextforge-cli
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You'll be asked about:
|
|
49
|
+
1. Project name
|
|
50
|
+
2. Database type (PostgreSQL, MySQL, SQL Server, SQLite)
|
|
51
|
+
3. Authentication (and which type)
|
|
52
|
+
4. Stripe integration
|
|
53
|
+
5. Email functionality
|
|
54
|
+
6. Background jobs (BullMQ)
|
|
55
|
+
7. Docker files
|
|
56
|
+
8. Package manager
|
|
57
|
+
|
|
58
|
+
## Project Structure
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
my-app/
|
|
62
|
+
├── app/ # Next.js App Router pages
|
|
63
|
+
│ ├── layout.tsx
|
|
64
|
+
│ ├── page.tsx
|
|
65
|
+
│ ├── login/
|
|
66
|
+
│ ├── register/
|
|
67
|
+
│ └── dashboard/
|
|
68
|
+
├── components/
|
|
69
|
+
│ └── ui/ # shadcn/ui components
|
|
70
|
+
├── features/ # Feature modules
|
|
71
|
+
│ ├── auth/
|
|
72
|
+
│ │ └── server/
|
|
73
|
+
│ │ └── route.ts # Hono API routes
|
|
74
|
+
│ └── stripe/ # (if enabled)
|
|
75
|
+
├── lib/ # Shared utilities
|
|
76
|
+
│ ├── auth.ts
|
|
77
|
+
│ ├── logger.ts
|
|
78
|
+
│ ├── prisma.ts
|
|
79
|
+
│ ├── rpc.ts
|
|
80
|
+
│ ├── store.ts
|
|
81
|
+
│ └── utils.ts
|
|
82
|
+
├── middleware/
|
|
83
|
+
│ └── auth-middleware.ts
|
|
84
|
+
├── providers/
|
|
85
|
+
│ └── providers.tsx # React Query + Theme
|
|
86
|
+
├── workers/ # (if BullMQ enabled)
|
|
87
|
+
├── prisma/
|
|
88
|
+
│ └── schema.prisma
|
|
89
|
+
├── index.ts # Hono API server
|
|
90
|
+
├── docker-compose.yml # (if Docker enabled)
|
|
91
|
+
├── Dockerfile # (if Docker enabled)
|
|
92
|
+
└── package.json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Install dependencies
|
|
99
|
+
npm install
|
|
100
|
+
|
|
101
|
+
# Generate Prisma client
|
|
102
|
+
npx prisma generate
|
|
103
|
+
|
|
104
|
+
# Push schema to database
|
|
105
|
+
npx prisma db push
|
|
106
|
+
|
|
107
|
+
# Start development servers
|
|
108
|
+
npm run dev
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
This starts:
|
|
112
|
+
- API server on http://localhost:3000
|
|
113
|
+
- Next.js app on http://localhost:3001
|
|
114
|
+
|
|
115
|
+
## Scripts
|
|
116
|
+
|
|
117
|
+
| Script | Description |
|
|
118
|
+
|--------|-------------|
|
|
119
|
+
| `npm run dev` | Start API and UI in development |
|
|
120
|
+
| `npm run dev:api` | Start only the API server |
|
|
121
|
+
| `npm run dev:ui` | Start only the Next.js app |
|
|
122
|
+
| `npm run dev:worker` | Start the BullMQ worker (if enabled) |
|
|
123
|
+
| `npm run build` | Build for production |
|
|
124
|
+
| `npm run start` | Start production servers |
|
|
125
|
+
| `npm run db:push` | Push Prisma schema to database |
|
|
126
|
+
| `npm run db:generate` | Generate Prisma client |
|
|
127
|
+
| `npm run db:studio` | Open Prisma Studio |
|
|
128
|
+
|
|
129
|
+
## Environment Variables
|
|
130
|
+
|
|
131
|
+
Copy `.env.example` to `.env` and configure:
|
|
132
|
+
|
|
133
|
+
```env
|
|
134
|
+
# Required
|
|
135
|
+
DATABASE_URL=
|
|
136
|
+
JWT_SECRET=
|
|
137
|
+
|
|
138
|
+
# Optional (based on features)
|
|
139
|
+
LDAP_URL=
|
|
140
|
+
STRIPE_SECRET_KEY=
|
|
141
|
+
SMTP_HOST=
|
|
142
|
+
REDIS_HOST=
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Docker
|
|
146
|
+
|
|
147
|
+
If Docker was enabled:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Start all services
|
|
151
|
+
docker-compose up -d
|
|
152
|
+
|
|
153
|
+
# Build and start
|
|
154
|
+
docker-compose up -d --build
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## API Routes
|
|
158
|
+
|
|
159
|
+
All API routes are prefixed with `/api`:
|
|
160
|
+
|
|
161
|
+
- `POST /api/auth/login` - Login
|
|
162
|
+
- `POST /api/auth/register` - Register
|
|
163
|
+
- `POST /api/auth/logout` - Logout
|
|
164
|
+
- `GET /api/auth/me` - Get current user
|
|
165
|
+
- `GET /api/auth/users` - Get all users (admin)
|
|
166
|
+
|
|
167
|
+
If Stripe is enabled:
|
|
168
|
+
- `POST /api/stripe/checkout` - Create checkout session
|
|
169
|
+
- `POST /api/stripe/portal` - Create billing portal session
|
|
170
|
+
- `POST /api/stripe/webhook` - Stripe webhook handler
|
|
171
|
+
|
|
172
|
+
## Tech Stack
|
|
173
|
+
|
|
174
|
+
| Category | Technology |
|
|
175
|
+
|----------|------------|
|
|
176
|
+
| Frontend | Next.js 14, React 18, TypeScript |
|
|
177
|
+
| API | Hono, Zod |
|
|
178
|
+
| Database | Prisma |
|
|
179
|
+
| State | Zustand, TanStack Query |
|
|
180
|
+
| UI | Tailwind CSS, Radix UI, Lucide Icons |
|
|
181
|
+
| Forms | React Hook Form, Zod |
|
|
182
|
+
| Auth | JWT, bcrypt |
|
|
183
|
+
| Logging | Winston |
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
MIT
|