exisjs 0.7.11 → 0.7.13
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 +195 -39
- package/dist/cli/commands/dev.d.ts +4 -0
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +136 -32
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/run.d.ts +7 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +99 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/index.js +29 -13
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/manifest.d.ts.map +1 -1
- package/dist/cli/manifest.js +18 -3
- package/dist/cli/manifest.js.map +1 -1
- package/dist/cli/routes.d.ts +6 -0
- package/dist/cli/routes.d.ts.map +1 -1
- package/dist/cli/routes.js +224 -135
- package/dist/cli/routes.js.map +1 -1
- package/dist/config/config.d.ts +2 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +30 -9
- package/dist/config/types.d.ts.map +1 -1
- package/dist/database/lifecycle.d.ts +6 -1
- package/dist/database/lifecycle.d.ts.map +1 -1
- package/dist/database/lifecycle.js +15 -4
- package/dist/database/lifecycle.js.map +1 -1
- package/dist/decorators/params.d.ts +21 -0
- package/dist/decorators/params.d.ts.map +1 -1
- package/dist/decorators/params.js +21 -1
- package/dist/decorators/params.js.map +1 -1
- package/dist/di/container.d.ts +15 -6
- package/dist/di/container.d.ts.map +1 -1
- package/dist/di/container.js +26 -3
- package/dist/di/container.js.map +1 -1
- package/dist/di/index.d.ts +1 -1
- package/dist/di/index.d.ts.map +1 -1
- package/dist/di/index.js.map +1 -1
- package/dist/di/inject.d.ts +2 -1
- package/dist/di/inject.d.ts.map +1 -1
- package/dist/di/inject.js +2 -1
- package/dist/di/inject.js.map +1 -1
- package/dist/docs/BENCHMARKS.md +4 -4
- package/dist/docs/content/README.md +43 -44
- package/dist/docs/content/boundaries.mdx +141 -48
- package/dist/docs/content/cli/commands.mdx +161 -107
- package/dist/docs/content/cli/overview.mdx +61 -46
- package/dist/docs/content/cli/usage.mdx +107 -30
- package/dist/docs/content/config.mdx +145 -147
- package/dist/docs/content/controllers.mdx +193 -464
- package/dist/docs/content/cron.mdx +183 -69
- package/dist/docs/content/decorators.mdx +449 -154
- package/dist/docs/content/errors.mdx +202 -305
- package/dist/docs/content/exisjs-mcp.mdx +59 -49
- package/dist/docs/content/installation.mdx +243 -157
- package/dist/docs/content/introduction.mdx +220 -48
- package/dist/docs/content/middleware.mdx +171 -497
- package/dist/docs/content/modules.mdx +141 -83
- package/dist/docs/content/providers.mdx +216 -180
- package/dist/docs/content/requests.mdx +168 -488
- package/dist/docs/content/responses.mdx +200 -533
- package/dist/docs/content/routing.mdx +239 -558
- package/dist/docs/content/security.mdx +233 -57
- package/dist/docs/content/structure.mdx +151 -240
- package/dist/docs/content/swagger.mdx +192 -91
- package/dist/docs/content/testing.mdx +205 -74
- package/dist/docs/content/validation.mdx +479 -341
- package/dist/docs/reference/README.md +34 -2
- package/dist/docs/reference/config.mdx +277 -73
- package/dist/docs/reference/context.mdx +197 -106
- package/dist/docs/reference/cron.mdx +266 -152
- package/dist/docs/reference/database.mdx +135 -53
- package/dist/docs/reference/decorators.mdx +234 -116
- package/dist/docs/reference/di.mdx +146 -112
- package/dist/docs/reference/error.mdx +155 -178
- package/dist/docs/reference/exis.mdx +141 -70
- package/dist/docs/reference/logger.mdx +110 -126
- package/dist/docs/reference/middleware.mdx +235 -158
- package/dist/docs/reference/plugin.mdx +136 -64
- package/dist/docs/reference/router.mdx +277 -251
- package/dist/docs/reference/sanitize.mdx +91 -87
- package/dist/docs/reference/swagger.mdx +280 -100
- package/dist/docs/reference/testing.mdx +223 -89
- package/dist/docs/reference/validator.mdx +194 -206
- package/dist/lib/inspect-routes.d.ts +2 -0
- package/dist/lib/inspect-routes.d.ts.map +1 -0
- package/dist/lib/inspect-routes.js +148 -0
- package/dist/lib/inspect-routes.js.map +1 -0
- package/dist/lib/start-server.js +13 -8
- package/dist/lib/start-server.js.map +1 -1
- package/dist/module/module.d.ts +6 -3
- package/dist/module/module.d.ts.map +1 -1
- package/dist/module/module.js +17 -3
- package/dist/module/module.js.map +1 -1
- package/dist/router/controller-registrar.d.ts.map +1 -1
- package/dist/router/controller-registrar.js +26 -4
- package/dist/router/controller-registrar.js.map +1 -1
- package/dist/router/scanner/cron-mounter.d.ts.map +1 -1
- package/dist/router/scanner/cron-mounter.js +9 -2
- package/dist/router/scanner/cron-mounter.js.map +1 -1
- package/dist/server/app.d.ts +3 -1
- package/dist/server/app.d.ts.map +1 -1
- package/dist/server/app.js +29 -8
- package/dist/server/app.js.map +1 -1
- package/dist/server/define.d.ts.map +1 -1
- package/dist/server/define.js +5 -0
- package/dist/server/define.js.map +1 -1
- package/dist/server/request.d.ts +2 -0
- package/dist/server/request.d.ts.map +1 -1
- package/dist/server/request.js +11 -0
- package/dist/server/request.js.map +1 -1
- package/dist/swagger/generator.d.ts.map +1 -1
- package/dist/swagger/generator.js +130 -10
- package/dist/swagger/generator.js.map +1 -1
- package/dist/telemetry/index.d.ts +12 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +121 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/testing/client.d.ts +1 -0
- package/dist/testing/client.d.ts.map +1 -1
- package/dist/testing/client.js +4 -1
- package/dist/testing/client.js.map +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +20 -4
- package/dist/testing/index.js.map +1 -1
- package/dist/validator/builder.d.ts +26 -1
- package/dist/validator/builder.d.ts.map +1 -1
- package/dist/validator/builder.js +31 -0
- package/dist/validator/builder.js.map +1 -1
- package/dist/validator/engine.d.ts +23 -0
- package/dist/validator/engine.d.ts.map +1 -1
- package/dist/validator/engine.js +228 -31
- package/dist/validator/engine.js.map +1 -1
- package/dist/validator/index.d.ts +8 -4
- package/dist/validator/index.d.ts.map +1 -1
- package/dist/validator/index.js +4 -1
- package/dist/validator/index.js.map +1 -1
- package/dist/validator/tex-types.d.ts +15 -0
- package/dist/validator/tex-types.d.ts.map +1 -1
- package/dist/validator/tex-types.js +102 -0
- package/dist/validator/tex-types.js.map +1 -1
- package/dist/validator/tex.d.ts +1 -1
- package/dist/validator/tex.d.ts.map +1 -1
- package/dist/validator/tex.js +3 -1
- package/dist/validator/tex.js.map +1 -1
- package/dist/validator/types.d.ts +1 -0
- package/dist/validator/types.d.ts.map +1 -1
- package/package.json +47 -14
- package/dist/docs/content/dataloader.mdx +0 -170
- package/dist/docs/reference/dataloader.mdx +0 -91
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description:
|
|
2
|
+
title: "AI Integration (MCP)"
|
|
3
|
+
description: "Model Context Protocol (MCP) server integration for ExisJS documentation lookups and code scaffolding."
|
|
4
|
+
nextUrl: "/docs/cli/overview"
|
|
5
|
+
nextTitle: "CLI Architecture"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
# ExisJS MCP Server
|
|
8
|
+
# ExisJS MCP Server (`@exisjs/mcp`)
|
|
7
9
|
|
|
8
|
-
The **Model Context Protocol (MCP)**
|
|
10
|
+
The **Model Context Protocol (MCP)** server allows AI coding assistants (such as Google Antigravity, Claude Code, Cursor, and Windsurf) to introspect your ExisJS project, query local framework documentation, and scaffold idiomatic boilerplate code.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
Without the MCP, AI agents often hallucinate Express or NestJS syntax when asked to write ExisJS code because ExisJS might not be fully present in their training data. By using the ExisJS MCP, the AI reads the exact documentation for your installed version and uses strict generators to scaffold perfect code.
|
|
14
|
-
</Info>
|
|
16
|
+
When developing with ExisJS, external AI models may occasionally generate outdated patterns from other frameworks. The `@exisjs/mcp` server connects your AI assistant directly to your local project environment, ensuring:
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
1. **Version-Matched Offline Documentation**: The AI queries documentation bundled directly with your project's installed `@exisjs` packages.
|
|
19
|
+
2. **Deterministic Scaffolding**: The AI uses verified code generators for routes, boundaries, validation schemas, plugins, and configuration files across both Functional and OOP paradigms.
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
- An AI Coding Assistant that supports the Model Context Protocol (e.g., Claude Code, Cursor, Windsurf, or Google Antigravity).
|
|
21
|
+
---
|
|
20
22
|
|
|
21
|
-
## Installation
|
|
23
|
+
## Installation & Setup
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
### Automatic Installation (`add-mcp`)
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
<CopyCommand command="npx add-mcp @exisjs/mcp@latest" />
|
|
27
|
-
</div>
|
|
27
|
+
You can install `@exisjs/mcp` across all detected local coding agents:
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
```bash
|
|
30
|
+
npx add-mcp @exisjs/mcp@latest -y
|
|
31
|
+
```
|
|
30
32
|
|
|
31
33
|
### Manual Configuration
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
Add `@exisjs/mcp` to your IDE's MCP configuration settings (`mcp.json` or settings file):
|
|
34
36
|
|
|
35
37
|
```json filename="mcp.json"
|
|
36
38
|
{
|
|
@@ -43,55 +45,63 @@ If you prefer to configure your AI client manually (or are using an unsupported
|
|
|
43
45
|
}
|
|
44
46
|
```
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
<summary className="cursor-pointer font-medium text-foreground py-2">Claude Code Setup</summary>
|
|
48
|
+
#### Claude Code Setup
|
|
48
49
|
|
|
49
50
|
Run the following command in your terminal:
|
|
51
|
+
|
|
50
52
|
```bash
|
|
51
53
|
claude mcp add exisjs-mcp npx @exisjs/mcp@latest
|
|
52
54
|
```
|
|
53
|
-
</details>
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
<summary className="cursor-pointer font-medium text-foreground py-2">Cursor Setup</summary>
|
|
56
|
+
#### Cursor Setup
|
|
57
57
|
|
|
58
|
-
1. Open Cursor Settings.
|
|
59
|
-
2. Navigate to **Features > MCP**.
|
|
58
|
+
1. Open **Cursor Settings** (`Cmd+,` or `Ctrl+,`).
|
|
59
|
+
2. Navigate to **Features** > **MCP**.
|
|
60
60
|
3. Click **+ Add New MCP Server**.
|
|
61
|
-
4.
|
|
62
|
-
5. Command
|
|
63
|
-
</details>
|
|
61
|
+
4. Set **Name** to `exisjs-mcp`.
|
|
62
|
+
5. Set **Command** to `npx -y @exisjs/mcp@latest`.
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
---
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
## Available MCP Tools
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
Once initialized, the assistant gains access to the following toolset:
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
### 1. Documentation Tools
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
| Tool Name | Parameters | Description |
|
|
73
|
+
| :--- | :--- | :--- |
|
|
74
|
+
| `exis_list_local_docs` | `{}` | Scans and lists all available ExisJS documentation topics installed locally in `node_modules`. |
|
|
75
|
+
| `exis_read_local_docs` | `{ topic: string }` | Reads the markdown content for a specific documentation topic. |
|
|
75
76
|
|
|
76
|
-
|
|
77
|
+
### 2. Code Generation & Scaffolding Tools
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
| Tool Name | Parameters | Description |
|
|
80
|
+
| :--- | :--- | :--- |
|
|
81
|
+
| `exis_generate_route` | `{ filePath: string, paradigm: "functional" \| "oop" }` | Scaffolds an idiomatic route controller file (`route.ts`). |
|
|
82
|
+
| `exis_generate_boundary` | `{ filePath: string, paradigm: "functional" \| "oop" }` | Scaffolds a directory boundary middleware file (`boundary.ts`). |
|
|
83
|
+
| `exis_generate_schema` | `{ filePath: string }` | Scaffolds a typed `tex` validation schema file (`schema.ts`). |
|
|
84
|
+
| `exis_generate_plugin` | `{ name: string, filePath?: string }` | Scaffolds an ExisJS plugin module definition. |
|
|
85
|
+
| `exis_generate_config` | `{}` | Scaffolds a baseline `exis.config.ts` configuration file. |
|
|
79
86
|
|
|
80
|
-
|
|
87
|
+
---
|
|
81
88
|
|
|
82
|
-
|
|
83
|
-
- **`exis_generate_plugin`**: Scaffolds a hybrid ExisJS plugin module.
|
|
84
|
-
- **`exis_generate_gateway`**: Scaffolds a WebSockets gateway.
|
|
85
|
-
- **`exis_generate_config`**: Scaffolds the strict `exis.config.ts` configuration system.
|
|
89
|
+
## Practical AI Workflows
|
|
86
90
|
|
|
87
|
-
|
|
91
|
+
### Example 1: Querying Framework APIs
|
|
88
92
|
|
|
89
|
-
|
|
93
|
+
> **User Prompt**: *"How does dependency injection work with circular references in ExisJS?"*
|
|
94
|
+
>
|
|
95
|
+
> **AI Execution**:
|
|
96
|
+
> 1. Invokes `exis_list_local_docs` to find relevant documentation keys.
|
|
97
|
+
> 2. Invokes `exis_read_local_docs({ topic: "providers" })` to inspect `forwardRef()` and `@Inject()`.
|
|
98
|
+
> 3. Generates the exact solution matching the installed version.
|
|
90
99
|
|
|
91
|
-
|
|
92
|
-
> *"I want to create a new WebSockets gateway in ExisJS. Can you read the docs on how Gateways work and then scaffold one for me?"*
|
|
100
|
+
### Example 2: Scaffolding a Protected Route
|
|
93
101
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
> **User Prompt**: *"Scaffold a functional route in src/http/admin/users/route.ts with a validation schema."*
|
|
103
|
+
>
|
|
104
|
+
> **AI Execution**:
|
|
105
|
+
> 1. Invokes `exis_generate_route({ filePath: "src/http/admin/users/route.ts", paradigm: "functional" })`.
|
|
106
|
+
> 2. Invokes `exis_generate_schema({ filePath: "src/http/admin/users/schema.ts" })`.
|
|
107
|
+
> 3. Customizes the handlers to fit the user's business requirements.
|
|
@@ -1,229 +1,315 @@
|
|
|
1
1
|
---
|
|
2
|
+
title: 'Installation & Setup'
|
|
3
|
+
description: 'System prerequisites, project scaffolding options with create-exisjs, manual setup, and TypeScript configuration.'
|
|
2
4
|
nextUrl: '/docs/structure'
|
|
3
5
|
nextTitle: 'Project Structure'
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# Installation & Setup
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
This guide provides step-by-step instructions for creating a new ExisJS application with the `create-exisjs` scaffolding tool or installing the framework manually into an existing TypeScript project.
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
We recommend **TypeScript** for type-safety and automatic frontend client generation. However, ExisJS fully supports vanilla JavaScript as well. ExisJS leverages esbuild under the hood, meaning you do not need to manually run `tsc` to start your server.
|
|
12
|
-
</Info>
|
|
12
|
+
---
|
|
13
13
|
|
|
14
14
|
## Prerequisites
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Before starting, ensure your system satisfies the following requirements:
|
|
17
|
+
|
|
18
|
+
- **Node.js**: `v20.0.0` or higher
|
|
19
|
+
- **Package Manager**: `npm` (v10+), `pnpm` (v9+), `yarn` (v1.22+ or berry), or `bun` (v1.0+)
|
|
20
|
+
- **Operating System**: macOS, Linux, or Windows (x64 and ARM64 architectures supported)
|
|
21
|
+
|
|
22
|
+
Verify your Node.js version by running:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
node -v
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
17
29
|
|
|
18
|
-
##
|
|
30
|
+
## Scaffolding a New Project
|
|
19
31
|
|
|
20
|
-
|
|
32
|
+
The quickest way to start a new ExisJS project is with the official `create-exisjs` scaffolding tool.
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
<CopyCommand command="npm create exisjs@latest my-backend" />
|
|
24
|
-
</div>
|
|
34
|
+
### Interactive Scaffolding
|
|
25
35
|
|
|
26
|
-
|
|
36
|
+
Run the creation command using your preferred package manager:
|
|
27
37
|
|
|
28
38
|
```bash
|
|
29
39
|
# npm
|
|
30
|
-
|
|
40
|
+
npm create exisjs@latest my-api
|
|
31
41
|
|
|
32
42
|
# pnpm
|
|
33
|
-
|
|
43
|
+
pnpm create exisjs my-api
|
|
34
44
|
|
|
35
45
|
# yarn
|
|
36
|
-
|
|
46
|
+
yarn create exisjs my-api
|
|
37
47
|
|
|
38
48
|
# bun
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# npx
|
|
42
|
-
$ npx create-exisjs@latest my-backend
|
|
49
|
+
bun create exisjs my-api
|
|
43
50
|
```
|
|
44
51
|
|
|
45
|
-
The CLI
|
|
52
|
+
The CLI prompts you with configuration options:
|
|
46
53
|
|
|
47
54
|
```text filename="Terminal"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<span className="text-muted-foreground w-36 shrink-0">route.ts</span>{' '}
|
|
83
|
-
<span>A basic GET endpoint mapped to the root route.</span>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
## Your First Server
|
|
88
|
-
|
|
89
|
-
Let's look at the generated `src/http/server.ts`. This is the strict entry point of your application, where you can connect to databases and register global plugins.
|
|
90
|
-
|
|
91
|
-
### Functional Server Setup
|
|
92
|
-
|
|
93
|
-
```typescript filename="src/http/server.ts"
|
|
94
|
-
import { exis } from 'exisjs'
|
|
95
|
-
|
|
96
|
-
export default exis({
|
|
97
|
-
async onStart(app) {
|
|
98
|
-
// 1. Connect to your database
|
|
99
|
-
// await db.connect()
|
|
100
|
-
// 2. Register plugins
|
|
101
|
-
// app.plugin(authPlugin)
|
|
102
|
-
// The Exis CLI automatically boots the server and file-system routes
|
|
103
|
-
},
|
|
55
|
+
? What is your project named? › my-api
|
|
56
|
+
? Would you like to use TypeScript? › Yes / No
|
|
57
|
+
? Would you like to use ESLint? › Yes / No
|
|
58
|
+
? Which routing paradigm do you prefer? › Functional (Default) / Class-Based (OOP)
|
|
59
|
+
? Would you like to customize the import alias (`@/*` by default)? › No / Yes
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### Non-Interactive Command-Line Flags
|
|
65
|
+
|
|
66
|
+
For automated environments, Docker initialization, or CI/CD pipelines, you can pass command-line flags to skip interactive prompts:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx create-exisjs@latest my-api --ts --functional --eslint --yes
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Complete CLI Flag Reference
|
|
73
|
+
|
|
74
|
+
| Flag | Description | Default |
|
|
75
|
+
| :--- | :--- | :---: |
|
|
76
|
+
| `--ts`, `--typescript` | Configure project with TypeScript | `true` |
|
|
77
|
+
| `--js`, `--javascript` | Configure project with plain JavaScript | `false` |
|
|
78
|
+
| `--functional` | Configure project using functional paradigm (`controller()`, `route.*`) | `true` |
|
|
79
|
+
| `--oop` | Configure project using class-based decorator paradigm (`@Controller()`, `@Get()`) | `false` |
|
|
80
|
+
| `--eslint` | Generate ESLint flat config with TypeScript rules | `true` |
|
|
81
|
+
| `--no-eslint` | Skip ESLint setup | `false` |
|
|
82
|
+
| `--skip-install` | Scaffold directory tree and templates without installing dependencies | `false` |
|
|
83
|
+
| `--skip-git` | Skip automatic `git init` initialization | `false` |
|
|
84
|
+
| `--yes`, `-y` | Accept default configuration non-interactively | `false` |
|
|
85
|
+
| `--use-pnpm` | Force dependency installation via `pnpm` | Auto-detected |
|
|
86
|
+
| `--use-bun` | Force dependency installation via `bun` | Auto-detected |
|
|
87
|
+
| `--use-yarn` | Force dependency installation via `yarn` | Auto-detected |
|
|
88
|
+
| `--use-npm` | Force dependency installation via `npm` | Auto-detected |
|
|
104
89
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Generated Project Layout
|
|
93
|
+
|
|
94
|
+
Once the scaffolding finishes, your project contains the standard ExisJS directory layout:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
my-api/
|
|
98
|
+
├── .agents/
|
|
99
|
+
│ └── rules/
|
|
100
|
+
│ └── AGENTS.md # Architecture rules and agent guidelines
|
|
101
|
+
├── src/
|
|
102
|
+
│ ├── common/
|
|
103
|
+
│ │ └── guards/
|
|
104
|
+
│ │ └── auth.guard.ts # Reusable route guards
|
|
105
|
+
│ ├── config/
|
|
106
|
+
│ │ └── env.ts # Type-safe environment validation (tex.env)
|
|
107
|
+
│ ├── cron/
|
|
108
|
+
│ │ └── cleanup.ts # Scheduled background tasks
|
|
109
|
+
│ ├── database/
|
|
110
|
+
│ │ └── db.ts # Database lifecycle and connection
|
|
111
|
+
│ └── http/
|
|
112
|
+
│ ├── health/
|
|
113
|
+
│ │ └── route.ts # Health check endpoint (/health)
|
|
114
|
+
│ ├── users/
|
|
115
|
+
│ │ ├── route.ts # User routes (/users)
|
|
116
|
+
│ │ ├── schema.ts # Input validation schemas (tex.*)
|
|
117
|
+
│ │ └── service.ts # Service layer logic
|
|
118
|
+
│ ├── boundary.ts # Root middleware, CORS & error boundary
|
|
119
|
+
│ ├── route.ts # Root route handler (/)
|
|
120
|
+
│ └── server.ts # Application lifecycle (onStart / onClose)
|
|
121
|
+
├── tests/
|
|
122
|
+
│ └── users.e2e-spec.ts # End-to-end test suite
|
|
123
|
+
├── .env # Environment variables
|
|
124
|
+
├── .gitignore
|
|
125
|
+
├── .prettierrc
|
|
126
|
+
├── eslint.config.mjs # ESLint configuration (when selected)
|
|
127
|
+
├── exis.config.ts # Framework configuration
|
|
128
|
+
├── package.json
|
|
129
|
+
└── tsconfig.json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Manual Installation
|
|
135
|
+
|
|
136
|
+
To install ExisJS into an existing repository without scaffolding:
|
|
137
|
+
|
|
138
|
+
### Step 1: Install Core Dependencies
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npm install exisjs
|
|
142
|
+
npm install -D typescript @types/node prettier
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Step 2: Configure `tsconfig.json`
|
|
146
|
+
|
|
147
|
+
Create or update `tsconfig.json` to configure module resolution and metadata reflection:
|
|
148
|
+
|
|
149
|
+
```json filename="tsconfig.json"
|
|
150
|
+
{
|
|
151
|
+
"compilerOptions": {
|
|
152
|
+
"target": "ES2022",
|
|
153
|
+
"lib": ["esnext"],
|
|
154
|
+
"allowJs": true,
|
|
155
|
+
"skipLibCheck": true,
|
|
156
|
+
"strict": true,
|
|
157
|
+
"esModuleInterop": true,
|
|
158
|
+
"experimentalDecorators": true,
|
|
159
|
+
"emitDecoratorMetadata": true,
|
|
160
|
+
"module": "esnext",
|
|
161
|
+
"moduleResolution": "bundler",
|
|
162
|
+
"resolveJsonModule": true,
|
|
163
|
+
"isolatedModules": true,
|
|
164
|
+
"noEmit": true,
|
|
165
|
+
"paths": {
|
|
166
|
+
"@/*": ["./src/*"]
|
|
167
|
+
},
|
|
168
|
+
"types": ["node"]
|
|
108
169
|
},
|
|
109
|
-
|
|
170
|
+
"include": [
|
|
171
|
+
"src/**/*.ts",
|
|
172
|
+
"tests/**/*.ts",
|
|
173
|
+
"*.config.ts",
|
|
174
|
+
"*.ts"
|
|
175
|
+
],
|
|
176
|
+
"exclude": ["node_modules", ".exis", "dist", "build"]
|
|
177
|
+
}
|
|
110
178
|
```
|
|
111
179
|
|
|
112
|
-
|
|
180
|
+
> [!NOTE]
|
|
181
|
+
> `experimentalDecorators` and `emitDecoratorMetadata` are required when using the class-based (OOP) paradigm (`@Controller()`, `@Injectable()`).
|
|
113
182
|
|
|
114
|
-
|
|
115
|
-
import { Server } from 'exisjs/decorators'
|
|
116
|
-
import type { App } from 'exisjs'
|
|
183
|
+
### Step 3: Create `exis.config.ts`
|
|
117
184
|
|
|
118
|
-
|
|
119
|
-
export default class RootServer {
|
|
120
|
-
async onStart(app: App) {
|
|
121
|
-
// 1. Connect to your database
|
|
122
|
-
// await db.connect()
|
|
123
|
-
// 2. Register plugins
|
|
124
|
-
// app.plugin(authPlugin)
|
|
125
|
-
// The Exis CLI automatically boots the server and file-system routes
|
|
126
|
-
}
|
|
185
|
+
Create an `exis.config.ts` file in the project root:
|
|
127
186
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
187
|
+
```typescript filename="exis.config.ts"
|
|
188
|
+
import type { ExisConfig } from 'exisjs/config'
|
|
189
|
+
|
|
190
|
+
const config: ExisConfig = {
|
|
191
|
+
port: Number(process.env.PORT) || 4000,
|
|
192
|
+
host: '0.0.0.0',
|
|
193
|
+
|
|
194
|
+
cors: {
|
|
195
|
+
origin: process.env.CORS_ORIGIN || '*',
|
|
196
|
+
credentials: true,
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
logger: {
|
|
200
|
+
level: 'debug',
|
|
201
|
+
pretty: process.env.NODE_ENV !== 'production',
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
helmet: { enabled: true },
|
|
205
|
+
compression: true,
|
|
132
206
|
}
|
|
207
|
+
|
|
208
|
+
export default config
|
|
133
209
|
```
|
|
134
210
|
|
|
135
|
-
|
|
211
|
+
### Step 4: Configure NPM Scripts
|
|
136
212
|
|
|
137
|
-
|
|
213
|
+
Add the standard ExisJS CLI commands to `package.json`:
|
|
138
214
|
|
|
139
|
-
|
|
215
|
+
```json filename="package.json"
|
|
216
|
+
{
|
|
217
|
+
"scripts": {
|
|
218
|
+
"dev": "exisjs dev",
|
|
219
|
+
"build": "exisjs build",
|
|
220
|
+
"start": "exisjs start",
|
|
221
|
+
"routes": "exisjs routes",
|
|
222
|
+
"test": "exisjs test",
|
|
223
|
+
"doctor": "exisjs doctor"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
140
229
|
|
|
141
|
-
|
|
230
|
+
## Verifying the Installation
|
|
142
231
|
|
|
143
|
-
###
|
|
232
|
+
### 1. Create a Health Check Endpoint
|
|
144
233
|
|
|
145
|
-
|
|
234
|
+
Create `src/http/health/route.ts`:
|
|
146
235
|
|
|
147
|
-
|
|
236
|
+
#### Option A: Functional Route
|
|
237
|
+
|
|
238
|
+
```typescript filename="src/http/health/route.ts"
|
|
148
239
|
import { controller, route } from 'exisjs/router'
|
|
149
240
|
|
|
150
241
|
export default controller({
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
{ id: 2, name: 'Bob' }
|
|
158
|
-
],
|
|
159
|
-
total: 2
|
|
160
|
-
}
|
|
161
|
-
},
|
|
242
|
+
check: route.get('/', {
|
|
243
|
+
summary: 'Service health check',
|
|
244
|
+
handle: () => ({
|
|
245
|
+
status: 'ok',
|
|
246
|
+
timestamp: new Date().toISOString(),
|
|
247
|
+
}),
|
|
162
248
|
}),
|
|
163
249
|
})
|
|
164
250
|
```
|
|
165
251
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
If you prefer a highly-structured architecture heavily inspired by Angular and NestJS, ExisJS natively provides robust class-based routing using Decorators:
|
|
252
|
+
#### Option B: Class-Based Route
|
|
169
253
|
|
|
170
|
-
```typescript filename="src/http/
|
|
171
|
-
import { Controller, Get,
|
|
172
|
-
import type { Request } from 'exisjs'
|
|
254
|
+
```typescript filename="src/http/health/route.ts"
|
|
255
|
+
import { Controller, Get, ApiOperation } from 'exisjs/decorators'
|
|
173
256
|
|
|
174
257
|
@Controller()
|
|
175
|
-
export default class
|
|
258
|
+
export default class HealthController {
|
|
176
259
|
@Get('/')
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
{ id: 2, name: 'Bob' }
|
|
183
|
-
],
|
|
184
|
-
total: 2
|
|
260
|
+
@ApiOperation({ summary: 'Service health check' })
|
|
261
|
+
check() {
|
|
262
|
+
return {
|
|
263
|
+
status: 'ok',
|
|
264
|
+
timestamp: new Date().toISOString(),
|
|
185
265
|
}
|
|
186
266
|
}
|
|
187
267
|
}
|
|
188
268
|
```
|
|
189
269
|
|
|
190
|
-
|
|
270
|
+
### 2. Start the Development Server
|
|
191
271
|
|
|
192
|
-
|
|
272
|
+
Execute the `dev` script:
|
|
193
273
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
<CopyCommand command="npm run dev" />
|
|
198
|
-
</div>
|
|
274
|
+
```bash
|
|
275
|
+
npm run dev
|
|
276
|
+
```
|
|
199
277
|
|
|
200
|
-
|
|
278
|
+
Output:
|
|
201
279
|
|
|
202
280
|
```text filename="Terminal"
|
|
203
|
-
|
|
281
|
+
[exis] starting development server (v0.7.12)...
|
|
282
|
+
EXIS ready in 125 ms
|
|
283
|
+
|
|
284
|
+
→ Local: http://localhost:4000/
|
|
285
|
+
→ Docs: http://localhost:4000/docs
|
|
286
|
+
→ Network: http://127.0.0.1:4000/
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### 3. Verify the Endpoint
|
|
204
290
|
|
|
205
|
-
|
|
291
|
+
Send an HTTP GET request to verify the route:
|
|
206
292
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
→ Environ: development
|
|
210
|
-
→ press h + enter to show help
|
|
293
|
+
```bash
|
|
294
|
+
curl http://localhost:4000/health
|
|
211
295
|
```
|
|
212
296
|
|
|
213
|
-
|
|
297
|
+
Expected JSON response:
|
|
214
298
|
|
|
215
|
-
```json
|
|
299
|
+
```json
|
|
216
300
|
{
|
|
217
|
-
"
|
|
218
|
-
|
|
219
|
-
"id": 1,
|
|
220
|
-
"name": "Alice"
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
"id": 2,
|
|
224
|
-
"name": "Bob"
|
|
225
|
-
}
|
|
226
|
-
],
|
|
227
|
-
"total": 2
|
|
301
|
+
"status": "ok",
|
|
302
|
+
"timestamp": "2026-10-02T11:35:00.000Z"
|
|
228
303
|
}
|
|
229
304
|
```
|
|
305
|
+
|
|
306
|
+
Open `http://localhost:4000/docs` in your browser to inspect the interactive Swagger UI.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Next Steps
|
|
311
|
+
|
|
312
|
+
- **[Project Structure](/docs/structure)**: Review directory conventions for routes, boundaries, services, and database models.
|
|
313
|
+
- **[Routing & Endpoints](/docs/routing)**: Learn how folders map to HTTP verbs, path params, and catch-all routes.
|
|
314
|
+
- **[Validation](/docs/validation)**: Build typed schemas with `tex` for body, query, and header validation.
|
|
315
|
+
- **[Configuration Reference](/docs/config)**: Complete reference of all options in `exis.config.ts`.
|