nexforge-cli 1.0.7 → 1.0.9

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The official Command Line Interface for **NexForge** - Your custom Platform as a Service (PaaS).
4
4
  Deploy, manage, and scale your applications directly from your terminal with zero friction!
5
- <a href="https://nexforge-zeta.vercel.app/">Visit Nexforge</a>
5
+ <a href="https://nexforge-sandy.vercel.app/">Visit Nexforge</a>
6
6
 
7
7
  ## Installation
8
8
 
@@ -59,12 +59,17 @@ nexforge init
59
59
  nexforge create
60
60
  ```
61
61
 
62
- **Details:**
62
+ **How it works (Step-by-Step):**
63
63
 
64
- - Interactively asks for your **Project Name** and **Tech Stack** (Next.js, MERN, Frontend, Backend).
65
- - Generates a fully configured folder structure matching NexForge's custom standards.
66
- - Pre-installs all necessary libraries (Tailwind, Framer Motion, AWS SDK, Mongoose, AI SDKs, Socket.io, etc.).
67
- - Automatically sets up boilerplate code like `server.js` or `App.jsx` and configures TailwindCSS.
64
+ 1. **Run the Command:** Type `nexforge create` in your terminal.
65
+ 2. **Project Name:** The CLI will ask for a project name (e.g., `my-awesome-app`). It will create a new folder with this name.
66
+ 3. **Select your Stack:** You will be prompted to choose from 4 professional templates:
67
+ - **Frontend Only (React + Vite):** Generates a full React structure with Tailwind CSS, Framer Motion, GSAP, and all your UI components pre-configured.
68
+ - **Backend Only (Node + Express):** Generates an industry-standard MVC architecture (Controllers, Routes, Models) with Express, Mongoose, Socket.io, Redis, AWS SDK, and AI SDKs pre-installed.
69
+ - **MERN Stack:** Automatically creates a parent folder containing both the `frontend` and `backend` structures side-by-side.
70
+ - **Next.js (App Router):** Generates a Next.js App Router project packed with all UI and Backend dependencies, including an `app/api` folder for your backend routes.
71
+ 4. **Automatic Setup:** The CLI will magically generate the exact folder structures, boilerplate code (like `server.js` or `App.jsx`), configuration files (`tailwind.config.js`), and automatically run `npm install` for you!
72
+ 5. **Ready to Deploy:** Once finished, simply `cd` into your new folder, run `nexforge init` to connect it to your account, and `nexforge deploy` to take it live!
68
73
 
69
74
  ---
70
75
 
@@ -157,4 +162,51 @@ nexforge rename
157
162
 
158
163
  ---
159
164
 
165
+ ### ℹ️ 9. `nexforge info`
166
+
167
+ **Description:** View your current project's status and details.
168
+ **Usage:**
169
+
170
+ ```bash
171
+ nexforge info
172
+ ```
173
+
174
+ **Details:**
175
+
176
+ - Fetches and displays your project name, framework, custom domains, live URL, and latest deployment status directly in the terminal.
177
+
178
+ ---
179
+
180
+ ### 🌐 10. `nexforge domains`
181
+
182
+ **Description:** Manage custom domains for your project.
183
+ **Usage:**
184
+
185
+ ```bash
186
+ nexforge domains add <your-domain.com>
187
+ nexforge domains ls
188
+ ```
189
+
190
+ **Details:**
191
+
192
+ - `add`: Links a new custom domain to your project without opening the dashboard.
193
+ - `ls`: Lists all custom domains currently linked to your project.
194
+
195
+ ---
196
+
197
+ ### 🌍 11. `nexforge open`
198
+
199
+ **Description:** Opens your live project in your default web browser.
200
+ **Usage:**
201
+
202
+ ```bash
203
+ nexforge open
204
+ ```
205
+
206
+ **Details:**
207
+
208
+ - Fetches your project's live URL and instantly opens it in your host OS browser.
209
+
210
+ ---
211
+
160
212
  ### Built With ❤️ by Manav Sharma
package/index.js CHANGED
@@ -15,6 +15,9 @@ require("./src/commands/logs")(program)
15
15
  require("./src/commands/rollback")(program)
16
16
  require("./src/commands/rename")(program)
17
17
  require("./src/commands/create")(program)
18
+ require("./src/commands/info")(program)
19
+ require("./src/commands/domains")(program)
20
+ require("./src/commands/open")(program)
18
21
 
19
22
  // Parse the arguments passed by the user in the terminal
20
23
  program.parse(process.argv)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexforge-cli",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Custom Deployment CLI for NexForge",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,76 @@
1
+ const fs = require("fs")
2
+ const path = require("path")
3
+ const axios = require("axios")
4
+ const chalk = require("chalk")
5
+ const ora = require("ora")
6
+ const { getNexforgeConfig } = require("../config")
7
+
8
+ module.exports = (program) => {
9
+ program
10
+ .command("domains <action> [domainName]")
11
+ .description("Manage custom domains (actions: add, ls)")
12
+ .action(async (action, domainName) => {
13
+ if (action !== "add" && action !== "ls") {
14
+ console.error(chalk.red("Invalid action. Use 'nexforge domains add <domain>' or 'nexforge domains ls'"))
15
+ return
16
+ }
17
+
18
+ const spinner = ora(action === "add" ? "Adding domain..." : "Fetching domains...").start()
19
+
20
+ try {
21
+ const config = getNexforgeConfig()
22
+
23
+ // Check if project is linked
24
+ const projectFilePath = path.join(process.cwd(), ".nexforge")
25
+ if (!fs.existsSync(projectFilePath)) {
26
+ spinner.fail("No NexForge project found in this directory.")
27
+ return
28
+ }
29
+
30
+ const { projectId } = JSON.parse(fs.readFileSync(projectFilePath, "utf8"))
31
+ const API_BASE_URL = process.env.NEXFORGE_API_URL || "https://api.nexforge.me/api"
32
+
33
+ if (action === "ls") {
34
+ const response = await axios.get(`${API_BASE_URL}/cli/domains/${projectId}`, {
35
+ headers: { Authorization: `Bearer ${config.token}` },
36
+ })
37
+ spinner.stop()
38
+
39
+ const { domains } = response.data
40
+ if (!domains || domains.length === 0) {
41
+ console.log(chalk.gray("No custom domains linked to this project."))
42
+ return
43
+ }
44
+
45
+ console.log(chalk.bold.cyan("\n🌐 Linked Domains\n"))
46
+ domains.forEach(d => {
47
+ console.log(` - ${chalk.white(d.name)}`)
48
+ })
49
+ console.log("\n")
50
+ }
51
+
52
+ if (action === "add") {
53
+ if (!domainName) {
54
+ spinner.fail("Please specify a domain name. Example: nexforge domains add myapp.com")
55
+ return
56
+ }
57
+
58
+ const response = await axios.post(`${API_BASE_URL}/cli/domains/${projectId}`,
59
+ { domain: domainName },
60
+ { headers: { Authorization: `Bearer ${config.token}` } }
61
+ )
62
+
63
+ spinner.succeed(chalk.green(`Domain ${chalk.bold(response.data.domain)} added successfully!`))
64
+ console.log(chalk.gray("Note: Ensure you point your DNS A Record to NexForge servers."))
65
+ }
66
+
67
+ } catch (error) {
68
+ spinner.fail("Failed to process domains command")
69
+ if (error.response) {
70
+ console.error(chalk.red(`Error: ${error.response.data.error || error.response.data.message || error.response.statusText}`))
71
+ } else {
72
+ console.error(chalk.red(error.message))
73
+ }
74
+ }
75
+ })
76
+ }
@@ -0,0 +1,60 @@
1
+ const fs = require("fs")
2
+ const path = require("path")
3
+ const axios = require("axios")
4
+ const chalk = require("chalk")
5
+ const ora = require("ora")
6
+ const { getNexforgeConfig } = require("../config")
7
+
8
+ module.exports = (program) => {
9
+ program
10
+ .command("info")
11
+ .description("View project info and status")
12
+ .action(async () => {
13
+ const spinner = ora("Fetching project info...").start()
14
+ try {
15
+ const config = getNexforgeConfig()
16
+
17
+ // Check if project is linked
18
+ const projectFilePath = path.join(process.cwd(), ".nexforge")
19
+ if (!fs.existsSync(projectFilePath)) {
20
+ spinner.fail("No NexForge project found in this directory.")
21
+ console.log(chalk.yellow("Hint: Run 'nexforge init' to link or create a project."))
22
+ return
23
+ }
24
+
25
+ const { projectId } = JSON.parse(fs.readFileSync(projectFilePath, "utf8"))
26
+
27
+ const API_BASE_URL = process.env.NEXFORGE_API_URL || "https://api.nexforge.me/api"
28
+
29
+ const response = await axios.get(`${API_BASE_URL}/cli/info/${projectId}`, {
30
+ headers: {
31
+ Authorization: `Bearer ${config.token}`,
32
+ },
33
+ })
34
+
35
+ spinner.stop()
36
+ const { project } = response.data
37
+
38
+ console.log(chalk.bold.cyan("\n📊 NexForge Project Info\n"))
39
+ console.log(`${chalk.gray("Name:")} ${chalk.white(project.projectName)}`)
40
+ console.log(`${chalk.gray("Framework:")} ${chalk.white(project.framework)}`)
41
+ console.log(`${chalk.gray("ID:")} ${chalk.white(project._id)}`)
42
+ console.log(`${chalk.gray("Status:")} ${project.latestDeploymentStatus === "SUCCESS" ? chalk.green("● Online") : chalk.yellow("● " + project.latestDeploymentStatus)}`)
43
+ console.log(`${chalk.gray("Live URL:")} ${chalk.blue.underline(project.liveUrl)}`)
44
+
45
+ if (project.domains && project.domains.length > 0) {
46
+ console.log(`\n${chalk.gray("Custom Domains:")}`)
47
+ project.domains.forEach(d => console.log(` - ${chalk.blue.underline("https://" + d)}`))
48
+ }
49
+ console.log("\n")
50
+
51
+ } catch (error) {
52
+ spinner.fail("Failed to fetch project info")
53
+ if (error.response) {
54
+ console.error(chalk.red(`Error: ${error.response.data.error || error.response.statusText}`))
55
+ } else {
56
+ console.error(chalk.red(error.message))
57
+ }
58
+ }
59
+ })
60
+ }
@@ -0,0 +1,56 @@
1
+ const fs = require("fs")
2
+ const path = require("path")
3
+ const axios = require("axios")
4
+ const chalk = require("chalk")
5
+ const ora = require("ora")
6
+ const { exec } = require("child_process")
7
+ const { getNexforgeConfig } = require("../config")
8
+
9
+ module.exports = (program) => {
10
+ program
11
+ .command("open")
12
+ .description("Open the live project in your browser")
13
+ .action(async () => {
14
+ const spinner = ora("Opening project in browser...").start()
15
+ try {
16
+ const config = getNexforgeConfig()
17
+
18
+ // Check if project is linked
19
+ const projectFilePath = path.join(process.cwd(), ".nexforge")
20
+ if (!fs.existsSync(projectFilePath)) {
21
+ spinner.fail("No NexForge project found in this directory.")
22
+ return
23
+ }
24
+
25
+ const { projectId } = JSON.parse(fs.readFileSync(projectFilePath, "utf8"))
26
+ const API_BASE_URL = process.env.NEXFORGE_API_URL || "https://api.nexforge.me/api"
27
+
28
+ const response = await axios.get(`${API_BASE_URL}/cli/info/${projectId}`, {
29
+ headers: {
30
+ Authorization: `Bearer ${config.token}`,
31
+ },
32
+ })
33
+
34
+ const { project } = response.data
35
+ const url = project.liveUrl
36
+
37
+ spinner.succeed(`Opening ${chalk.blue.underline(url)}`)
38
+
39
+ // Cross-platform open command
40
+ const startCmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open'
41
+ exec(`${startCmd} ${url}`, (err) => {
42
+ if (err) {
43
+ console.error(chalk.red(`Failed to open browser automatically. Please visit: ${url}`))
44
+ }
45
+ })
46
+
47
+ } catch (error) {
48
+ spinner.fail("Failed to open project")
49
+ if (error.response) {
50
+ console.error(chalk.red(`Error: ${error.response.data.error || error.response.statusText}`))
51
+ } else {
52
+ console.error(chalk.red(error.message))
53
+ }
54
+ }
55
+ })
56
+ }