@expressive-tea/core 2.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.
- package/.gitattributes +4 -0
- package/.swcrc +61 -0
- package/LICENSE +201 -0
- package/README.md +627 -0
- package/banner.png +0 -0
- package/classes/Boot.d.ts +145 -0
- package/classes/Boot.js +223 -0
- package/classes/Engine.d.ts +63 -0
- package/classes/Engine.js +90 -0
- package/classes/EngineRegistry.d.ts +154 -0
- package/classes/EngineRegistry.js +247 -0
- package/classes/LoadBalancer.d.ts +8 -0
- package/classes/LoadBalancer.js +28 -0
- package/classes/ProxyRoute.d.ts +14 -0
- package/classes/ProxyRoute.js +40 -0
- package/classes/Settings.d.ts +128 -0
- package/classes/Settings.js +172 -0
- package/decorators/annotations.d.ts +91 -0
- package/decorators/annotations.js +132 -0
- package/decorators/env.d.ts +145 -0
- package/decorators/env.js +177 -0
- package/decorators/health.d.ts +115 -0
- package/decorators/health.js +124 -0
- package/decorators/module.d.ts +34 -0
- package/decorators/module.js +39 -0
- package/decorators/proxy.d.ts +28 -0
- package/decorators/proxy.js +60 -0
- package/decorators/router.d.ts +199 -0
- package/decorators/router.js +252 -0
- package/decorators/server.d.ts +92 -0
- package/decorators/server.js +247 -0
- package/engines/constants/constants.d.ts +2 -0
- package/engines/constants/constants.js +5 -0
- package/engines/health/index.d.ts +120 -0
- package/engines/health/index.js +179 -0
- package/engines/http/index.d.ts +12 -0
- package/engines/http/index.js +59 -0
- package/engines/index.d.ts +32 -0
- package/engines/index.js +112 -0
- package/engines/socketio/index.d.ts +7 -0
- package/engines/socketio/index.js +30 -0
- package/engines/teacup/index.d.ts +27 -0
- package/engines/teacup/index.js +136 -0
- package/engines/teapot/index.d.ts +32 -0
- package/engines/teapot/index.js +167 -0
- package/engines/websocket/index.d.ts +9 -0
- package/engines/websocket/index.js +39 -0
- package/eslint.config.mjs +138 -0
- package/exceptions/BootLoaderExceptions.d.ts +26 -0
- package/exceptions/BootLoaderExceptions.js +31 -0
- package/exceptions/RequestExceptions.d.ts +75 -0
- package/exceptions/RequestExceptions.js +89 -0
- package/helpers/boot-helper.d.ts +7 -0
- package/helpers/boot-helper.js +84 -0
- package/helpers/decorators.d.ts +1 -0
- package/helpers/decorators.js +15 -0
- package/helpers/promise-helper.d.ts +1 -0
- package/helpers/promise-helper.js +6 -0
- package/helpers/server.d.ts +35 -0
- package/helpers/server.js +141 -0
- package/helpers/teapot-helper.d.ts +18 -0
- package/helpers/teapot-helper.js +88 -0
- package/helpers/websocket-helper.d.ts +3 -0
- package/helpers/websocket-helper.js +20 -0
- package/images/announcement-01.png +0 -0
- package/images/logo-sticky-01.png +0 -0
- package/images/logo-wp-01.png +0 -0
- package/images/logo.png +0 -0
- package/images/zero-oneit.png +0 -0
- package/interfaces/index.d.ts +4 -0
- package/interfaces/index.js +2 -0
- package/inversify.config.d.ts +9 -0
- package/inversify.config.js +8 -0
- package/libs/classNames.d.ts +1 -0
- package/libs/classNames.js +4 -0
- package/libs/utilities.d.ts +21910 -0
- package/libs/utilities.js +420 -0
- package/mixins/module.d.ts +45 -0
- package/mixins/module.js +71 -0
- package/mixins/proxy.d.ts +46 -0
- package/mixins/proxy.js +86 -0
- package/mixins/route.d.ts +48 -0
- package/mixins/route.js +96 -0
- package/package.json +137 -0
- package/services/DependencyInjection.d.ts +159 -0
- package/services/DependencyInjection.js +201 -0
- package/services/WebsocketService.d.ts +18 -0
- package/services/WebsocketService.js +47 -0
- package/types/core.d.ts +14 -0
- package/types/core.js +2 -0
- package/types/injection-types.d.ts +6 -0
- package/types/injection-types.js +10 -0
- package/types/inversify.d.ts +5 -0
- package/types/inversify.js +3 -0
package/README.md
ADDED
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://www.npmjs.com/package/@expressive-tea/core">
|
|
3
|
+
<img alt="npm version" src="https://img.shields.io/npm/v/@expressive-tea/core?style=flat-square">
|
|
4
|
+
</a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@expressive-tea/core">
|
|
6
|
+
<img alt="downloads" src="https://img.shields.io/npm/dw/@expressive-tea/core?style=flat-square">
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://snyk.io//test/github/Expressive-Tea/expresive-tea?targetFile=package.json">
|
|
9
|
+
<img alt="vulnerabilities" src="https://img.shields.io/snyk/vulnerabilities/github/expressive-tea/expresive-tea?style=flat-square">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://codecov.io/gh/Expressive-Tea/expresive-tea">
|
|
12
|
+
<img alt="coverage" src="https://img.shields.io/codecov/c/github/expressive-tea/expresive-tea?label=coverage&style=flat-square">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://travis-ci.org/Expressive-Tea/expresive-tea">
|
|
15
|
+
<img alt="build" src="https://ci.zero-oneit.systems/buildStatus/icon?job=Expressive+Tea&style=flat-square">
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://github.com/Expressive-Tea/expresive-tea/stargazers">
|
|
18
|
+
<img alt="stars" src="https://img.shields.io/github/stars/Expressive-Tea/expresive-tea?style=flat-square">
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://github.com/Expressive-Tea/expresive-tea/blob/main/LICENSE">
|
|
21
|
+
<img alt="license" src="https://img.shields.io/github/license/Expressive-Tea/expresive-tea?style=flat-square">
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<br />
|
|
26
|
+
<p align="center">
|
|
27
|
+
<a href="https://github.com/Expressive-Tea/expresive-tea">
|
|
28
|
+
<img src="images/logo.png" alt="Logo" width="160" />
|
|
29
|
+
</a>
|
|
30
|
+
|
|
31
|
+
<h1 align="center">Expressive Tea</h1>
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<strong>A modern, TypeScript-first framework for building scalable Node.js applications</strong>
|
|
35
|
+
<br />
|
|
36
|
+
<em>Clean architecture β’ Dependency Injection β’ Decorator-driven β’ Express-powered</em>
|
|
37
|
+
<br />
|
|
38
|
+
<br />
|
|
39
|
+
<a href="https://zero-oneit.github.io/expresive-tea/"><strong>π Documentation</strong></a>
|
|
40
|
+
Β·
|
|
41
|
+
<a href="https://codesandbox.io/s/expressive-tea-2kmg7?fontsize=14&hidenavigation=1&theme=dark"><strong>π Live Demo</strong></a>
|
|
42
|
+
Β·
|
|
43
|
+
<a href="https://github.com/Expressive-Tea/expresive-tea/issues"><strong>π Report Bug</strong></a>
|
|
44
|
+
Β·
|
|
45
|
+
<a href="https://github.com/Expressive-Tea/expresive-tea/issues"><strong>π‘ Request Feature</strong></a>
|
|
46
|
+
</p>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
> [!IMPORTANT]
|
|
52
|
+
> ### π¦ Package Renamed: `@expressive-tea/core`
|
|
53
|
+
>
|
|
54
|
+
> **Expressive Tea has a new home on npm!** Starting with v2.0.0, install using:
|
|
55
|
+
>
|
|
56
|
+
> ```bash
|
|
57
|
+
> npm install @expressive-tea/core
|
|
58
|
+
> ```
|
|
59
|
+
>
|
|
60
|
+
> **Legacy package `@zerooneit/expressive-tea` will be maintained until April 30, 2026** for security patches only. Please migrate to `@expressive-tea/core` as soon as possible.
|
|
61
|
+
>
|
|
62
|
+
> **Why the change?**
|
|
63
|
+
> - β¨ Better namespace organization (`@expressive-tea/*`)
|
|
64
|
+
> - π Community-focused ownership
|
|
65
|
+
> - π Clearer project identity
|
|
66
|
+
>
|
|
67
|
+
> **Migration is simple:** Just update your `package.json` and imports remain the same!
|
|
68
|
+
> ```diff
|
|
69
|
+
> - "dependencies": { "@zerooneit/expressive-tea": "^1.2.0" }
|
|
70
|
+
> + "dependencies": { "@expressive-tea/core": "^2.0.0" }
|
|
71
|
+
> ```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
> [!CAUTION]
|
|
76
|
+
> ### β οΈ CRITICAL: v1.x Security Notice
|
|
77
|
+
>
|
|
78
|
+
> **All versions 1.x are DEPRECATED and UNSUPPORTED** as of January 27, 2026.
|
|
79
|
+
>
|
|
80
|
+
> **v1.3.x Beta** - π΄ **CRITICAL SECURITY VULNERABILITY** - DO NOT USE
|
|
81
|
+
> Contains critical cryptography flaws in Teapot/Teacup gateway. If you're using this, **STOP IMMEDIATELY** and upgrade to v2.0.0.
|
|
82
|
+
>
|
|
83
|
+
> **v1.2.x Production** - π‘ No crypto issues, but **deprecated** (InversifyJS v6 EOL)
|
|
84
|
+
>
|
|
85
|
+
> **π Upgrade to v2.0.0 NOW** - See [Migration Guide](docs/MIGRATION_GUIDE_v2.md)
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## β‘ Quick Start
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Install the new package
|
|
93
|
+
npm install @expressive-tea/core
|
|
94
|
+
|
|
95
|
+
# Or with yarn
|
|
96
|
+
yarn add @expressive-tea/core
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { ServerSettings, Route, Get, Boot } from '@expressive-tea/core';
|
|
101
|
+
|
|
102
|
+
@ServerSettings({ port: 3000 })
|
|
103
|
+
class App extends Boot {}
|
|
104
|
+
|
|
105
|
+
@Route('/hello')
|
|
106
|
+
class HelloController {
|
|
107
|
+
@Get('/')
|
|
108
|
+
sayHello() {
|
|
109
|
+
return { message: 'Hello, World! π΅' };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
new App().start();
|
|
114
|
+
// π Server running on http://localhost:3000
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**[Try it live on CodeSandbox β](https://codesandbox.io/s/expressive-tea-2kmg7?fontsize=14&hidenavigation=1&theme=dark)**
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## π― Why Expressive Tea?
|
|
122
|
+
|
|
123
|
+
### The Problem
|
|
124
|
+
Building Node.js applications is powerful, but messy. You get a blank canvas with Expressβno structure, no conventions, just middleware chaos. Sound familiar?
|
|
125
|
+
|
|
126
|
+
### The Solution
|
|
127
|
+
**Expressive Tea** brings the elegance of modern frameworks to Node.js, without the bloat. Think NestJS simplicity meets Express flexibility.
|
|
128
|
+
|
|
129
|
+
### π What Makes It Special
|
|
130
|
+
|
|
131
|
+
| Feature | What You Get |
|
|
132
|
+
|---------|-------------|
|
|
133
|
+
| π¨ **Clean Architecture** | Decorators organize your code beautifullyβno more spaghetti routes |
|
|
134
|
+
| π **Plugin Everything** | Share database configs, auth, websockets across projects |
|
|
135
|
+
| π **Smart DI** | Singleton, Transient, Scoped servicesβInversifyJS under the hood |
|
|
136
|
+
| π‘οΈ **Type-Safe** | Full TypeScript strict modeβcatch bugs before they ship |
|
|
137
|
+
| π **Secure by Default** | AES-256-GCM + HKDF crypto, built-in security best practices |
|
|
138
|
+
| β‘ **Production Ready** | 92%+ test coverage, battle-tested in real applications |
|
|
139
|
+
| π― **Express Compatible** | Use ANY Express middlewareβgradual migration friendly |
|
|
140
|
+
| π¦ **Zero Lock-in** | BYOA (Bring Your Own Architecture)βwe don't force opinions |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## π What's New in v2.0
|
|
145
|
+
|
|
146
|
+
**Major security and architecture improvements!**
|
|
147
|
+
|
|
148
|
+
```diff
|
|
149
|
+
+ β
Security: Fixed critical crypto vulnerabilities (AES-256-GCM + HKDF)
|
|
150
|
+
+ β
Type Safety: Full TypeScript strict mode support
|
|
151
|
+
+ β
DI: Scoped dependency injection (Singleton/Transient/Scoped)
|
|
152
|
+
+ β
Health Checks: Built-in health endpoints for Kubernetes/monitoring
|
|
153
|
+
+ β
Environment: .env file support with @Env decorator
|
|
154
|
+
+ β
Performance: Native utilities, removed lodash dependencies
|
|
155
|
+
+ β
ESLint: Migrated to ESLint v9 flat config
|
|
156
|
+
+ β
Quality: 95%+ coverage, all tests passing
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**β οΈ Breaking Changes:**
|
|
160
|
+
- Cryptography format changed (must re-encrypt data)
|
|
161
|
+
- TypeScript strict mode enabled
|
|
162
|
+
- **Node.js 20+ required** (Node.js 18 reached EOL April 2025)
|
|
163
|
+
- Express 5.x required
|
|
164
|
+
- ESLint v9 (flat config)
|
|
165
|
+
|
|
166
|
+
**[π Full Changelog](CHANGELOG.md)** β’ **[π Migration Guide](docs/MIGRATION_GUIDE_v2.md)**
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## π‘ Features That'll Make You Smile
|
|
171
|
+
|
|
172
|
+
### π¨ Decorator-Driven Development
|
|
173
|
+
```typescript
|
|
174
|
+
@Route('/api/users')
|
|
175
|
+
class UserController {
|
|
176
|
+
@Get('/:id')
|
|
177
|
+
async getUser(@Param('id') id: string) {
|
|
178
|
+
return this.userService.findById(id);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@Post('/')
|
|
182
|
+
async createUser(@Body() data: CreateUserDto) {
|
|
183
|
+
return this.userService.create(data);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### π Pluggable Architecture
|
|
189
|
+
```typescript
|
|
190
|
+
import { AuthPlugin } from '@my-org/auth-plugin';
|
|
191
|
+
import { DatabasePlugin } from '@my-org/db-plugin';
|
|
192
|
+
|
|
193
|
+
@ServerSettings({
|
|
194
|
+
port: 3000,
|
|
195
|
+
plugins: [AuthPlugin, DatabasePlugin]
|
|
196
|
+
})
|
|
197
|
+
class App extends Boot {}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### π Dependency Injection
|
|
201
|
+
```typescript
|
|
202
|
+
@injectable()
|
|
203
|
+
class UserService {
|
|
204
|
+
constructor(
|
|
205
|
+
@inject(TYPES.Database) private db: Database,
|
|
206
|
+
@inject(TYPES.Logger) private logger: Logger
|
|
207
|
+
) {}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### π― Type-Safe Everything
|
|
212
|
+
```typescript
|
|
213
|
+
// Generics everywhere
|
|
214
|
+
class ApiResponse<T> {
|
|
215
|
+
constructor(
|
|
216
|
+
public data: T,
|
|
217
|
+
public status: number
|
|
218
|
+
) {}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@Get('/users')
|
|
222
|
+
getUsers(): ApiResponse<User[]> {
|
|
223
|
+
return new ApiResponse(users, 200);
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### π₯ Built-in Health Checks
|
|
228
|
+
```typescript
|
|
229
|
+
@HealthCheck({
|
|
230
|
+
checks: [
|
|
231
|
+
{
|
|
232
|
+
name: 'database',
|
|
233
|
+
check: async () => {
|
|
234
|
+
const isConnected = await db.ping();
|
|
235
|
+
return { status: isConnected ? 'pass' : 'fail' };
|
|
236
|
+
},
|
|
237
|
+
critical: true, // Blocks readiness probe if fails
|
|
238
|
+
timeout: 5000
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
})
|
|
242
|
+
class App extends Boot {}
|
|
243
|
+
|
|
244
|
+
// Endpoints:
|
|
245
|
+
// GET /health - Detailed health status
|
|
246
|
+
// GET /health/live - Liveness probe (K8s)
|
|
247
|
+
// GET /health/ready - Readiness probe (K8s)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### π Environment Variable Support
|
|
251
|
+
```typescript
|
|
252
|
+
// Load from .env files
|
|
253
|
+
@Env({ path: '.env', required: ['DATABASE_URL', 'API_KEY'] })
|
|
254
|
+
@Env({ path: '.env.local', override: true, silent: true })
|
|
255
|
+
class App extends Boot {}
|
|
256
|
+
|
|
257
|
+
// In your .env:
|
|
258
|
+
// DATABASE_URL=postgres://localhost:5432/mydb
|
|
259
|
+
// API_KEY="secret-key"
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### π― Type-Safe Environment Variables (v2.0.1+)
|
|
263
|
+
```typescript
|
|
264
|
+
import { z } from 'zod';
|
|
265
|
+
|
|
266
|
+
const EnvSchema = z.object({
|
|
267
|
+
PORT: z.string().transform(Number),
|
|
268
|
+
DATABASE_URL: z.string().url(),
|
|
269
|
+
API_KEY: z.string().min(32)
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
type Env = z.infer<typeof EnvSchema>;
|
|
273
|
+
|
|
274
|
+
@Env<Env>({
|
|
275
|
+
transform: (env) => EnvSchema.parse(env),
|
|
276
|
+
onTransformError: 'throw' // Fail fast on invalid env
|
|
277
|
+
})
|
|
278
|
+
class App extends Boot {
|
|
279
|
+
constructor() {
|
|
280
|
+
super();
|
|
281
|
+
const env = Settings.getInstance().getEnv<Env>();
|
|
282
|
+
console.log(env.PORT); // Type: number (validated!)
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### π Configuration Files (v2.0.1+)
|
|
288
|
+
```yaml
|
|
289
|
+
# .expressive-tea.yaml (YAML support!)
|
|
290
|
+
port: 3000
|
|
291
|
+
securePort: 4443
|
|
292
|
+
|
|
293
|
+
database:
|
|
294
|
+
host: localhost
|
|
295
|
+
port: 5432
|
|
296
|
+
|
|
297
|
+
# Comments supported!
|
|
298
|
+
cache:
|
|
299
|
+
enabled: true
|
|
300
|
+
ttl: 3600
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**File Priority**: `.expressive-tea.yaml` > `.expressive-tea.yml` > `.expressive-tea` (JSON)
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## π¦ Installation & Setup
|
|
308
|
+
|
|
309
|
+
### Prerequisites
|
|
310
|
+
|
|
311
|
+
- **Node.js** β₯ 20.0.0
|
|
312
|
+
- **TypeScript** β₯ 5.0.0
|
|
313
|
+
- **Express** β₯ 5.0.0
|
|
314
|
+
|
|
315
|
+
> **Note:** Node.js 18 support was dropped in v2.0.0 as it reached End-of-Life in April 2025. We recommend using Node.js 20 LTS or Node.js 22 for the best experience and security updates.
|
|
316
|
+
|
|
317
|
+
### Configure TypeScript
|
|
318
|
+
|
|
319
|
+
```json
|
|
320
|
+
{
|
|
321
|
+
"compilerOptions": {
|
|
322
|
+
"target": "ES2017",
|
|
323
|
+
"module": "commonjs",
|
|
324
|
+
"experimentalDecorators": true,
|
|
325
|
+
"emitDecoratorMetadata": true,
|
|
326
|
+
|
|
327
|
+
// Recommended for maximum safety
|
|
328
|
+
"strict": true,
|
|
329
|
+
"strictNullChecks": true,
|
|
330
|
+
"noImplicitAny": true
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Install
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
# npm
|
|
339
|
+
npm install @expressive-tea/core reflect-metadata
|
|
340
|
+
|
|
341
|
+
# yarn
|
|
342
|
+
yarn add @expressive-tea/core reflect-metadata
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Local staging with Verdaccio
|
|
348
|
+
|
|
349
|
+
If you want to test publishing locally before pushing to the public registry, use a local Verdaccio instance as a staging registry.
|
|
350
|
+
|
|
351
|
+
Quick steps:
|
|
352
|
+
|
|
353
|
+
1. Start Verdaccio (Docker):
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
docker run -d --rm --name verdaccio-expressive-tea -p 4873:4873 verdaccio/verdaccio:latest
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
2. Point npm to local registry and publish:
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# point npm to local registry
|
|
363
|
+
npm set registry http://localhost:4873
|
|
364
|
+
|
|
365
|
+
# publish (from package root)
|
|
366
|
+
npm publish --registry http://localhost:4873
|
|
367
|
+
|
|
368
|
+
# restore default registry
|
|
369
|
+
npm set registry https://registry.npmjs.org/
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
3. Optional: Use the repo-provided Verdaccio config for deterministic behavior:
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
docker run -d --rm --name verdaccio-expressive-tea -p 4873:4873 \
|
|
376
|
+
-v $(pwd)/.docs/verdaccio/config.yaml:/verdaccio/conf/config.yaml \
|
|
377
|
+
verdaccio/verdaccio:latest
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
Notes:
|
|
381
|
+
- Default URL: http://localhost:4873
|
|
382
|
+
- Container name: verdaccio-expressive-tea (the agent checks for this name before starting a new container)
|
|
383
|
+
- Anonymous publishing is enabled in the example config (local only). Do not expose to public networks.
|
|
384
|
+
- The config permits overwriting the same package version for easy iterative testing.
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
### Your First App
|
|
388
|
+
|
|
389
|
+
**1. Create your server:**
|
|
390
|
+
```typescript
|
|
391
|
+
// server.ts
|
|
392
|
+
import 'reflect-metadata';
|
|
393
|
+
import { ServerSettings, Boot } from '@expressive-tea/core';
|
|
394
|
+
|
|
395
|
+
@ServerSettings({
|
|
396
|
+
port: 3000,
|
|
397
|
+
controllers: [HelloController]
|
|
398
|
+
})
|
|
399
|
+
class MyApp extends Boot {}
|
|
400
|
+
|
|
401
|
+
export default MyApp;
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
**2. Add a controller:**
|
|
405
|
+
```typescript
|
|
406
|
+
// controllers/hello.controller.ts
|
|
407
|
+
import { Route, Get } from '@expressive-tea/core';
|
|
408
|
+
|
|
409
|
+
@Route('/hello')
|
|
410
|
+
export class HelloController {
|
|
411
|
+
@Get('/')
|
|
412
|
+
sayHello() {
|
|
413
|
+
return { message: 'Hello, Expressive Tea! π΅' };
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
**3. Start it up:**
|
|
419
|
+
```typescript
|
|
420
|
+
// main.ts
|
|
421
|
+
import MyApp from './server';
|
|
422
|
+
|
|
423
|
+
const app = new MyApp();
|
|
424
|
+
app.start().then(() => {
|
|
425
|
+
console.log('π Server is running!');
|
|
426
|
+
});
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
**[π Full Tutorial β](https://zero-oneit.github.io/expresive-tea/)**
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## π Learn More
|
|
434
|
+
|
|
435
|
+
### π Documentation
|
|
436
|
+
- [Complete Guide](https://zero-oneit.github.io/expresive-tea/) - Full documentation
|
|
437
|
+
- [API Reference](https://zero-oneit.github.io/expresive-tea/api/) - Complete API docs
|
|
438
|
+
- [Examples](https://github.com/Expressive-Tea/expressive-tea-sandbox) - Sample projects
|
|
439
|
+
|
|
440
|
+
### π v2.0.1 Features
|
|
441
|
+
- [Configuration Files Guide](docs/configuration-files.md) - YAML/JSON config support
|
|
442
|
+
- [Environment Variables Guide](docs/env-decorator.md) - Type-safe env with Zod
|
|
443
|
+
|
|
444
|
+
### π Migration & Upgrading
|
|
445
|
+
- [Migration Guide v1 β v2](docs/MIGRATION_GUIDE_v2.md) - Step-by-step upgrade
|
|
446
|
+
- [Release Notes v2.0](docs/RELEASE_NOTES_v2.0.0.md) - What's new
|
|
447
|
+
- [Deprecation Notice](docs/DEPRECATION_NOTICE.md) - v1.x timeline
|
|
448
|
+
|
|
449
|
+
### π‘οΈ Security
|
|
450
|
+
- [Security Policy](SECURITY.md) - Vulnerability reporting
|
|
451
|
+
- [Changelog](CHANGELOG.md) - Version history
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
## π€ Contributing
|
|
456
|
+
|
|
457
|
+
We love contributions! Whether it's bug fixes, features, or docs.
|
|
458
|
+
|
|
459
|
+
**Quick links:**
|
|
460
|
+
- [Contributing Guide](CONTRIBUTING.md) - How to contribute
|
|
461
|
+
- [Code of Conduct](CODE_OF_CONDUCT.md) - Community guidelines
|
|
462
|
+
- [Issues](https://github.com/Expressive-Tea/expresive-tea/issues) - Report bugs or request features
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
# Get started
|
|
466
|
+
git clone https://github.com/Expressive-Tea/expresive-tea.git
|
|
467
|
+
cd expresive-tea
|
|
468
|
+
yarn install
|
|
469
|
+
yarn test
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### π€ AI-Assisted Development & Vibe Coding
|
|
473
|
+
|
|
474
|
+
**We welcome AI-assisted contributions!** Whether you're using GitHub Copilot, Cursor, Claude, or other AI coding assistants, we embrace the future of collaborative development.
|
|
475
|
+
|
|
476
|
+
**β οΈ IMPORTANT: AI-Generated Code Requirements**
|
|
477
|
+
|
|
478
|
+
If you're using AI tools for code generation, you **MUST**:
|
|
479
|
+
|
|
480
|
+
1. **π Follow Repository Guidelines**
|
|
481
|
+
- β
Read and strictly adhere to [`AGENTS.md`](AGENTS.md) - Agent-specific coding rules
|
|
482
|
+
- β
Read and strictly adhere to [`CLAUDE.md`](CLAUDE.md) - Claude AI guidelines
|
|
483
|
+
- β
These files contain critical project conventions, style guides, and quality standards
|
|
484
|
+
|
|
485
|
+
2. **π¨βπ» Human Review is MANDATORY**
|
|
486
|
+
- β
**All AI-generated code MUST be reviewed by a human developer** before creating a pull request
|
|
487
|
+
- β
Understand the code completelyβdon't submit code you can't explain
|
|
488
|
+
- β
Test thoroughly (aim for 95%+ coverage)
|
|
489
|
+
- β
Verify the code follows our architectural patterns and best practices
|
|
490
|
+
|
|
491
|
+
3. **β
Quality Standards**
|
|
492
|
+
- β
All tests must pass (`yarn test`)
|
|
493
|
+
- β
Linting must pass (`yarn linter:ci`)
|
|
494
|
+
- β
TypeScript must compile without errors (`yarn build`)
|
|
495
|
+
- β
Code must match our existing patterns and conventions
|
|
496
|
+
- β
Documentation must be updated (JSDoc, README, CHANGELOG)
|
|
497
|
+
|
|
498
|
+
4. **π PR Transparency**
|
|
499
|
+
- β
Disclose AI assistance in your pull request description
|
|
500
|
+
- β
Example: "This PR was developed with assistance from Claude/Copilot/Cursor"
|
|
501
|
+
- β
Highlight any sections that were fully AI-generated for extra review
|
|
502
|
+
|
|
503
|
+
**Why These Rules?**
|
|
504
|
+
|
|
505
|
+
- π‘οΈ **Quality Assurance** - AI can make subtle mistakes humans catch
|
|
506
|
+
- π― **Consistency** - Ensures code matches our architectural vision
|
|
507
|
+
- π **Knowledge Transfer** - Reviewers understand your contribution
|
|
508
|
+
- π **Security** - Prevents AI from introducing vulnerabilities
|
|
509
|
+
- π€ **Collaboration** - Maintains clear communication in the codebase
|
|
510
|
+
|
|
511
|
+
**Vibe Coding Best Practices:**
|
|
512
|
+
|
|
513
|
+
```typescript
|
|
514
|
+
// β
GOOD: AI-generated, reviewed, and refined by human
|
|
515
|
+
@Route('/api/users')
|
|
516
|
+
class UserController {
|
|
517
|
+
@Get('/:id')
|
|
518
|
+
async getUser(@Param('id') id: string): Promise<User> {
|
|
519
|
+
// Human: Added validation per AGENTS.md security guidelines
|
|
520
|
+
if (!id || !validator.isUUID(id)) {
|
|
521
|
+
throw new BadRequestException('Invalid user ID');
|
|
522
|
+
}
|
|
523
|
+
return this.userService.findById(id);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// β BAD: AI-generated, unreviewed, missing error handling
|
|
528
|
+
@Route('/api/users')
|
|
529
|
+
class UserController {
|
|
530
|
+
@Get('/:id')
|
|
531
|
+
async getUser(@Param('id') id: string) {
|
|
532
|
+
return this.userService.findById(id); // What if id is invalid?
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
**π Required Reading for AI-Assisted Development:**
|
|
538
|
+
- [`AGENTS.md`](AGENTS.md) - Repository-specific rules for AI agents
|
|
539
|
+
- [`CLAUDE.md`](CLAUDE.md) - Claude AI coding guidelines
|
|
540
|
+
- [`CONTRIBUTING.md`](CONTRIBUTING.md) - General contribution guide
|
|
541
|
+
- [`.prettierrc`](.prettierrc) - Code formatting rules
|
|
542
|
+
- [`eslint.config.js`](eslint.config.js) - Linting configuration
|
|
543
|
+
|
|
544
|
+
**Questions?** Ask in [GitHub Discussions](https://github.com/Expressive-Tea/expresive-tea/discussions) before submitting AI-generated code.
|
|
545
|
+
|
|
546
|
+
---
|
|
547
|
+
|
|
548
|
+
## π¬ Community & Support
|
|
549
|
+
|
|
550
|
+
### Get Help
|
|
551
|
+
- π [Documentation](https://zero-oneit.github.io/expresive-tea/)
|
|
552
|
+
- π¬ [Gitter Chat](https://gitter.im/Expressive-Tea/expresive-tea)
|
|
553
|
+
- π§ [Email Support](mailto:support@expressive-tea.io)
|
|
554
|
+
- π [GitHub Issues](https://github.com/Expressive-Tea/expresive-tea/issues)
|
|
555
|
+
- π [Stack Overflow](https://stackoverflow.com/questions/tagged/expressive-tea) - Use tag `expressive-tea`
|
|
556
|
+
|
|
557
|
+
### Stay Connected
|
|
558
|
+
- π¦ Twitter: [@expressive_tea](https://twitter.com/expressive_tea)
|
|
559
|
+
- π§ Email: [support@expressive-tea.io](mailto:support@expressive-tea.io)
|
|
560
|
+
- π¨βπ» Author: [Diego Resendez](https://twitter.com/diegoresendez)
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
564
|
+
## π Built With
|
|
565
|
+
|
|
566
|
+
| Technology | Purpose |
|
|
567
|
+
|------------|---------|
|
|
568
|
+
| [Express](https://expressjs.com/) | Fast, unopinionated web framework |
|
|
569
|
+
| [TypeScript](https://www.typescriptlang.org/) | Type-safe JavaScript |
|
|
570
|
+
| [InversifyJS](https://inversify.io/) | Powerful dependency injection |
|
|
571
|
+
| [Reflect Metadata](https://github.com/rbuckton/reflect-metadata) | Decorator metadata support |
|
|
572
|
+
|
|
573
|
+
---
|
|
574
|
+
|
|
575
|
+
## π Sponsors
|
|
576
|
+
|
|
577
|
+
Building Expressive Tea takes time and dedication. If this project helps you, consider sponsoring!
|
|
578
|
+
|
|
579
|
+
**Principal Sponsor:**
|
|
580
|
+
|
|
581
|
+
<p align="center">
|
|
582
|
+
<a href="https://zerooneit.com" target="_blank">
|
|
583
|
+
<img src="images/zero-oneit.png" width="180" alt="Zero-OneIT" />
|
|
584
|
+
</a>
|
|
585
|
+
</p>
|
|
586
|
+
|
|
587
|
+
**Interested in sponsoring?** Contact [projects@zero-oneit.com](mailto:projects@zero-oneit.com)
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## π License
|
|
592
|
+
|
|
593
|
+
Apache-2.0 License - see [LICENSE](LICENSE) file for details
|
|
594
|
+
|
|
595
|
+
<p align="center">
|
|
596
|
+
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2FExpressive-Tea%2Fexpresive-tea?ref=badge_large">
|
|
597
|
+
<img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2FExpressive-Tea%2Fexpresive-tea.svg?type=large" />
|
|
598
|
+
</a>
|
|
599
|
+
</p>
|
|
600
|
+
|
|
601
|
+
---
|
|
602
|
+
|
|
603
|
+
## π Versioning
|
|
604
|
+
|
|
605
|
+
We use [Semantic Versioning](http://semver.org/) (SemVer). See [tags](https://github.com/Expressive-Tea/expresive-tea/tags) for available versions.
|
|
606
|
+
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
## π₯ Contributors
|
|
610
|
+
|
|
611
|
+
**Lead Developer:** [Diego Resendez](https://github.com/zerooneit)
|
|
612
|
+
|
|
613
|
+
See all [contributors](https://github.com/Expressive-Tea/expresive-tea/contributors) who've helped shape Expressive Tea.
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## β€οΈ Credits
|
|
618
|
+
|
|
619
|
+
Logo and banner designed by [Freepik](http://www.freepik.com)
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
<p align="center">
|
|
624
|
+
Made with β and π΅ by the Expressive Tea Team
|
|
625
|
+
<br />
|
|
626
|
+
<sub>Start brewing better Node.js apps today!</sub>
|
|
627
|
+
</p>
|
package/banner.png
ADDED
|
Binary file
|