@buenojs/bueno 0.8.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 (120) hide show
  1. package/.env.example +109 -0
  2. package/.github/workflows/ci.yml +31 -0
  3. package/LICENSE +21 -0
  4. package/README.md +892 -0
  5. package/architecture.md +652 -0
  6. package/bun.lock +70 -0
  7. package/dist/cli/index.js +3233 -0
  8. package/dist/index.js +9014 -0
  9. package/package.json +77 -0
  10. package/src/cache/index.ts +795 -0
  11. package/src/cli/ARCHITECTURE.md +837 -0
  12. package/src/cli/bin.ts +10 -0
  13. package/src/cli/commands/build.ts +425 -0
  14. package/src/cli/commands/dev.ts +248 -0
  15. package/src/cli/commands/generate.ts +541 -0
  16. package/src/cli/commands/help.ts +55 -0
  17. package/src/cli/commands/index.ts +112 -0
  18. package/src/cli/commands/migration.ts +355 -0
  19. package/src/cli/commands/new.ts +804 -0
  20. package/src/cli/commands/start.ts +208 -0
  21. package/src/cli/core/args.ts +283 -0
  22. package/src/cli/core/console.ts +349 -0
  23. package/src/cli/core/index.ts +60 -0
  24. package/src/cli/core/prompt.ts +424 -0
  25. package/src/cli/core/spinner.ts +265 -0
  26. package/src/cli/index.ts +135 -0
  27. package/src/cli/templates/deploy.ts +295 -0
  28. package/src/cli/templates/docker.ts +307 -0
  29. package/src/cli/templates/index.ts +24 -0
  30. package/src/cli/utils/fs.ts +428 -0
  31. package/src/cli/utils/index.ts +8 -0
  32. package/src/cli/utils/strings.ts +197 -0
  33. package/src/config/env.ts +408 -0
  34. package/src/config/index.ts +506 -0
  35. package/src/config/loader.ts +329 -0
  36. package/src/config/merge.ts +285 -0
  37. package/src/config/types.ts +320 -0
  38. package/src/config/validation.ts +441 -0
  39. package/src/container/forward-ref.ts +143 -0
  40. package/src/container/index.ts +386 -0
  41. package/src/context/index.ts +360 -0
  42. package/src/database/index.ts +1142 -0
  43. package/src/database/migrations/index.ts +371 -0
  44. package/src/database/schema/index.ts +619 -0
  45. package/src/frontend/api-routes.ts +640 -0
  46. package/src/frontend/bundler.ts +643 -0
  47. package/src/frontend/console-client.ts +419 -0
  48. package/src/frontend/console-stream.ts +587 -0
  49. package/src/frontend/dev-server.ts +846 -0
  50. package/src/frontend/file-router.ts +611 -0
  51. package/src/frontend/frameworks/index.ts +106 -0
  52. package/src/frontend/frameworks/react.ts +85 -0
  53. package/src/frontend/frameworks/solid.ts +104 -0
  54. package/src/frontend/frameworks/svelte.ts +110 -0
  55. package/src/frontend/frameworks/vue.ts +92 -0
  56. package/src/frontend/hmr-client.ts +663 -0
  57. package/src/frontend/hmr.ts +728 -0
  58. package/src/frontend/index.ts +342 -0
  59. package/src/frontend/islands.ts +552 -0
  60. package/src/frontend/isr.ts +555 -0
  61. package/src/frontend/layout.ts +475 -0
  62. package/src/frontend/ssr/react.ts +446 -0
  63. package/src/frontend/ssr/solid.ts +523 -0
  64. package/src/frontend/ssr/svelte.ts +546 -0
  65. package/src/frontend/ssr/vue.ts +504 -0
  66. package/src/frontend/ssr.ts +699 -0
  67. package/src/frontend/types.ts +2274 -0
  68. package/src/health/index.ts +604 -0
  69. package/src/index.ts +410 -0
  70. package/src/lock/index.ts +587 -0
  71. package/src/logger/index.ts +444 -0
  72. package/src/logger/transports/index.ts +969 -0
  73. package/src/metrics/index.ts +494 -0
  74. package/src/middleware/built-in.ts +360 -0
  75. package/src/middleware/index.ts +94 -0
  76. package/src/modules/filters.ts +458 -0
  77. package/src/modules/guards.ts +405 -0
  78. package/src/modules/index.ts +1256 -0
  79. package/src/modules/interceptors.ts +574 -0
  80. package/src/modules/lazy.ts +418 -0
  81. package/src/modules/lifecycle.ts +478 -0
  82. package/src/modules/metadata.ts +90 -0
  83. package/src/modules/pipes.ts +626 -0
  84. package/src/router/index.ts +339 -0
  85. package/src/router/linear.ts +371 -0
  86. package/src/router/regex.ts +292 -0
  87. package/src/router/tree.ts +562 -0
  88. package/src/rpc/index.ts +1263 -0
  89. package/src/security/index.ts +436 -0
  90. package/src/ssg/index.ts +631 -0
  91. package/src/storage/index.ts +456 -0
  92. package/src/telemetry/index.ts +1097 -0
  93. package/src/testing/index.ts +1586 -0
  94. package/src/types/index.ts +236 -0
  95. package/src/types/optional-deps.d.ts +219 -0
  96. package/src/validation/index.ts +276 -0
  97. package/src/websocket/index.ts +1004 -0
  98. package/tests/integration/cli.test.ts +1016 -0
  99. package/tests/integration/fullstack.test.ts +234 -0
  100. package/tests/unit/cache.test.ts +174 -0
  101. package/tests/unit/cli-commands.test.ts +892 -0
  102. package/tests/unit/cli.test.ts +1258 -0
  103. package/tests/unit/container.test.ts +279 -0
  104. package/tests/unit/context.test.ts +221 -0
  105. package/tests/unit/database.test.ts +183 -0
  106. package/tests/unit/linear-router.test.ts +280 -0
  107. package/tests/unit/lock.test.ts +336 -0
  108. package/tests/unit/middleware.test.ts +184 -0
  109. package/tests/unit/modules.test.ts +142 -0
  110. package/tests/unit/pubsub.test.ts +257 -0
  111. package/tests/unit/regex-router.test.ts +265 -0
  112. package/tests/unit/router.test.ts +373 -0
  113. package/tests/unit/rpc.test.ts +1248 -0
  114. package/tests/unit/security.test.ts +174 -0
  115. package/tests/unit/telemetry.test.ts +371 -0
  116. package/tests/unit/test-cache.test.ts +110 -0
  117. package/tests/unit/test-database.test.ts +282 -0
  118. package/tests/unit/tree-router.test.ts +325 -0
  119. package/tests/unit/validation.test.ts +794 -0
  120. package/tsconfig.json +27 -0
