nibula 1.2.4 → 1.2.6

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 (81) hide show
  1. package/.eleventy.js +81 -81
  2. package/.eleventyignore +3 -3
  3. package/.github/workflows/publish.yml +37 -0
  4. package/CHANGELOG.md +179 -148
  5. package/LICENSE +169 -169
  6. package/NOTICE +4 -4
  7. package/README.md +120 -123
  8. package/bin/create.js +507 -507
  9. package/bin/nibula.js +317 -305
  10. package/docs/Assistant CLI.md +65 -65
  11. package/docs/Backend.md +295 -295
  12. package/docs/Components.md +84 -84
  13. package/docs/Creating pages.md +64 -64
  14. package/docs/Deploy.md +189 -189
  15. package/docs/Head and SEO.md +138 -138
  16. package/docs/Javascript.md +50 -50
  17. package/docs/Styling with SCSS.md +141 -141
  18. package/nginx.conf +75 -75
  19. package/package.json +1 -1
  20. package/src/backend/.htaccess +6 -6
  21. package/src/backend/_core/composer.json +5 -5
  22. package/src/backend/_core/composer.lock +492 -492
  23. package/src/backend/_core/index.js +267 -267
  24. package/src/backend/_core/index.php +147 -147
  25. package/src/backend/_core/init.js +52 -52
  26. package/src/backend/_core/init.php +33 -33
  27. package/src/backend/_core/modules/RateLimiter.js +58 -58
  28. package/src/backend/_core/modules/RateLimiter.php +30 -30
  29. package/src/backend/_core/modules/Response.js +59 -59
  30. package/src/backend/_core/modules/Response.php +48 -48
  31. package/src/backend/api/protected/example-protected.js +23 -23
  32. package/src/backend/api/protected/example-protected.php +16 -16
  33. package/src/backend/api/public/example-public.js +24 -24
  34. package/src/backend/api/public/example-public.php +16 -16
  35. package/src/backend/backend-node.service.example +30 -30
  36. package/src/backend/database/Database.js +46 -46
  37. package/src/backend/database/Database.php +23 -23
  38. package/src/backend/example.config.js +37 -37
  39. package/src/backend/example.config.php +27 -27
  40. package/src/backend/package.json +18 -18
  41. package/src/backend/web.config +16 -16
  42. package/src/frontend/.htaccess +51 -51
  43. package/src/frontend/404.njk +17 -17
  44. package/src/frontend/assets/brand/favicon.svg +54 -54
  45. package/src/frontend/assets/brand/logo.svg +54 -54
  46. package/src/frontend/components/global/footer.njk +25 -25
  47. package/src/frontend/components/global/header.njk +6 -6
  48. package/src/frontend/components/welcome.njk +114 -114
  49. package/src/frontend/data/site.json +48 -48
  50. package/src/frontend/index.njk +8 -8
  51. package/src/frontend/js/modules/exampleModule.js +2 -2
  52. package/src/frontend/js/pages/404.js +6 -6
  53. package/src/frontend/js/pages/homepage.js +6 -6
  54. package/src/frontend/layouts/base.njk +132 -132
  55. package/src/frontend/layouts/page-components.njk +13 -13
  56. package/src/frontend/llms.njk +17 -17
  57. package/src/frontend/robots.njk +7 -7
  58. package/src/frontend/scss/modules/_animations.scss +24 -24
  59. package/src/frontend/scss/modules/_footer.scss +27 -27
  60. package/src/frontend/scss/modules/_global.scss +47 -47
  61. package/src/frontend/scss/modules/_header.scss +27 -27
  62. package/src/frontend/scss/modules/_mobile.scss +29 -29
  63. package/src/frontend/scss/modules/_root.scss +34 -34
  64. package/src/frontend/scss/modules/_typography.scss +14 -14
  65. package/src/frontend/scss/modules/frameworks/_bootstrap.scss +109 -109
  66. package/src/frontend/scss/modules/frameworks/_bulma.scss +108 -108
  67. package/src/frontend/scss/modules/frameworks/_foundation.scss +138 -139
  68. package/src/frontend/scss/modules/frameworks/_uikit.scss +109 -109
  69. package/src/frontend/scss/pages/404.scss +27 -27
  70. package/src/frontend/scss/pages/homepage.scss +22 -22
  71. package/src/frontend/sitemap.njk +17 -17
  72. package/src/frontend/ts/modules/exampleModule.ts +2 -2
  73. package/src/frontend/ts/pages/404.ts +6 -6
  74. package/src/frontend/ts/pages/homepage.ts +6 -6
  75. package/src/frontend/web.config +55 -55
  76. package/tools/config/messages.json +3 -1
  77. package/tools/res/templates/template.js +6 -6
  78. package/tools/res/templates/template.njk +8 -8
  79. package/tools/res/templates/template.scss +22 -22
  80. package/tools/res/templates/template.ts +6 -6
  81. package/tsconfig.json +24 -24
