@gzl10/nexus-backend 0.12.0 → 0.12.2
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 +100 -0
- package/package.json +16 -2
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# @gzl10/nexus-backend
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@gzl10/nexus-backend)
|
|
4
|
+
[](https://www.npmjs.com/package/@gzl10/nexus-backend)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
> **Warning**: This project is currently in testing/experimental phase. Use at your own risk.
|
|
8
|
+
|
|
9
|
+
Backend as a Service (BaaS) with Express 5, Knex and CASL. Build modular, type-safe backends with authentication, authorization, and real-time features.
|
|
10
|
+
|
|
11
|
+
**Repository**: [https://gitlab.gzl10.com/oss/nexus](https://gitlab.gzl10.com/oss/nexus)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @gzl10/nexus-backend
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { start } from '@gzl10/nexus-backend'
|
|
23
|
+
|
|
24
|
+
start()
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
| Feature | Description |
|
|
30
|
+
| ------- | ----------- |
|
|
31
|
+
| Express 5 | Modern async error handling |
|
|
32
|
+
| Knex ORM | SQLite, PostgreSQL, MySQL support |
|
|
33
|
+
| CASL | Attribute-based access control |
|
|
34
|
+
| JWT Auth | Access + refresh tokens with rotation |
|
|
35
|
+
| Socket.IO | Real-time events and notifications |
|
|
36
|
+
| Modular | Plugin architecture for extensions |
|
|
37
|
+
| Storage | Local and S3-compatible storage |
|
|
38
|
+
| Rate Limiting | Built-in rate limiting middleware |
|
|
39
|
+
|
|
40
|
+
## Configuration
|
|
41
|
+
|
|
42
|
+
Create a `.env` file:
|
|
43
|
+
|
|
44
|
+
```env
|
|
45
|
+
PORT=3000
|
|
46
|
+
CORS_ORIGIN=http://localhost:5173
|
|
47
|
+
DATABASE_URL=file:./data/nexus.db
|
|
48
|
+
JWT_SECRET=your-secret-key
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## CLI
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Start server
|
|
55
|
+
npx nexus start
|
|
56
|
+
|
|
57
|
+
# Run migrations
|
|
58
|
+
npx nexus migrate
|
|
59
|
+
|
|
60
|
+
# Seed database
|
|
61
|
+
npx nexus seed
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Exported Functions
|
|
65
|
+
|
|
66
|
+
| Function | Description |
|
|
67
|
+
| -------- | ----------- |
|
|
68
|
+
| `start()` | Start the server |
|
|
69
|
+
| `stop()` | Stop the server |
|
|
70
|
+
| `createApp()` | Create Express app instance |
|
|
71
|
+
| `registerModule()` | Register a custom module |
|
|
72
|
+
| `registerPlugin()` | Register a plugin |
|
|
73
|
+
| `defineAbilityFor()` | Create CASL abilities |
|
|
74
|
+
| `getIO()` | Get Socket.IO instance |
|
|
75
|
+
|
|
76
|
+
## Development
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pnpm dev # Start dev server with watch
|
|
80
|
+
pnpm build # Build for production
|
|
81
|
+
pnpm start # Start production server
|
|
82
|
+
pnpm typecheck # Type check
|
|
83
|
+
pnpm lint # Linting
|
|
84
|
+
pnpm test # Run tests
|
|
85
|
+
pnpm test:coverage # Tests with coverage
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Stack
|
|
89
|
+
|
|
90
|
+
- **Express 5** - Web framework
|
|
91
|
+
- **Knex** - SQL query builder
|
|
92
|
+
- **CASL** - Authorization
|
|
93
|
+
- **JWT** - Authentication
|
|
94
|
+
- **Socket.IO** - Real-time
|
|
95
|
+
- **Zod** - Validation
|
|
96
|
+
- **Pino** - Logging
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gzl10/nexus-backend",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "Backend as a Service (BaaS) with Express 5, Knex and CASL",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,6 +19,20 @@
|
|
|
19
19
|
"public"
|
|
20
20
|
],
|
|
21
21
|
"license": "MIT",
|
|
22
|
+
"author": "Gonzalo Díez <gonzalo@gzl10.com>",
|
|
23
|
+
"homepage": "https://gitlab.gzl10.com/oss/nexus",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://gitlab.gzl10.com/oss/nexus.git",
|
|
27
|
+
"directory": "packages/backend"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://gitlab.gzl10.com/oss/nexus/-/issues"
|
|
31
|
+
},
|
|
32
|
+
"funding": {
|
|
33
|
+
"type": "buymeacoffee",
|
|
34
|
+
"url": "https://www.buymeacoffee.com/gzl10g"
|
|
35
|
+
},
|
|
22
36
|
"keywords": [
|
|
23
37
|
"baas",
|
|
24
38
|
"backend",
|
|
@@ -65,7 +79,7 @@
|
|
|
65
79
|
"sharp": "^0.34.5",
|
|
66
80
|
"socket.io": "^4.8.3",
|
|
67
81
|
"zod": "^3.24.0",
|
|
68
|
-
"@gzl10/nexus-sdk": "0.12.
|
|
82
|
+
"@gzl10/nexus-sdk": "0.12.2"
|
|
69
83
|
},
|
|
70
84
|
"devDependencies": {
|
|
71
85
|
"@types/bcryptjs": "^2.4.0",
|