odac 0.9.0 → 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.
Files changed (208) hide show
  1. package/.github/workflows/auto-pr-description.yml +0 -2
  2. package/.github/workflows/codeql.yml +46 -0
  3. package/.github/workflows/release.yml +13 -6
  4. package/.github/workflows/test-coverage.yml +10 -9
  5. package/.releaserc.js +9 -6
  6. package/CHANGELOG.md +62 -150
  7. package/CODE_OF_CONDUCT.md +1 -1
  8. package/CONTRIBUTING.md +8 -8
  9. package/LICENSE +21 -661
  10. package/README.md +12 -12
  11. package/SECURITY.md +4 -4
  12. package/bin/odac.js +101 -0
  13. package/{framework/web/candy.js → client/odac.js} +310 -44
  14. package/docs/backend/01-overview/{01-whats-in-the-candy-box.md → 01-whats-in-the-odac-box.md} +4 -2
  15. package/docs/backend/01-overview/02-super-handy-helper-functions.md +29 -1
  16. package/docs/backend/01-overview/03-development-server.md +11 -11
  17. package/docs/backend/02-structure/01-typical-project-layout.md +4 -4
  18. package/docs/backend/03-config/00-configuration-overview.md +6 -6
  19. package/docs/backend/03-config/01-database-connection.md +1 -1
  20. package/docs/backend/03-config/02-static-route-mapping-optional.md +4 -4
  21. package/docs/backend/03-config/04-environment-variables.md +20 -20
  22. package/docs/backend/03-config/05-early-hints.md +4 -4
  23. package/docs/backend/04-routing/01-basic-page-routes.md +4 -4
  24. package/docs/backend/04-routing/02-controller-less-view-routes.md +5 -5
  25. package/docs/backend/04-routing/03-api-and-data-routes.md +3 -3
  26. package/docs/backend/04-routing/04-authentication-aware-routes.md +5 -5
  27. package/docs/backend/04-routing/05-advanced-routing.md +3 -3
  28. package/docs/backend/04-routing/06-error-pages.md +17 -17
  29. package/docs/backend/04-routing/07-cron-jobs.md +13 -13
  30. package/docs/backend/04-routing/08-middleware.md +214 -0
  31. package/docs/backend/04-routing/09-websocket-auth-middleware.md +292 -0
  32. package/docs/backend/04-routing/09-websocket-examples.md +381 -0
  33. package/docs/backend/04-routing/09-websocket-quick-reference.md +211 -0
  34. package/docs/backend/04-routing/09-websocket.md +298 -0
  35. package/docs/backend/05-controllers/01-how-to-build-a-controller.md +3 -3
  36. package/docs/backend/05-controllers/02-your-trusty-odac-assistant.md +41 -0
  37. package/docs/backend/05-controllers/03-controller-classes.md +19 -19
  38. package/docs/backend/05-forms/01-custom-forms.md +114 -114
  39. package/docs/backend/05-forms/02-automatic-database-insert.md +82 -82
  40. package/docs/backend/06-request-and-response/01-the-request-object-what-is-the-user-asking-for.md +26 -26
  41. package/docs/backend/06-request-and-response/02-sending-a-response-replying-to-the-user.md +10 -10
  42. package/docs/backend/07-views/01-the-view-directory.md +1 -1
  43. package/docs/backend/07-views/02-rendering-a-view.md +22 -22
  44. package/docs/backend/07-views/03-template-syntax.md +52 -52
  45. package/docs/backend/07-views/03-variables.md +84 -84
  46. package/docs/backend/07-views/04-request-data.md +57 -57
  47. package/docs/backend/07-views/05-conditionals.md +78 -78
  48. package/docs/backend/07-views/06-loops.md +114 -114
  49. package/docs/backend/07-views/07-translations.md +66 -66
  50. package/docs/backend/07-views/08-backend-javascript.md +103 -103
  51. package/docs/backend/07-views/09-comments.md +71 -71
  52. package/docs/backend/08-database/01-database-connection.md +8 -8
  53. package/docs/backend/08-database/02-using-mysql.md +49 -49
  54. package/docs/backend/09-validation/01-the-validator-service.md +38 -38
  55. package/docs/backend/10-authentication/01-user-logins-with-authjs.md +15 -15
  56. package/docs/backend/10-authentication/02-foiling-villains-with-csrf-protection.md +10 -10
  57. package/docs/backend/10-authentication/03-register.md +12 -12
  58. package/docs/backend/10-authentication/{04-candy-register-forms.md → 04-odac-register-forms.md} +141 -141
  59. package/docs/backend/10-authentication/05-session-management.md +10 -10
  60. package/docs/backend/10-authentication/{06-candy-login-forms.md → 06-odac-login-forms.md} +125 -125
  61. package/docs/backend/11-mail/01-the-mail-service.md +5 -5
  62. package/docs/backend/12-streaming/01-streaming-overview.md +96 -54
  63. package/docs/backend/13-utilities/{01-candy-var.md → 01-odac-var.md} +109 -109
  64. package/docs/frontend/01-overview/01-introduction.md +30 -30
  65. package/docs/frontend/02-ajax-navigation/01-quick-start.md +45 -45
  66. package/docs/frontend/02-ajax-navigation/02-configuration.md +14 -14
  67. package/docs/frontend/02-ajax-navigation/03-advanced-usage.md +36 -36
  68. package/docs/frontend/03-forms/01-form-handling.md +32 -32
  69. package/docs/frontend/04-api-requests/01-get-post.md +33 -33
  70. package/docs/frontend/05-streaming/01-client-streaming.md +15 -15
  71. package/docs/frontend/06-websocket/00-overview.md +76 -0
  72. package/docs/frontend/06-websocket/01-websocket-client.md +139 -0
  73. package/docs/frontend/06-websocket/02-shared-websocket.md +149 -0
  74. package/docs/index.json +49 -11
  75. package/eslint.config.mjs +6 -6
  76. package/{framework/index.js → index.js} +1 -1
  77. package/package.json +14 -39
  78. package/{framework/src → src}/Auth.js +59 -59
  79. package/{framework/src → src}/Config.js +3 -3
  80. package/{framework/src → src}/Lang.js +7 -7
  81. package/{framework/src → src}/Mail.js +5 -5
  82. package/{framework/src → src}/Mysql.js +42 -42
  83. package/src/Odac.js +112 -0
  84. package/{framework/src → src}/Request.js +38 -36
  85. package/{framework/src → src}/Route/Internal.js +116 -116
  86. package/src/Route/Middleware.js +75 -0
  87. package/src/Route.js +621 -0
  88. package/src/Server.js +22 -0
  89. package/{framework/src → src}/Stream.js +11 -3
  90. package/{framework/src → src}/Validator.js +21 -21
  91. package/{framework/src → src}/Var.js +5 -5
  92. package/{framework/src → src}/View/EarlyHints.js +1 -1
  93. package/{framework/src → src}/View/Form.js +69 -69
  94. package/{framework/src → src}/View.js +78 -81
  95. package/src/WebSocket.js +403 -0
  96. package/template/config.json +5 -0
  97. package/{web → template}/controller/page/about.js +6 -6
  98. package/{web → template}/controller/page/index.js +9 -9
  99. package/{web → template}/package.json +4 -5
  100. package/{web → template}/public/assets/css/style.css +4 -4
  101. package/{web → template}/public/assets/js/app.js +6 -6
  102. package/{web → template}/route/www.js +6 -6
  103. package/{web → template}/skeleton/main.html +1 -1
  104. package/{web → template}/view/content/about.html +5 -5
  105. package/{web → template}/view/content/home.html +12 -12
  106. package/template/view/footer/main.html +11 -0
  107. package/{web → template}/view/head/main.html +1 -1
  108. package/{web → template}/view/header/main.html +2 -2
  109. package/test/core/Candy.test.js +58 -58
  110. package/test/core/Commands.test.js +7 -7
  111. package/test/core/Config.test.js +82 -85
  112. package/test/core/Lang.test.js +2 -2
  113. package/test/core/Process.test.js +6 -6
  114. package/test/framework/Route.test.js +56 -37
  115. package/test/framework/View/EarlyHints.test.js +2 -2
  116. package/test/framework/WebSocket.test.js +100 -0
  117. package/test/framework/middleware.test.js +85 -0
  118. package/test/server/Api.test.js +31 -31
  119. package/test/server/DNS.test.js +11 -11
  120. package/test/server/Hub.test.js +497 -0
  121. package/test/server/Mail.account.test_.js +3 -3
  122. package/test/server/Mail.init.test_.js +10 -10
  123. package/test/server/Mail.test_.js +20 -20
  124. package/test/server/SSL.test_.js +54 -54
  125. package/test/server/Server.test.js +39 -39
  126. package/test/server/Service.test_.js +7 -7
  127. package/test/server/Subdomain.test.js +7 -7
  128. package/test/server/Web/Firewall.test.js +87 -87
  129. package/test/server/Web/Proxy.test.js +397 -0
  130. package/test/server/{Web.test_.js → Web.test.js} +137 -205
  131. package/test/server/__mocks__/fs.js +2 -2
  132. package/test/server/__mocks__/{globalCandy.js → globalOdac.js} +5 -5
  133. package/test/server/__mocks__/index.js +6 -6
  134. package/test/server/__mocks__/testFactories.js +1 -1
  135. package/test/server/__mocks__/testHelpers.js +7 -7
  136. package/.husky/pre-commit +0 -2
  137. package/.kiro/steering/code-style.md +0 -56
  138. package/.kiro/steering/product.md +0 -20
  139. package/.kiro/steering/structure.md +0 -77
  140. package/.kiro/steering/tech.md +0 -87
  141. package/AGENTS.md +0 -84
  142. package/bin/candy +0 -10
  143. package/bin/candypack +0 -10
  144. package/cli/index.js +0 -3
  145. package/cli/src/Cli.js +0 -348
  146. package/cli/src/Connector.js +0 -93
  147. package/cli/src/Monitor.js +0 -416
  148. package/core/Candy.js +0 -87
  149. package/core/Commands.js +0 -239
  150. package/core/Config.js +0 -1094
  151. package/core/Lang.js +0 -52
  152. package/core/Log.js +0 -43
  153. package/core/Process.js +0 -26
  154. package/docs/backend/05-controllers/02-your-trusty-candy-assistant.md +0 -20
  155. package/docs/server/01-installation/01-quick-install.md +0 -19
  156. package/docs/server/01-installation/02-manual-installation-via-npm.md +0 -9
  157. package/docs/server/02-get-started/01-core-concepts.md +0 -7
  158. package/docs/server/02-get-started/02-basic-commands.md +0 -57
  159. package/docs/server/02-get-started/03-cli-reference.md +0 -276
  160. package/docs/server/02-get-started/04-cli-quick-reference.md +0 -102
  161. package/docs/server/03-service/01-start-a-new-service.md +0 -57
  162. package/docs/server/03-service/02-delete-a-service.md +0 -48
  163. package/docs/server/04-web/01-create-a-website.md +0 -36
  164. package/docs/server/04-web/02-list-websites.md +0 -9
  165. package/docs/server/04-web/03-delete-a-website.md +0 -29
  166. package/docs/server/05-subdomain/01-create-a-subdomain.md +0 -32
  167. package/docs/server/05-subdomain/02-list-subdomains.md +0 -33
  168. package/docs/server/05-subdomain/03-delete-a-subdomain.md +0 -41
  169. package/docs/server/06-ssl/01-renew-an-ssl-certificate.md +0 -34
  170. package/docs/server/07-mail/01-create-a-mail-account.md +0 -23
  171. package/docs/server/07-mail/02-delete-a-mail-account.md +0 -20
  172. package/docs/server/07-mail/03-list-mail-accounts.md +0 -20
  173. package/docs/server/07-mail/04-change-account-password.md +0 -23
  174. package/framework/src/Candy.js +0 -81
  175. package/framework/src/Route.js +0 -455
  176. package/framework/src/Server.js +0 -15
  177. package/locale/de-DE.json +0 -80
  178. package/locale/en-US.json +0 -79
  179. package/locale/es-ES.json +0 -80
  180. package/locale/fr-FR.json +0 -80
  181. package/locale/pt-BR.json +0 -80
  182. package/locale/ru-RU.json +0 -80
  183. package/locale/tr-TR.json +0 -85
  184. package/locale/zh-CN.json +0 -80
  185. package/server/index.js +0 -5
  186. package/server/src/Api.js +0 -88
  187. package/server/src/DNS.js +0 -940
  188. package/server/src/Hub.js +0 -535
  189. package/server/src/Mail.js +0 -571
  190. package/server/src/SSL.js +0 -180
  191. package/server/src/Server.js +0 -27
  192. package/server/src/Service.js +0 -248
  193. package/server/src/Subdomain.js +0 -64
  194. package/server/src/Web/Firewall.js +0 -170
  195. package/server/src/Web/Proxy.js +0 -134
  196. package/server/src/Web.js +0 -451
  197. package/server/src/mail/imap.js +0 -1091
  198. package/server/src/mail/server.js +0 -32
  199. package/server/src/mail/smtp.js +0 -786
  200. package/test/server/Client.test.js +0 -338
  201. package/test/server/__mocks__/http-proxy.js +0 -105
  202. package/watchdog/index.js +0 -3
  203. package/watchdog/src/Watchdog.js +0 -156
  204. package/web/config.json +0 -5
  205. package/web/view/footer/main.html +0 -11
  206. /package/{framework/src → src}/Env.js +0 -0
  207. /package/{framework/src → src}/Route/Cron.js +0 -0
  208. /package/{framework/src → src}/Token.js +0 -0