package/.env.example ADDED
@@ -0,0 +1,109 @@
1
+ # Bueno Framework Environment Configuration
2
+ # Copy this file to .env and customize as needed
3
+
4
+ # ============= Server Configuration =============
5
+ # Server port (default: 3000)
6
+ BUENO_PORT=3000
7
+ # Server host (default: localhost)
8
+ BUENO_HOST=localhost
9
+ # Enable development mode (default: false)
10
+ BUENO_DEV=false
11
+ # Alternative: Standard PORT variable
12
+ # PORT=3000
13
+ # Alternative: Standard HOST variable
14
+ # HOST=localhost
15
+
16
+ # ============= Database Configuration =============
17
+ # Database connection URL (PostgreSQL, MySQL, or SQLite)
18
+ DATABASE_URL=postgres://user:password@localhost:5432/myapp
19
+ # Or use Bueno-specific variable
20
+ # BUENO_DATABASE_URL=postgres://user:password@localhost:5432/myapp
21
+
22
+ # Connection pool size (default: 10)
23
+ BUENO_DB_POOL_SIZE=10
24
+
25
+ # Enable database metrics (default: true)
26
+ BUENO_DB_METRICS=true
27
+
28
+ # Slow query threshold in milliseconds (default: 100)
29
+ BUENO_DB_SLOW_QUERY=100
30
+
31
+ # ============= Cache Configuration =============
32
+ # Redis connection URL (required if using Redis cache)
33
+ REDIS_URL=redis://localhost:6379
34
+ # Or use Bueno-specific variable
35
+ # BUENO_REDIS_URL=redis://localhost:6379
36
+
37
+ # Cache driver: "redis" or "memory" (default: memory)
38
+ BUENO_CACHE_DRIVER=memory
39
+
40
+ # Default TTL in seconds (default: 3600)
41
+ BUENO_CACHE_TTL=3600
42
+
43
+ # Key prefix for namespacing (default: "")
44
+ BUENO_CACHE_PREFIX=myapp:
45
+
46
+ # Enable cache metrics (default: true)
47
+ # BUENO_CACHE_METRICS=true
48
+
49
+ # ============= Logger Configuration =============
50
+ # Log level: debug, info, warn, error, fatal (default: info)
51
+ LOG_LEVEL=info
52
+ # Or use Bueno-specific variable
53
+ # BUENO_LOG_LEVEL=info
54
+
55
+ # Pretty print logs (default: true in development)
56
+ BUENO_LOG_PRETTY=true
57
+
58
+ # ============= Health Check Configuration =============
59
+ # Enable health check endpoints (default: true)
60
+ BUENO_HEALTH_ENABLED=true
61
+
62
+ # Health check endpoint path (default: /health)
63
+ BUENO_HEALTH_PATH=/health
64
+
65
+ # Readiness check endpoint path (default: /ready)
66
+ BUENO_READY_PATH=/ready
67
+
68
+ # ============= Metrics Configuration =============
69
+ # Enable metrics collection (default: true)
70
+ BUENO_METRICS_ENABLED=true
71
+
72
+ # Collection interval in milliseconds (default: 60000)
73
+ BUENO_METRICS_INTERVAL=60000
74
+
75
+ # ============= Telemetry Configuration =============
76
+ # Enable OpenTelemetry tracing (default: false)
77
+ BUENO_TELEMETRY_ENABLED=false
78
+
79
+ # Service name for tracing (default: bueno-app)
80
+ BUENO_SERVICE_NAME=my-bueno-app
81
+
82
+ # OTLP endpoint URL
83
+ BUENO_OTEL_ENDPOINT=http://localhost:4318
84
+ # Or use standard OTEL variable
85
+ # OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
86
+
87
+ # Sampling rate 0.0 to 1.0 (default: 1.0)
88
+ # BUENO_SAMPLE_RATE=1.0
89
+
90
+ # ============= Frontend Configuration =============
91
+ # Frontend dev server port (default: 3001)
92
+ BUENO_FRONTEND_PORT=3001
93
+
94
+ # Enable Hot Module Replacement (default: true)
95
+ BUENO_HMR=true
96
+
97
+ # ============= Security Configuration =============
98
+ # JWT secret for authentication
99
+ # JWT_SECRET=your-super-secret-key-here
100
+
101
+ # Session secret
102
+ # SESSION_SECRET=your-session-secret-here
103
+
104
+ # ============= Storage Configuration =============
105
+ # S3-compatible storage configuration
106
+ # AWS_ACCESS_KEY_ID=your-access-key
107
+ # AWS_SECRET_ACCESS_KEY=your-secret-key
108
+ # AWS_REGION=us-east-1
109
+ # S3_BUCKET=my-bucket
@@ -0,0 +1,31 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Setup Bun
16
+ uses: oven-sh/setup-bun@v1
17
+ with:
18
+ bun-version: latest
19
+
20
+ - name: Install dependencies
21
+ run: bun install
22
+
23
+ - name: Run tests
24
+ run: bun test
25
+
26
+ - name: Upload coverage to Codecov
27
+ uses: codecov/codecov-action@v4
28
+ with:
29
+ token: ${{ secrets.CODECOV_TOKEN }}
30
+ files: ./coverage/coverage-final.json
31
+ fail_ci_if_error: false
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sivaraj D <sivarajd@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.