express-genix 4.1.0 → 4.2.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 +23 -2
- package/index.js +36 -4
- package/package.json +1 -1
- package/templates/core/env.ejs +11 -8
- package/templates/core/env.example.ejs +11 -8
package/README.md
CHANGED
|
@@ -93,6 +93,7 @@ You'll be prompted for:
|
|
|
93
93
|
3. **Database** — MongoDB, PostgreSQL (Sequelize), PostgreSQL (Prisma), or None
|
|
94
94
|
4. **Features** — Auth, Rate Limiting, Swagger, Redis, Docker, CI/CD, WebSocket, Request ID, Email, File Uploads, Soft Deletes, Audit Logging, Prometheus Metrics, API Versioning, Background Jobs, GraphQL, MCP Server, AI/LLM Service
|
|
95
95
|
5. **Logger** — Winston or Pino
|
|
96
|
+
6. **AI Provider** _(if AI selected)_ — OpenAI, Anthropic, Google Gemini, or Ollama (local)
|
|
96
97
|
|
|
97
98
|
The CLI generates your project, installs dependencies, formats code, and creates an initial git commit.
|
|
98
99
|
|
|
@@ -210,6 +211,26 @@ my-express-app/
|
|
|
210
211
|
| GET | `/graphql` | GraphQL Playground (Apollo Server) |
|
|
211
212
|
|
|
212
213
|
### AI / LLM (LangChain)
|
|
214
|
+
|
|
215
|
+
When you select the **AI / LLM Service** feature, you'll be asked to pick a provider:
|
|
216
|
+
|
|
217
|
+
| Provider | Models | API Key Required |
|
|
218
|
+
|----------|--------|------------------|
|
|
219
|
+
| **OpenAI** | GPT-4o, GPT-4o-mini | `OPENAI_API_KEY` |
|
|
220
|
+
| **Anthropic** | Claude Sonnet, Claude Opus | `ANTHROPIC_API_KEY` |
|
|
221
|
+
| **Google Gemini** | Gemini 2.0 Flash | `GOOGLE_API_KEY` |
|
|
222
|
+
| **Ollama** | Llama 3, Mistral, etc. | None (runs locally) |
|
|
223
|
+
|
|
224
|
+
The CLI generates your `.env` with the correct provider, model, and API key variable — just fill in your key and run `npm run dev`.
|
|
225
|
+
|
|
226
|
+
For Ollama, install it from [ollama.com](https://ollama.com) and pull a model:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
ollama pull llama3
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Endpoints:**
|
|
233
|
+
|
|
213
234
|
| Method | Endpoint | Description |
|
|
214
235
|
|--------|----------|-------------|
|
|
215
236
|
| POST | `/api/ai/chat` | Chat with AI (complete response) |
|
|
@@ -267,8 +288,8 @@ Generated `.env` includes auto-generated JWT secrets:
|
|
|
267
288
|
| `UPLOAD_MAX_SIZE` | Max file upload size in bytes | `5242880` (5 MB) |
|
|
268
289
|
| `UPLOAD_DIR` | Upload destination directory | `uploads` |
|
|
269
290
|
| `MCP_SERVER_NAME` | MCP server display name | project name |
|
|
270
|
-
| `AI_PROVIDER` | LLM provider (
|
|
271
|
-
| `AI_MODEL` | Model name |
|
|
291
|
+
| `AI_PROVIDER` | LLM provider (set by CLI) | `openai` |
|
|
292
|
+
| `AI_MODEL` | Model name (set by CLI based on provider) | varies |
|
|
272
293
|
| `AI_TEMPERATURE` | Sampling temperature | `0.7` |
|
|
273
294
|
| `AI_MAX_TOKENS` | Max response tokens | `2048` |
|
|
274
295
|
| `OPENAI_API_KEY` | OpenAI API key (if using OpenAI) | — |
|
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const prompt = inquirer.createPromptModule();
|
|
|
15
15
|
const generateSecret = (length = 64) => crypto.randomBytes(length).toString('hex');
|
|
16
16
|
|
|
17
17
|
const CODA_EXTENSION_ID = 'express-genix.coda-ai';
|
|
18
|
-
const CODA_VSIX_URL = 'https://github.com/LambdaAI001/coda/releases/
|
|
18
|
+
const CODA_VSIX_URL = 'https://github.com/LambdaAI001/coda/releases/download/v0.2.0/coda-ai-0.2.0.vsix';
|
|
19
19
|
|
|
20
20
|
async function promptCodaExtension() {
|
|
21
21
|
const inquirerPrompt = inquirer.createPromptModule();
|
|
@@ -162,6 +162,18 @@ async function main() {
|
|
|
162
162
|
{ name: 'Pino (fast, low overhead)', value: 'pino' },
|
|
163
163
|
],
|
|
164
164
|
},
|
|
165
|
+
{
|
|
166
|
+
type: 'list',
|
|
167
|
+
name: 'aiProvider',
|
|
168
|
+
message: 'AI / LLM Provider:',
|
|
169
|
+
choices: [
|
|
170
|
+
{ name: 'OpenAI (GPT-4o, GPT-4o-mini)', value: 'openai' },
|
|
171
|
+
{ name: 'Anthropic (Claude)', value: 'anthropic' },
|
|
172
|
+
{ name: 'Google Gemini', value: 'gemini' },
|
|
173
|
+
{ name: 'Ollama (local, no API key needed)', value: 'ollama' },
|
|
174
|
+
],
|
|
175
|
+
when: (ans) => (ans.features || []).includes('ai'),
|
|
176
|
+
},
|
|
165
177
|
]);
|
|
166
178
|
|
|
167
179
|
const features = answers.features || [];
|
|
@@ -250,9 +262,15 @@ Configuration:
|
|
|
250
262
|
Database: ${config.isNoDatabase ? 'None' : config.db}
|
|
251
263
|
Authentication: ${config.hasAuth ? 'JWT with refresh tokens' : 'None'}
|
|
252
264
|
Logger: ${config.logger}
|
|
253
|
-
Features: ${features.join(', ') || 'base'}
|
|
265
|
+
Features: ${features.join(', ') || 'base'}${config.hasAI ? `\n AI Provider: ${config.aiProvider}` : ''}
|
|
254
266
|
`);
|
|
255
267
|
|
|
268
|
+
if (config.hasAI && config.aiProvider !== 'ollama') {
|
|
269
|
+
const keyMap = { openai: 'OPENAI_API_KEY', anthropic: 'ANTHROPIC_API_KEY', gemini: 'GOOGLE_API_KEY' };
|
|
270
|
+
console.log(`\x1b[33m⚠ Don't forget to set your API key in .env:\x1b[0m`);
|
|
271
|
+
console.log(` ${keyMap[config.aiProvider]}=your-key-here\n`);
|
|
272
|
+
}
|
|
273
|
+
|
|
256
274
|
// Prompt to install Coda VS Code extension for AI/MCP projects
|
|
257
275
|
if (config.hasAI || config.hasMCP) {
|
|
258
276
|
await promptCodaExtension();
|
|
@@ -310,20 +328,33 @@ Configuration:
|
|
|
310
328
|
const aiConfig = await runAiCommand(description);
|
|
311
329
|
|
|
312
330
|
const inquirerPrompt = inquirer.createPromptModule();
|
|
313
|
-
const
|
|
331
|
+
const aiFollowUp = await inquirerPrompt([
|
|
314
332
|
{
|
|
315
333
|
type: 'confirm',
|
|
316
334
|
name: 'confirmed',
|
|
317
335
|
message: 'Generate project with this configuration?',
|
|
318
336
|
default: true,
|
|
319
337
|
},
|
|
338
|
+
{
|
|
339
|
+
type: 'list',
|
|
340
|
+
name: 'aiProvider',
|
|
341
|
+
message: 'AI / LLM Provider:',
|
|
342
|
+
choices: [
|
|
343
|
+
{ name: 'OpenAI (GPT-4o, GPT-4o-mini)', value: 'openai' },
|
|
344
|
+
{ name: 'Anthropic (Claude)', value: 'anthropic' },
|
|
345
|
+
{ name: 'Google Gemini', value: 'gemini' },
|
|
346
|
+
{ name: 'Ollama (local, no API key needed)', value: 'ollama' },
|
|
347
|
+
],
|
|
348
|
+
when: (ans) => ans.confirmed && (aiConfig.features || []).includes('ai'),
|
|
349
|
+
},
|
|
320
350
|
]);
|
|
321
351
|
|
|
322
|
-
if (!confirmed) {
|
|
352
|
+
if (!aiFollowUp.confirmed) {
|
|
323
353
|
console.log('Cancelled.');
|
|
324
354
|
process.exit(0);
|
|
325
355
|
}
|
|
326
356
|
|
|
357
|
+
aiConfig.aiProvider = aiFollowUp.aiProvider || 'openai';
|
|
327
358
|
const features = aiConfig.features || [];
|
|
328
359
|
const config = {
|
|
329
360
|
projectName: aiConfig.projectName,
|
|
@@ -352,6 +383,7 @@ Configuration:
|
|
|
352
383
|
hasGraphQL: features.includes('graphql'),
|
|
353
384
|
hasMCP: features.includes('mcp'),
|
|
354
385
|
hasAI: features.includes('ai'),
|
|
386
|
+
aiProvider: aiConfig.aiProvider || 'openai',
|
|
355
387
|
jwtSecret: generateSecret(),
|
|
356
388
|
jwtRefreshSecret: generateSecret(),
|
|
357
389
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-genix",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Production-grade CLI to generate Express apps with JWT, RBAC, GraphQL, TypeScript, Prisma, MongoDB, PostgreSQL, file uploads, email, background jobs, and more",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
package/templates/core/env.ejs
CHANGED
|
@@ -33,15 +33,18 @@ UPLOAD_MAX_SIZE=5242880
|
|
|
33
33
|
MCP_SERVER_NAME=<%= projectName %>
|
|
34
34
|
<% } %><% if (hasAI) { %>
|
|
35
35
|
# AI Service (LangChain)
|
|
36
|
-
AI_PROVIDER
|
|
37
|
-
AI_MODEL=gpt-4o-mini
|
|
38
|
-
|
|
36
|
+
AI_PROVIDER=<%= aiProvider %>
|
|
37
|
+
<% if (aiProvider === 'openai') { %>AI_MODEL=gpt-4o-mini
|
|
38
|
+
<% } else if (aiProvider === 'anthropic') { %>AI_MODEL=claude-sonnet-4-20250514
|
|
39
|
+
<% } else if (aiProvider === 'gemini') { %>AI_MODEL=gemini-2.0-flash
|
|
40
|
+
<% } else if (aiProvider === 'ollama') { %>AI_MODEL=llama3
|
|
41
|
+
<% } %>AI_TEMPERATURE=0.7
|
|
39
42
|
AI_MAX_TOKENS=2048
|
|
40
|
-
OPENAI_API_KEY=
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<% } %><% if (db === 'mongodb') { %>
|
|
43
|
+
<% if (aiProvider === 'openai') { %>OPENAI_API_KEY=
|
|
44
|
+
<% } else if (aiProvider === 'anthropic') { %>ANTHROPIC_API_KEY=
|
|
45
|
+
<% } else if (aiProvider === 'gemini') { %>GOOGLE_API_KEY=
|
|
46
|
+
<% } else if (aiProvider === 'ollama') { %>OLLAMA_BASE_URL=http://localhost:11434
|
|
47
|
+
<% } %><% } %><% if (db === 'mongodb') { %>
|
|
45
48
|
# Database
|
|
46
49
|
MONGO_URI=mongodb://localhost:27017/<%= projectName %>
|
|
47
50
|
<% } %><% if (db === 'postgresql' || isPrisma) { %>
|
|
@@ -33,15 +33,18 @@ UPLOAD_MAX_SIZE=5242880
|
|
|
33
33
|
MCP_SERVER_NAME=<%= projectName %>
|
|
34
34
|
<% } %><% if (hasAI) { %>
|
|
35
35
|
# AI Service (LangChain)
|
|
36
|
-
AI_PROVIDER
|
|
37
|
-
AI_MODEL=gpt-4o-mini
|
|
38
|
-
|
|
36
|
+
AI_PROVIDER=<%= aiProvider %>
|
|
37
|
+
<% if (aiProvider === 'openai') { %>AI_MODEL=gpt-4o-mini
|
|
38
|
+
<% } else if (aiProvider === 'anthropic') { %>AI_MODEL=claude-sonnet-4-20250514
|
|
39
|
+
<% } else if (aiProvider === 'gemini') { %>AI_MODEL=gemini-2.0-flash
|
|
40
|
+
<% } else if (aiProvider === 'ollama') { %>AI_MODEL=llama3
|
|
41
|
+
<% } %>AI_TEMPERATURE=0.7
|
|
39
42
|
AI_MAX_TOKENS=2048
|
|
40
|
-
OPENAI_API_KEY=
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<% } %><% if (db === 'mongodb') { %>
|
|
43
|
+
<% if (aiProvider === 'openai') { %>OPENAI_API_KEY=
|
|
44
|
+
<% } else if (aiProvider === 'anthropic') { %>ANTHROPIC_API_KEY=
|
|
45
|
+
<% } else if (aiProvider === 'gemini') { %>GOOGLE_API_KEY=
|
|
46
|
+
<% } else if (aiProvider === 'ollama') { %>OLLAMA_BASE_URL=http://localhost:11434
|
|
47
|
+
<% } %><% } %><% if (db === 'mongodb') { %>
|
|
45
48
|
# Database
|
|
46
49
|
MONGO_URI=mongodb://localhost:27017/<%= projectName %>
|
|
47
50
|
<% } %><% if (db === 'postgresql' || isPrisma) { %>
|