package/core/Lang.js DELETED
@@ -1,52 +0,0 @@
1
- const fs = require('fs')
2
-
3
- class Lang {
4
- #locale = Intl.DateTimeFormat().resolvedOptions().locale
5
- #file = __dirname + '/../locale/' + this.#locale + '.json'
6
- #strings = {}
7
- #loaded = false
8
-
9
- constructor() {
10
- this.#load()
11
- }
12
-
13
- #save() {
14
- try {
15
- fs.promises.writeFile(this.#file, JSON.stringify(this.#strings, null, 4), 'utf8')
16
- } catch (err) {
17
- console.error('Error saving language file:', err)
18
- }
19
- }
20
-
21
- #load() {
22
- try {
23
- const data = fs.readFileSync(this.#file, 'utf8')
24
- this.#loaded = true
25
- this.#strings = JSON.parse(data)
26
- } catch {
27
- this.#strings = {}
28
- this.#save()
29
- }
30
- return true
31
- }
32
-
33
- get(key, ...args) {
34
- if (!this.#loaded) this.#load()
35
- if (key === 'CandyPack') return 'CandyPack'
36
- let text = this.#strings[key]
37
- if (text === undefined) {
38
- text = key
39
- this.#strings[key] = text
40
- this.#save()
41
- }
42
- if (args.length > 0) {
43
- args.forEach((arg, i) => {
44
- if (text.includes(`%s${i + 1}`)) text = text.replace(`%s${i + 1}`, arg)
45
- else text = text.replace('%s', arg)
46
- })
47
- }
48
- return text
49
- }
50
- }
51
-
52
- module.exports = Lang
package/core/Log.js DELETED
@@ -1,43 +0,0 @@
1
- class Log {
2
- #cliMode = false
3
-
4
- constructor() {
5
- // Detect if we're running in CLI mode
6
- // CLI mode is when the main module is in cli/ or bin/ directory
7
- if (require.main && require.main.filename) {
8
- const mainFile = require.main.filename
9
- this.#cliMode = mainFile.includes('/cli/') || mainFile.includes('/bin/')
10
- }
11
- }
12
-
13
- init(...arg) {
14
- this.module = '[' + arg.join('][') + '] '
15
- return {
16
- error: this.error.bind(this),
17
- log: this.log.bind(this)
18
- }
19
- }
20
-
21
- error(...arg) {
22
- // Always show errors, even in CLI mode
23
- console.error(this.module, ...arg)
24
- }
25
-
26
- log(...arg) {
27
- // Suppress logs in CLI mode to avoid breaking the interface
28
- if (this.#cliMode) return
29
-
30
- if (!arg.length) return this
31
- if (typeof arg[0] === 'string' && arg[0].includes('%s')) {
32
- let message = arg.shift()
33
- while (message.includes('%s') && arg.length > 0) {
34
- message = message.replace('%s', arg.shift())
35
- }
36
- message = message.replace(/%s/g, '')
37
- arg.unshift(message)
38
- }
39
- console.log(this.module, ...arg)
40
- }
41
- }
42
-
43
- module.exports = Log
package/core/Process.js DELETED
@@ -1,26 +0,0 @@
1
- const findProcess = require('find-process').default
2
-
3
- class Process {
4
- stop(pid) {
5
- return new Promise(resolve => {
6
- findProcess('pid', pid)
7
- .then(list => {
8
- for (const proc of list) if (proc.name == 'node') process.kill(proc.pid, 'SIGTERM')
9
- })
10
- .catch(() => {})
11
- .finally(() => {
12
- resolve()
13
- })
14
- })
15
- }
16
-
17
- async stopAll() {
18
- if (Candy.core('Config').config.server?.watchdog) await this.stop(Candy.core('Config').config.server.watchdog)
19
- if (Candy.core('Config').config.server?.pid) await this.stop(Candy.core('Config').config.server.pid)
20
- for (const domain of Object.keys(Candy.core('Config').config?.websites ?? {}))
21
- if (Candy.core('Config').config.websites[domain].pid) await this.stop(Candy.core('Config').config.websites[domain].pid)
22
- for (const service of Candy.core('Config').config.services ?? []) if (service.pid) await this.stop(service.pid)
23
- }
24
- }
25
-
26
- module.exports = Process
@@ -1,20 +0,0 @@
1
- ## 🤝 Your trusty `Candy` Assistant
2
-
3
- Remember the `Candy` object? It's your best friend inside a controller. It's passed to your controller function and gives you all the tools you need for the current request.
4
-
5
- #### Awesome Services at Your Fingertips
6
-
7
- * `Candy.Request`: Info about the user's request.
8
- * `Candy.View`: Renders your HTML pages.
9
- * `Candy.Auth`: Manages user logins.
10
- * `Candy.Token`: Protects your forms.
11
- * `Candy.Lang`: Helps with different languages.
12
-
13
- #### Handy Helper Functions
14
-
15
- * `Candy.return(data)`: Send back a response.
16
- * `Candy.direct(url)`: Redirect the user to a new page.
17
- * `Candy.cookie(key, value)`: Set a browser cookie.
18
- * `Candy.validator()`: Check user input easily.
19
-
20
- With controllers and the `Candy` object, you have everything you need to start building powerful application logic!
@@ -1,19 +0,0 @@
1
- ## ⚡ Quick Install
2
-
3
- This is the recommended method for most users.
4
-
5
- ### Linux & macOS
6
-
7
- Run the following command in your terminal:
8
-
9
- ```bash
10
- curl -sL https://candypack.dev/install | bash
11
- ```
12
-
13
- ### Windows
14
-
15
- Open PowerShell as an administrator and run the following command:
16
-
17
- ```powershell
18
- iex (iwr -useb 'https://candypack.dev/install')
19
- ```
@@ -1,9 +0,0 @@
1
- ## 📦 Manual Installation (via NPM)
2
-
3
- If you prefer to install manually or have issues with the quick install script, you can install CandyPack directly from NPM.
4
-
5
- 1. **Install Node.js:** Ensure you have Node.js (v18+) installed on your system. You can download it from [nodejs.org](https://nodejs.org/).
6
- 2. **Install CandyPack:** Use npm to install CandyPack globally:
7
- ```bash
8
- npm install -g candypack
9
- ```
@@ -1,7 +0,0 @@
1
- ## 🧠 Core Concepts
2
-
3
- CandyPack is designed to be a powerful, developer-first toolkit that runs as a persistent background service on your server. Here’s how it works:
4
-
5
- - **Background Service:** Once started, CandyPack runs continuously in the background, managing all your configured websites and services. You don't need to manually keep it active.
6
- - **CLI Control:** You interact with and control the CandyPack server through the `candy` command-line tool. This tool allows you to start, stop, monitor, and manage your applications.
7
- - **Automation:** The primary goal of CandyPack is to automate common server management tasks, such as SSL certificate renewal, service monitoring, and application deployment, allowing you to focus on development.
@@ -1,57 +0,0 @@
1
- ## 💻 Basic Commands
2
-
3
- These are the most common commands for interacting with the CandyPack server.
4
-
5
- ### Check Status
6
- To see the current status of the CandyPack server, including uptime and the number of running services, simply run the `candy` command with no arguments:
7
- ```bash
8
- candy
9
- ```
10
-
11
- ### Restart the Server
12
- If you need to apply new configurations or restart all services, you can use the `restart` command:
13
- ```bash
14
- candy restart
15
- ```
16
-
17
- ### Monitor Services
18
- To get a real-time, interactive view of your running websites and services, use the `monit` command:
19
- ```bash
20
- candy monit
21
- ```
22
-
23
- ### View Live Logs
24
- For debugging purposes, you can view a live stream of all server and application logs with the `debug` command:
25
- ```bash
26
- candy debug
27
- ```
28
-
29
- ### Get Help
30
- To see a list of all available commands, use the `help` command:
31
- ```bash
32
- candy help
33
- ```
34
-
35
- ### Using Prefix Arguments
36
- Many CandyPack commands support prefix arguments that allow you to provide values directly in the command line, avoiding interactive prompts. This is especially useful for automation and scripting.
37
-
38
- **Common Prefixes:**
39
- - `-d`, `--domain`: Specify domain name
40
- - `-e`, `--email`: Specify email address
41
- - `-p`, `--password`: Specify password
42
- - `-s`, `--subdomain`: Specify subdomain
43
- - `-i`, `--id`: Specify service ID
44
- - `-k`, `--key`: Specify authentication key
45
-
46
- **Example:**
47
- ```bash
48
- # Interactive mode (prompts for input)
49
- candy web create
50
-
51
- # Single-line mode with prefix
52
- candy web create -d example.com
53
- ```
54
-
55
- ---
56
-
57
- **Next Steps:** For more advanced topics, such as managing websites, services, SSL certificates, and mail accounts, please refer to the upcoming documentation files.
@@ -1,276 +0,0 @@
1
- ## 📖 CLI Reference
2
-
3
- This comprehensive reference covers all CandyPack CLI commands and their usage patterns, including both interactive and single-line modes with prefix arguments.
4
-
5
- ### Command Structure
6
-
7
- CandyPack CLI follows a hierarchical command structure:
8
- ```bash
9
- candy [command] [subcommand] [prefixes] [arguments]
10
- ```
11
-
12
- ### Prefix Arguments
13
-
14
- Most commands support prefix arguments that allow you to provide values directly in the command line, avoiding interactive prompts. This is especially useful for automation, scripting, and quick operations.
15
-
16
- #### Common Prefixes
17
- - `-d`, `--domain`: Domain name
18
- - `-e`, `--email`: Email address
19
- - `-p`, `--password`: Password
20
- - `-s`, `--subdomain`: Subdomain name
21
- - `-i`, `--id`: Service ID or name
22
- - `-k`, `--key`: Authentication key
23
-
24
- ### Authentication Commands
25
-
26
- #### `candy auth`
27
- Define your server to your CandyPack account.
28
-
29
- **Interactive:**
30
- ```bash
31
- candy auth
32
- ```
33
-
34
- **Single-line:**
35
- ```bash
36
- candy auth -k your-auth-key
37
- candy auth --key your-auth-key
38
- ```
39
-
40
- ### Basic Server Commands
41
-
42
- #### `candy` (no arguments)
43
- Display server status, uptime, and statistics.
44
-
45
- #### `candy restart`
46
- Restart the CandyPack server.
47
-
48
- #### `candy monit`
49
- Monitor websites and services in real-time.
50
-
51
- #### `candy debug`
52
- View live server and application logs.
53
-
54
- #### `candy help`
55
- Display help information for all commands.
56
-
57
- ### Service Management
58
-
59
- #### `candy run <file>`
60
- Add a new service by specifying the entry file path.
61
-
62
- **Example:**
63
- ```bash
64
- candy run /path/to/your/app.js
65
- candy run ./index.js
66
- ```
67
-
68
- #### `candy service delete`
69
- Delete a running service.
70
-
71
- **Interactive:**
72
- ```bash
73
- candy service delete
74
- ```
75
-
76
- **Single-line:**
77
- ```bash
78
- candy service delete -i service-name
79
- candy service delete --id service-name
80
- ```
81
-
82
- ### Website Management
83
-
84
- #### `candy web create`
85
- Create a new website configuration.
86
-
87
- **Interactive:**
88
- ```bash
89
- candy web create
90
- ```
91
-
92
- **Single-line:**
93
- ```bash
94
- candy web create -d example.com
95
- candy web create --domain example.com
96
- ```
97
-
98
- #### `candy web delete`
99
- Delete a website configuration.
100
-
101
- **Interactive:**
102
- ```bash
103
- candy web delete
104
- ```
105
-
106
- **Single-line:**
107
- ```bash
108
- candy web delete -d example.com
109
- candy web delete --domain example.com
110
- ```
111
-
112
- #### `candy web list`
113
- List all configured websites.
114
-
115
- ```bash
116
- candy web list
117
- ```
118
-
119
- ### Subdomain Management
120
-
121
- #### `candy subdomain create`
122
- Create a new subdomain.
123
-
124
- **Interactive:**
125
- ```bash
126
- candy subdomain create
127
- ```
128
-
129
- **Single-line:**
130
- ```bash
131
- candy subdomain create -s blog.example.com
132
- candy subdomain create --subdomain blog.example.com
133
- ```
134
-
135
- #### `candy subdomain delete`
136
- Delete a subdomain.
137
-
138
- **Interactive:**
139
- ```bash
140
- candy subdomain delete
141
- ```
142
-
143
- **Single-line:**
144
- ```bash
145
- candy subdomain delete -s blog.example.com
146
- candy subdomain delete --subdomain blog.example.com
147
- ```
148
-
149
- #### `candy subdomain list`
150
- List all subdomains for a domain.
151
-
152
- **Interactive:**
153
- ```bash
154
- candy subdomain list
155
- ```
156
-
157
- **Single-line:**
158
- ```bash
159
- candy subdomain list -d example.com
160
- candy subdomain list --domain example.com
161
- ```
162
-
163
- ### SSL Certificate Management
164
-
165
- #### `candy ssl renew`
166
- Renew SSL certificate for a domain.
167
-
168
- **Interactive:**
169
- ```bash
170
- candy ssl renew
171
- ```
172
-
173
- **Single-line:**
174
- ```bash
175
- candy ssl renew -d example.com
176
- candy ssl renew --domain example.com
177
- ```
178
-
179
- ### Mail Account Management
180
-
181
- #### `candy mail create`
182
- Create a new email account.
183
-
184
- **Interactive:**
185
- ```bash
186
- candy mail create
187
- ```
188
-
189
- **Single-line:**
190
- ```bash
191
- candy mail create -e user@example.com -p password123
192
- candy mail create --email user@example.com --password password123
193
- ```
194
-
195
- #### `candy mail delete`
196
- Delete an email account.
197
-
198
- **Interactive:**
199
- ```bash
200
- candy mail delete
201
- ```
202
-
203
- **Single-line:**
204
- ```bash
205
- candy mail delete -e user@example.com
206
- candy mail delete --email user@example.com
207
- ```
208
-
209
- #### `candy mail list`
210
- List all email accounts for a domain.
211
-
212
- **Interactive:**
213
- ```bash
214
- candy mail list
215
- ```
216
-
217
- **Single-line:**
218
- ```bash
219
- candy mail list -d example.com
220
- candy mail list --domain example.com
221
- ```
222
-
223
- #### `candy mail password`
224
- Change password for an email account.
225
-
226
- **Interactive:**
227
- ```bash
228
- candy mail password
229
- ```
230
-
231
- **Single-line:**
232
- ```bash
233
- candy mail password -e user@example.com -p newpassword
234
- candy mail password --email user@example.com --password newpassword
235
- ```
236
-
237
- ### Usage Tips
238
-
239
- #### Automation and Scripting
240
- Single-line commands with prefixes are perfect for automation:
241
-
242
- ```bash
243
- #!/bin/bash
244
- # Create multiple email accounts
245
- candy mail create -e admin@example.com -p admin123
246
- candy mail create -e support@example.com -p support123
247
- candy mail create -e sales@example.com -p sales123
248
-
249
- # Set up subdomains
250
- candy subdomain create -s blog.example.com
251
- candy subdomain create -s shop.example.com
252
- candy subdomain create -s api.example.com
253
- ```
254
-
255
- #### Mixed Usage
256
- You can mix interactive and single-line modes as needed:
257
-
258
- ```bash
259
- # Specify domain, but let the system prompt for other details
260
- candy web create -d example.com
261
- ```
262
-
263
- #### Password Security
264
- When using password prefixes (`-p`, `--password`):
265
- - Interactive mode requires password confirmation
266
- - Single-line mode skips confirmation for automation
267
- - Consider using environment variables for sensitive data in scripts
268
-
269
- ```bash
270
- # Using environment variable
271
- candy mail create -e user@example.com -p "$MAIL_PASSWORD"
272
- ```
273
-
274
- ### Error Handling
275
-
276
- If a command fails or you provide invalid arguments, CandyPack will display helpful error messages and suggest corrections. Use `candy help [command]` to get specific help for any command.
@@ -1,102 +0,0 @@
1
- ## ⚡ CLI Quick Reference
2
-
3
- A compact reference for all CandyPack CLI commands with their prefix arguments.
4
-
5
- ### Basic Commands
6
- ```bash
7
- candy # Show server status
8
- candy restart # Restart server
9
- candy monit # Monitor services
10
- candy debug # View live logs
11
- candy help # Show help
12
- ```
13
-
14
- ### Authentication
15
- ```bash
16
- candy auth [-k|--key] <key>
17
- ```
18
-
19
- ### Services
20
- ```bash
21
- candy run <file> # Start new service
22
- candy service delete [-i|--id] <service> # Delete service
23
- ```
24
-
25
- ### Websites
26
- ```bash
27
- candy web create [-d|--domain] <domain> # Create website
28
- candy web delete [-d|--domain] <domain> # Delete website
29
- candy web list # List websites
30
- ```
31
-
32
- ### Subdomains
33
- ```bash
34
- candy subdomain create [-s|--subdomain] <subdomain> # Create subdomain
35
- candy subdomain delete [-s|--subdomain] <subdomain> # Delete subdomain
36
- candy subdomain list [-d|--domain] <domain> # List subdomains
37
- ```
38
-
39
- ### SSL Certificates
40
- ```bash
41
- candy ssl renew [-d|--domain] <domain> # Renew SSL certificate
42
- ```
43
-
44
- ### Mail Accounts
45
- ```bash
46
- candy mail create [-e|--email] <email> [-p|--password] <password> # Create account
47
- candy mail delete [-e|--email] <email> # Delete account
48
- candy mail list [-d|--domain] <domain> # List accounts
49
- candy mail password [-e|--email] <email> [-p|--password] <password> # Change password
50
- ```
51
-
52
- ### Common Prefixes
53
- | Prefix | Long Form | Description |
54
- |--------|-----------|-------------|
55
- | `-d` | `--domain` | Domain name |
56
- | `-e` | `--email` | Email address |
57
- | `-p` | `--password` | Password |
58
- | `-s` | `--subdomain` | Subdomain name |
59
- | `-i` | `--id` | Service ID/name |
60
- | `-k` | `--key` | Authentication key |
61
-
62
- ### Usage Patterns
63
-
64
- **Interactive Mode:**
65
- ```bash
66
- candy web create
67
- # Prompts for domain name
68
- ```
69
-
70
- **Single-Line Mode:**
71
- ```bash
72
- candy web create -d example.com
73
- # No prompts, immediate execution
74
- ```
75
-
76
- **Mixed Mode:**
77
- ```bash
78
- candy mail create -e user@example.com
79
- # Prompts only for password
80
- ```
81
-
82
- ### Automation Examples
83
- ```bash
84
- # Batch create email accounts
85
- candy mail create -e admin@example.com -p admin123
86
- candy mail create -e support@example.com -p support456
87
-
88
- # Set up multiple subdomains
89
- candy subdomain create -s blog.example.com
90
- candy subdomain create -s api.example.com
91
- candy subdomain create -s shop.example.com
92
-
93
- # Renew multiple SSL certificates
94
- candy ssl renew -d example.com
95
- candy ssl renew -d api.example.com
96
- ```
97
-
98
- ### Tips
99
- - Use single-line mode for scripts and automation
100
- - Use interactive mode for one-off operations
101
- - Combine both modes as needed
102
- - All commands support `--help` for detailed information
@@ -1,57 +0,0 @@
1
- ## ⚙️ Start a New Service
2
-
3
- To start a new service, use the `run` command followed by the path to your application's entry file.
4
-
5
- ### Usage
6
- ```bash
7
- candy run <file>
8
- ```
9
-
10
- ### Arguments
11
- - `<file>`: The path to the script or application entry point you want to run. This can be an absolute path or a relative path from your current directory.
12
-
13
- ### Examples
14
-
15
- **Absolute path:**
16
- ```bash
17
- candy run /path/to/your/app/index.js
18
- ```
19
-
20
- **Relative path from current directory:**
21
- ```bash
22
- candy run index.js
23
- candy run ./src/server.js
24
- candy run ../other-project/app.js
25
- ```
26
-
27
- **Multiple services:**
28
- ```bash
29
- # Start multiple services in sequence
30
- candy run ./api/index.js
31
- candy run ./worker/processor.js
32
- candy run ./scheduler/cron.js
33
- ```
34
-
35
- ### Path Resolution
36
- - **Absolute paths**: Start with `/` (Linux/macOS) or drive letter (Windows)
37
- - **Relative paths**: Resolved from your current working directory
38
- - **Automatic conversion**: Relative paths are automatically converted to absolute paths internally
39
-
40
- ### Service Management
41
- Once started, CandyPack will:
42
- - Monitor the service continuously
43
- - Automatically restart it if it crashes
44
- - Assign it a unique service ID for management
45
- - Log all output for debugging
46
-
47
- You can view service status using:
48
- ```bash
49
- candy monit # Real-time monitoring
50
- candy # Quick status overview
51
- ```
52
-
53
- ### Service Deletion
54
- To remove a running service, use:
55
- ```bash
56
- candy service delete -i <service-name-or-id>
57
- ```