@@ -1,59 +1,59 @@
1
- 'use strict';
2
-
3
- /**
4
- * Mirror of src/backend/_core/modules/Response.php
5
- *
6
- * In PHP the Response helper writes JSON and calls exit() to stop execution.
7
- * Node has no per-request exit, so each method writes to the response and then
8
- * throws the HALT sentinel. The front controller catches HALT and stops the
9
- * dispatch, reproducing the same "the endpoint stops here" behaviour.
10
- *
11
- * A fresh, response-bound helper is created per request via createResponse(res)
12
- * so overlapping async requests never clash (PHP was process-per-request).
13
- */
14
-
15
- // Sentinel thrown to unwind execution after a response has been sent (≈ PHP exit).
16
- const HALT = Symbol('RESPONSE_HALT');
17
-
18
- function jsonEncode(obj) {
19
- // JSON.stringify already leaves unicode unescaped and does not escape slashes,
20
- // matching PHP's JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES.
21
- return JSON.stringify(obj);
22
- }
23
-
24
- function createResponse(res) {
25
- return {
26
- success(data = null, code = 200) {
27
- res.statusCode = code;
28
- res.setHeader('Content-Type', 'application/json; charset=UTF-8');
29
- res.end(jsonEncode({
30
- status: 'success',
31
- data: data,
32
- }));
33
- throw HALT;
34
- },
35
-
36
- error(message, code = 400, details = null) {
37
- res.statusCode = code;
38
- res.setHeader('Content-Type', 'application/json; charset=UTF-8');
39
- const body = {
40
- status: 'error',
41
- message: message,
42
- code: code,
43
- };
44
- if (details !== null) {
45
- body.details = details;
46
- }
47
- res.end(jsonEncode(body));
48
- throw HALT;
49
- },
50
-
51
- noContent() {
52
- res.statusCode = 204;
53
- res.end();
54
- throw HALT;
55
- },
56
- };
57
- }
58
-
59
- module.exports = { createResponse, HALT };
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/_core/modules/Response.php
5
+ *
6
+ * In PHP the Response helper writes JSON and calls exit() to stop execution.
7
+ * Node has no per-request exit, so each method writes to the response and then
8
+ * throws the HALT sentinel. The front controller catches HALT and stops the
9
+ * dispatch, reproducing the same "the endpoint stops here" behaviour.
10
+ *
11
+ * A fresh, response-bound helper is created per request via createResponse(res)
12
+ * so overlapping async requests never clash (PHP was process-per-request).
13
+ */
14
+
15
+ // Sentinel thrown to unwind execution after a response has been sent (≈ PHP exit).
16
+ const HALT = Symbol('RESPONSE_HALT');
17
+
18
+ function jsonEncode(obj) {
19
+ // JSON.stringify already leaves unicode unescaped and does not escape slashes,
20
+ // matching PHP's JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES.
21
+ return JSON.stringify(obj);
22
+ }
23
+
24
+ function createResponse(res) {
25
+ return {
26
+ success(data = null, code = 200) {
27
+ res.statusCode = code;
28
+ res.setHeader('Content-Type', 'application/json; charset=UTF-8');
29
+ res.end(jsonEncode({
30
+ status: 'success',
31
+ data: data,
32
+ }));
33
+ throw HALT;
34
+ },
35
+
36
+ error(message, code = 400, details = null) {
37
+ res.statusCode = code;
38
+ res.setHeader('Content-Type', 'application/json; charset=UTF-8');
39
+ const body = {
40
+ status: 'error',
41
+ message: message,
42
+ code: code,
43
+ };
44
+ if (details !== null) {
45
+ body.details = details;
46
+ }
47
+ res.end(jsonEncode(body));
48
+ throw HALT;
49
+ },
50
+
51
+ noContent() {
52
+ res.statusCode = 204;
53
+ res.end();
54
+ throw HALT;
55
+ },
56
+ };
57
+ }
58
+
59
+ module.exports = { createResponse, HALT };
@@ -1,49 +1,49 @@
1
- <?php
2
-
3
- declare(strict_types=1);
4
-
5
- if (!defined('CORE_ACCESS')) {
6
- $errorPage = $_SERVER['DOCUMENT_ROOT'] . '/404.html';
7
- http_response_code(404);
8
- if (file_exists($errorPage)) {
9
- header('Content-Type: text/html; charset=UTF-8');
10
- echo file_get_contents($errorPage);
11
- } else {
12
- echo "404 Not Found";
13
- }
14
- exit;
15
- }
16
-
17
- class Response
18
- {
19
- public static function success(mixed $data = null, int $code = 200): never
20
- {
21
- http_response_code($code);
22
- echo json_encode([
23
- 'status' => 'success',
24
- 'data' => $data,
25
- ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
26
- exit;
27
- }
28
-
29
- public static function error(string $message, int $code = 400, mixed $details = null): never
30
- {
31
- http_response_code($code);
32
- $body = [
33
- 'status' => 'error',
34
- 'message' => $message,
35
- 'code' => $code,
36
- ];
37
- if ($details !== null) {
38
- $body['details'] = $details;
39
- }
40
- echo json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
41
- exit;
42
- }
43
-
44
- public static function noContent(): never
45
- {
46
- http_response_code(204);
47
- exit;
48
- }
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ if (!defined('CORE_ACCESS')) {
6
+ $errorPage = $_SERVER['DOCUMENT_ROOT'] . '/404.html';
7
+ http_response_code(404);
8
+ if (file_exists($errorPage)) {
9
+ header('Content-Type: text/html; charset=UTF-8');
10
+ echo file_get_contents($errorPage);
11
+ } else {
12
+ echo "404 Not Found";
13
+ }
14
+ exit;
15
+ }
16
+
17
+ class Response
18
+ {
19
+ public static function success(mixed $data = null, int $code = 200): never
20
+ {
21
+ http_response_code($code);
22
+ echo json_encode([
23
+ 'status' => 'success',
24
+ 'data' => $data,
25
+ ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
26
+ exit;
27
+ }
28
+
29
+ public static function error(string $message, int $code = 400, mixed $details = null): never
30
+ {
31
+ http_response_code($code);
32
+ $body = [
33
+ 'status' => 'error',
34
+ 'message' => $message,
35
+ 'code' => $code,
36
+ ];
37
+ if ($details !== null) {
38
+ $body['details'] = $details;
39
+ }
40
+ echo json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
41
+ exit;
42
+ }
43
+
44
+ public static function noContent(): never
45
+ {
46
+ http_response_code(204);
47
+ exit;
48
+ }
49
49
  }
@@ -1,23 +1,23 @@
1
- 'use strict';
2
-
3
- /**
4
- * Mirror of src/backend/api/protected/example-protected.php
5
- *
6
- * Protected endpoint: the API key check (X-Api-Key header) runs automatically in
7
- * the front controller before this file is loaded, so here we just handle logic.
8
- */
9
-
10
- module.exports = ({ method, requestParams, Response }) => {
11
- if (method !== 'GET') {
12
- Response.error('Method not allowed', 405);
13
- }
14
-
15
- //
16
- // Your endpoint logic here. You can access route parameters in requestParams
17
- //
18
-
19
- Response.success({
20
- message: 'Protected endpoint is working',
21
- params: requestParams,
22
- });
23
- };
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/api/protected/example-protected.php
5
+ *
6
+ * Protected endpoint: the API key check (X-Api-Key header) runs automatically in
7
+ * the front controller before this file is loaded, so here we just handle logic.
8
+ */
9
+
10
+ module.exports = ({ method, requestParams, Response }) => {
11
+ if (method !== 'GET') {
12
+ Response.error('Method not allowed', 405);
13
+ }
14
+
15
+ //
16
+ // Your endpoint logic here. You can access route parameters in requestParams
17
+ //
18
+
19
+ Response.success({
20
+ message: 'Protected endpoint is working',
21
+ params: requestParams,
22
+ });
23
+ };
@@ -1,17 +1,17 @@
1
- <?php
2
- declare(strict_types=1);
3
-
4
- require_once CORE_PATH . '/modules/Response.php';
5
-
6
- if ($method !== 'GET') {
7
- Response::error('Method not allowed', 405);
8
- }
9
-
10
- //
11
- // Your endpoint logic here. You can access route parameters in $requestParams array
12
- //
13
-
14
- Response::success([
15
- 'message' => 'Protected endpoint is working',
16
- 'params' => $requestParams,
1
+ <?php
2
+ declare(strict_types=1);
3
+
4
+ require_once CORE_PATH . '/modules/Response.php';
5
+
6
+ if ($method !== 'GET') {
7
+ Response::error('Method not allowed', 405);
8
+ }
9
+
10
+ //
11
+ // Your endpoint logic here. You can access route parameters in $requestParams array
12
+ //
13
+
14
+ Response::success([
15
+ 'message' => 'Protected endpoint is working',
16
+ 'params' => $requestParams,
17
17
  ]);
@@ -1,24 +1,24 @@
1
- 'use strict';
2
-
3
- /**
4
- * Mirror of src/backend/api/public/example-public.php
5
- *
6
- * Public endpoint: no API key required. Receives the request context and calls
7
- * the request-bound Response helper, exactly like the PHP file used the global
8
- * Response class and $method / $requestParams.
9
- */
10
-
11
- module.exports = ({ method, requestParams, Response }) => {
12
- if (method !== 'GET') {
13
- Response.error('Method not allowed', 405);
14
- }
15
-
16
- //
17
- // Your endpoint logic here. You can access route parameters in requestParams
18
- //
19
-
20
- Response.success({
21
- message: 'Public endpoint is working',
22
- params: requestParams,
23
- });
24
- };
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/api/public/example-public.php
5
+ *
6
+ * Public endpoint: no API key required. Receives the request context and calls
7
+ * the request-bound Response helper, exactly like the PHP file used the global
8
+ * Response class and $method / $requestParams.
9
+ */
10
+
11
+ module.exports = ({ method, requestParams, Response }) => {
12
+ if (method !== 'GET') {
13
+ Response.error('Method not allowed', 405);
14
+ }
15
+
16
+ //
17
+ // Your endpoint logic here. You can access route parameters in requestParams
18
+ //
19
+
20
+ Response.success({
21
+ message: 'Public endpoint is working',
22
+ params: requestParams,
23
+ });
24
+ };
@@ -1,17 +1,17 @@
1
- <?php
2
- declare(strict_types=1);
3
-
4
- require_once CORE_PATH . '/modules/Response.php';
5
-
6
- if ($method !== 'GET') {
7
- Response::error('Method not allowed', 405);
8
- }
9
-
10
- //
11
- // Your endpoint logic here. You can access route parameters in $requestParams array
12
- //
13
-
14
- Response::success([
15
- 'message' => 'Public endpoint is working',
16
- 'params' => $requestParams,
1
+ <?php
2
+ declare(strict_types=1);
3
+
4
+ require_once CORE_PATH . '/modules/Response.php';
5
+
6
+ if ($method !== 'GET') {
7
+ Response::error('Method not allowed', 405);
8
+ }
9
+
10
+ //
11
+ // Your endpoint logic here. You can access route parameters in $requestParams array
12
+ //
13
+
14
+ Response::success([
15
+ 'message' => 'Public endpoint is working',
16
+ 'params' => $requestParams,
17
17
  ]);
@@ -1,30 +1,30 @@
1
- # Example systemd unit to keep the Node backend running on your server.
2
- #
3
- # 1. Copy your built site to the server (the `out` folder).
4
- # 2. Adjust WorkingDirectory below to point at out/backend on your server.
5
- # 3. Copy this file to /etc/systemd/system/backend-node.service (drop the .example).
6
- # 4. Enable and start it:
7
- # sudo systemctl daemon-reload
8
- # sudo systemctl enable --now backend-node
9
- # sudo systemctl status backend-node
10
- #
11
- # Check the Node path with `which node` and update ExecStart if it isn't /usr/bin/node
12
- # (nvm installs live elsewhere, e.g. /home/<user>/.nvm/versions/node/<v>/bin/node).
13
-
14
- [Unit]
15
- Description=Nibula Node backend
16
- After=network.target
17
-
18
- [Service]
19
- Type=simple
20
- WorkingDirectory=/var/www/your-site/out/backend
21
- ExecStart=/usr/bin/node _core/index.js
22
- Environment=PORT=3000
23
- Environment=HOST=127.0.0.1
24
- Environment=APP_ENV=production
25
- Restart=on-failure
26
- RestartSec=2
27
- User=www-data
28
-
29
- [Install]
30
- WantedBy=multi-user.target
1
+ # Example systemd unit to keep the Node backend running on your server.
2
+ #
3
+ # 1. Copy your built site to the server (the `out` folder).
4
+ # 2. Adjust WorkingDirectory below to point at out/backend on your server.
5
+ # 3. Copy this file to /etc/systemd/system/backend-node.service (drop the .example).
6
+ # 4. Enable and start it:
7
+ # sudo systemctl daemon-reload
8
+ # sudo systemctl enable --now backend-node
9
+ # sudo systemctl status backend-node
10
+ #
11
+ # Check the Node path with `which node` and update ExecStart if it isn't /usr/bin/node
12
+ # (nvm installs live elsewhere, e.g. /home/<user>/.nvm/versions/node/<v>/bin/node).
13
+
14
+ [Unit]
15
+ Description=Nibula Node backend
16
+ After=network.target
17
+
18
+ [Service]
19
+ Type=simple
20
+ WorkingDirectory=/var/www/your-site/out/backend
21
+ ExecStart=/usr/bin/node _core/index.js
22
+ Environment=PORT=3000
23
+ Environment=HOST=127.0.0.1
24
+ Environment=APP_ENV=production
25
+ Restart=on-failure
26
+ RestartSec=2
27
+ User=www-data
28
+
29
+ [Install]
30
+ WantedBy=multi-user.target
@@ -1,46 +1,46 @@
1
- 'use strict';
2
-
3
- /**
4
- * Mirror of src/backend/database/Database.php
5
- *
6
- * PDO singleton → a single shared mysql2 connection pool. Config is read from
7
- * ../config.js (same relative location as the PHP version's ../config.php).
8
- * Options map the PDO attributes as closely as mysql2 allows:
9
- * - ERRMODE_EXCEPTION → mysql2 rejects/throws on error by default
10
- * - FETCH_ASSOC → rowsAsArray:false (objects keyed by column) is default
11
- * - EMULATE_PREPARES false → native prepared statements via pool.execute()
12
- *
13
- * Requires the "mysql2" package (npm install mysql2). getInstance() returns the
14
- * promise-based pool; use pool.execute(sql, params) for prepared statements.
15
- */
16
-
17
- const path = require('path');
18
-
19
- let instance = null;
20
-
21
- class Database {
22
- static getInstance() {
23
- if (instance === null) {
24
- // Lazy require so the backend boots even without a DB configured.
25
- // eslint-disable-next-line global-require
26
- const mysql = require('mysql2/promise');
27
-
28
- // eslint-disable-next-line global-require
29
- const config = require(path.join(__dirname, '..', 'config.js'));
30
-
31
- instance = mysql.createPool({
32
- host: config.DB_HOST,
33
- database: config.DB_NAME,
34
- user: config.DB_USER,
35
- password: config.DB_PASS,
36
- charset: 'utf8mb4',
37
- waitForConnections: true,
38
- connectionLimit: 10,
39
- namedPlaceholders: false,
40
- });
41
- }
42
- return instance;
43
- }
44
- }
45
-
46
- module.exports = Database;
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/database/Database.php
5
+ *
6
+ * PDO singleton → a single shared mysql2 connection pool. Config is read from
7
+ * ../config.js (same relative location as the PHP version's ../config.php).
8
+ * Options map the PDO attributes as closely as mysql2 allows:
9
+ * - ERRMODE_EXCEPTION → mysql2 rejects/throws on error by default
10
+ * - FETCH_ASSOC → rowsAsArray:false (objects keyed by column) is default
11
+ * - EMULATE_PREPARES false → native prepared statements via pool.execute()
12
+ *
13
+ * Requires the "mysql2" package (npm install mysql2). getInstance() returns the
14
+ * promise-based pool; use pool.execute(sql, params) for prepared statements.
15
+ */
16
+
17
+ const path = require('path');
18
+
19
+ let instance = null;
20
+
21
+ class Database {
22
+ static getInstance() {
23
+ if (instance === null) {
24
+ // Lazy require so the backend boots even without a DB configured.
25
+ // eslint-disable-next-line global-require
26
+ const mysql = require('mysql2/promise');
27
+
28
+ // eslint-disable-next-line global-require
29
+ const config = require(path.join(__dirname, '..', 'config.js'));
30
+
31
+ instance = mysql.createPool({
32
+ host: config.DB_HOST,
33
+ database: config.DB_NAME,
34
+ user: config.DB_USER,
35
+ password: config.DB_PASS,
36
+ charset: 'utf8mb4',
37
+ waitForConnections: true,
38
+ connectionLimit: 10,
39
+ namedPlaceholders: false,
40
+ });
41
+ }
42
+ return instance;
43
+ }
44
+ }
45
+
46
+ module.exports = Database;
@@ -1,24 +1,24 @@
1
- <?php
2
- declare(strict_types=1);
3
-
4
- class Database {
5
- private static ?PDO $instance = null;
6
-
7
- private function __construct() {}
8
-
9
- public static function getInstance(): PDO {
10
- if (self::$instance === null) {
11
- $config = require __DIR__ . '/../config.php';
12
-
13
- $dsn = "mysql:host={$config['DB_HOST']};dbname={$config['DB_NAME']};charset=utf8mb4";
14
- $options = [
15
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
16
- PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
17
- PDO::ATTR_EMULATE_PREPARES => false,
18
- ];
19
-
20
- self::$instance = new PDO($dsn, $config['DB_USER'], $config['DB_PASS'], $options);
21
- }
22
- return self::$instance;
23
- }
1
+ <?php
2
+ declare(strict_types=1);
3
+
4
+ class Database {
5
+ private static ?PDO $instance = null;
6
+
7
+ private function __construct() {}
8
+
9
+ public static function getInstance(): PDO {
10
+ if (self::$instance === null) {
11
+ $config = require __DIR__ . '/../config.php';
12
+
13
+ $dsn = "mysql:host={$config['DB_HOST']};dbname={$config['DB_NAME']};charset=utf8mb4";
14
+ $options = [
15
+ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
16
+ PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
17
+ PDO::ATTR_EMULATE_PREPARES => false,
18
+ ];
19
+
20
+ self::$instance = new PDO($dsn, $config['DB_USER'], $config['DB_PASS'], $options);
21
+ }
22
+ return self::$instance;
23
+ }
24
24
  }
@@ -1,37 +1,37 @@
1
- 'use strict';
2
-
3
- /**
4
- * Mirror of src/backend/example.config.php
5
- *
6
- * Versioned, secret-free template. On setup, copy this file to config.js and
7
- * fill in real values. config.js is git-ignored and stays local.
8
- */
9
-
10
- module.exports = {
11
- // Default key for protected endpoints that don't have a specific key in CUSTOM_ENDPOINT_KEYS
12
- GENERAL_API_KEY: 'DEFAULT_KEY',
13
-
14
- // If you want to restrict access to protected endpoints to specific clients, define custom keys per endpoint.
15
- // For subfolder endpoints, use the relative path ('subfolder/endpoint')
16
- CUSTOM_ENDPOINT_KEYS: {
17
- 'subfolder/example-protected': 'custom-key',
18
- },
19
-
20
- GENERAL_ALLOWED_ORIGINS: [
21
- '*',
22
- // 'https://example.com',
23
- ],
24
-
25
- CUSTOM_ENDPOINT_ORIGINS: {
26
- 'subfolder/example-protected': ['https://app.example.com'],
27
- },
28
-
29
- // Database configuration
30
- DB_HOST: '127.0.0.1',
31
- DB_NAME: 'example_db',
32
- DB_USER: 'root',
33
- DB_PASS: '',
34
-
35
- // Environment: 'production' hides error details; anything else = debug.
36
- APP_ENV: 'production',
37
- };
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/example.config.php
5
+ *
6
+ * Versioned, secret-free template. On setup, copy this file to config.js and
7
+ * fill in real values. config.js is git-ignored and stays local.
8
+ */
9
+
10
+ module.exports = {
11
+ // Default key for protected endpoints that don't have a specific key in CUSTOM_ENDPOINT_KEYS
12
+ GENERAL_API_KEY: 'DEFAULT_KEY',
13
+
14
+ // If you want to restrict access to protected endpoints to specific clients, define custom keys per endpoint.
15
+ // For subfolder endpoints, use the relative path ('subfolder/endpoint')
16
+ CUSTOM_ENDPOINT_KEYS: {
17
+ 'subfolder/example-protected': 'custom-key',
18
+ },
19
+
20
+ GENERAL_ALLOWED_ORIGINS: [
21
+ '*',
22
+ // 'https://example.com',
23
+ ],
24
+
25
+ CUSTOM_ENDPOINT_ORIGINS: {
26
+ 'subfolder/example-protected': ['https://app.example.com'],
27
+ },
28
+
29
+ // Database configuration
30
+ DB_HOST: '127.0.0.1',
31
+ DB_NAME: 'example_db',
32
+ DB_USER: 'root',
33
+ DB_PASS: '',
34
+
35
+ // Environment: 'production' hides error details; anything else = debug.
36
+ APP_ENV: 'production',
37
+ };