balda-js 0.0.1
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/.github/workflows/publish.yml +38 -0
- package/.husky/pre-commit +19 -0
- package/.nvmrc +1 -0
- package/LICENSE +21 -0
- package/README.md +46 -0
- package/deno.lock +2454 -0
- package/docs/README.md +135 -0
- package/docs/blog/authors.yml +6 -0
- package/docs/blog/tags.yml +4 -0
- package/docs/cli.md +109 -0
- package/docs/docs/core-concepts/controllers.md +393 -0
- package/docs/docs/core-concepts/middleware.md +302 -0
- package/docs/docs/core-concepts/request-response.md +486 -0
- package/docs/docs/core-concepts/routing.md +388 -0
- package/docs/docs/core-concepts/server.md +332 -0
- package/docs/docs/cron/overview.md +70 -0
- package/docs/docs/examples/rest-api.md +595 -0
- package/docs/docs/getting-started/configuration.md +168 -0
- package/docs/docs/getting-started/installation.md +125 -0
- package/docs/docs/getting-started/quick-start.md +273 -0
- package/docs/docs/intro.md +46 -0
- package/docs/docs/plugins/cookie.md +424 -0
- package/docs/docs/plugins/cors.md +295 -0
- package/docs/docs/plugins/file.md +382 -0
- package/docs/docs/plugins/helmet.md +388 -0
- package/docs/docs/plugins/json.md +338 -0
- package/docs/docs/plugins/log.md +592 -0
- package/docs/docs/plugins/overview.md +390 -0
- package/docs/docs/plugins/rate-limiter.md +347 -0
- package/docs/docs/plugins/static.md +352 -0
- package/docs/docs/plugins/swagger.md +411 -0
- package/docs/docs/plugins/urlencoded.md +76 -0
- package/docs/docs/testing/examples.md +384 -0
- package/docs/docs/testing/mock-server.md +311 -0
- package/docs/docs/testing/overview.md +76 -0
- package/docs/docusaurus.config.ts +144 -0
- package/docs/intro.md +78 -0
- package/docs/package.json +46 -0
- package/docs/sidebars.ts +72 -0
- package/docs/static/.nojekyll +0 -0
- package/docs/static/img/docusaurus-social-card.jpg +0 -0
- package/docs/static/img/docusaurus.png +0 -0
- package/docs/static/img/favicon.ico +0 -0
- package/docs/static/img/logo.svg +1 -0
- package/docs/static/img/undraw_docusaurus_mountain.svg +37 -0
- package/docs/static/img/undraw_docusaurus_react.svg +170 -0
- package/docs/static/img/undraw_docusaurus_tree.svg +40 -0
- package/docs/tsconfig.json +8 -0
- package/package.json +91 -0
- package/speed_test.sh +3 -0
- package/test/benchmark/index.ts +17 -0
- package/test/cli/cli.ts +7 -0
- package/test/commands/test.ts +42 -0
- package/test/controllers/file_upload.ts +29 -0
- package/test/controllers/urlencoded.ts +13 -0
- package/test/controllers/users.ts +111 -0
- package/test/cron/index.ts +6 -0
- package/test/cron/test_cron.ts +8 -0
- package/test/cron/test_cron_imported.ts +8 -0
- package/test/native_env.ts +16 -0
- package/test/resources/test.txt +1 -0
- package/test/server/index.ts +3 -0
- package/test/server/instance.ts +63 -0
- package/test/suite/upload.test.ts +23 -0
- package/test/suite/urlencoded.test.ts +23 -0
- package/test/suite/users.test.ts +76 -0
- package/todo.md +9 -0
- package/tsconfig.json +24 -0
- package/vitest.config.ts +17 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
name: Publish to NPM
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
push:
|
6
|
+
tags:
|
7
|
+
- v*
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
name: Publish
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
permissions:
|
14
|
+
contents: read
|
15
|
+
id-token: write
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- name: Checkout
|
19
|
+
uses: actions/checkout@v4
|
20
|
+
with:
|
21
|
+
ref: ${{github.ref_name}}
|
22
|
+
|
23
|
+
- name: Setup Node.js
|
24
|
+
uses: actions/setup-node@v4
|
25
|
+
with:
|
26
|
+
node-version: '22.14.0'
|
27
|
+
registry-url: 'https://registry.npmjs.org'
|
28
|
+
|
29
|
+
- name: Build package
|
30
|
+
run: |
|
31
|
+
yarn install --frozen-lockfile --non-interactive
|
32
|
+
yarn build
|
33
|
+
|
34
|
+
- name: Publish package
|
35
|
+
run: |
|
36
|
+
yarn publish --access public
|
37
|
+
env:
|
38
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env sh
|
2
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
3
|
+
|
4
|
+
yarn format
|
5
|
+
yarn build:test
|
6
|
+
|
7
|
+
echo "Running tests..."
|
8
|
+
|
9
|
+
echo "Running tests for Node..."
|
10
|
+
yarn test
|
11
|
+
|
12
|
+
echo "Running tests for Bun..."
|
13
|
+
yarn test:bun
|
14
|
+
|
15
|
+
echo "Running tests for Deno..."
|
16
|
+
yarn test:deno
|
17
|
+
|
18
|
+
echo "Adding changes..."
|
19
|
+
git add .
|
package/.nvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
v22.14.0
|
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 francesco sangiovanni
|
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.
|
package/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Balda.js
|
2
|
+
|
3
|
+
A **cross-runtime, FastAPI-inspired Node.js backend framework** that aims to work seamlessly across **Node.js**, **Bun**, and **Deno** runtimes. Built with TypeScript and designed for modern web development.
|
4
|
+
|
5
|
+
## Key Features
|
6
|
+
|
7
|
+
- **Cross-Runtime Compatibility**: Single codebase that runs on Node.js, Bun, and Deno. It uses the native runtime apis for maximum performance (es. `Bun.serve`, `Deno.serve`, etc).
|
8
|
+
- **Decorator-Based Architecture**: Balda-js is inspired by FastAPI, NestJS and ExpressJS syntax with type-safe request/response handling
|
9
|
+
- **Advanced Validation**: TypeBox schema validation with AJV for high-performance validation
|
10
|
+
- **Rich Plugin Ecosystem**: Rate limiting, CORS, file uploads, structured logging, and more
|
11
|
+
- **Built-in CLI & Code Generation**: Scaffolding commands for controllers, plugins, and cron jobs
|
12
|
+
- **Cron Job Support**: Decorator-based scheduling with cross-runtime execution
|
13
|
+
- **Swagger Support**: Built-in Swagger UI and JSON specification
|
14
|
+
|
15
|
+
## Quick Start
|
16
|
+
|
17
|
+
```bash
|
18
|
+
npm install balda-js
|
19
|
+
```
|
20
|
+
|
21
|
+
```typescript
|
22
|
+
import { Server, controller, get } from 'balda-js';
|
23
|
+
|
24
|
+
@controller('/api')
|
25
|
+
class ApiController {
|
26
|
+
@get('/health')
|
27
|
+
async health(req: Request, res: Response) {
|
28
|
+
return res.json({ status: 'ok' });
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
const server = new Server();
|
33
|
+
server.listen();
|
34
|
+
```
|
35
|
+
|
36
|
+
## Documentation
|
37
|
+
|
38
|
+
Visit the comprehensive documentation: **[https://frasan00.github.io/balda-js/](https://frasan00.github.io/balda-js/)**
|
39
|
+
|
40
|
+
## ⚠️ Development Status
|
41
|
+
|
42
|
+
**This project is under active development. APIs and features may change, and breaking changes can occur between releases. Do not use in production**
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|