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.
Files changed (150) hide show
  1. package/README.md +195 -39
  2. package/dist/cli/commands/dev.d.ts +4 -0
  3. package/dist/cli/commands/dev.d.ts.map +1 -1
  4. package/dist/cli/commands/dev.js +136 -32
  5. package/dist/cli/commands/dev.js.map +1 -1
  6. package/dist/cli/commands/run.d.ts +7 -0
  7. package/dist/cli/commands/run.d.ts.map +1 -0
  8. package/dist/cli/commands/run.js +99 -0
  9. package/dist/cli/commands/run.js.map +1 -0
  10. package/dist/cli/index.js +29 -13
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/cli/manifest.d.ts.map +1 -1
  13. package/dist/cli/manifest.js +18 -3
  14. package/dist/cli/manifest.js.map +1 -1
  15. package/dist/cli/routes.d.ts +6 -0
  16. package/dist/cli/routes.d.ts.map +1 -1
  17. package/dist/cli/routes.js +224 -135
  18. package/dist/cli/routes.js.map +1 -1
  19. package/dist/config/config.d.ts +2 -1
  20. package/dist/config/config.d.ts.map +1 -1
  21. package/dist/config/config.js.map +1 -1
  22. package/dist/config/types.d.ts +30 -9
  23. package/dist/config/types.d.ts.map +1 -1
  24. package/dist/database/lifecycle.d.ts +6 -1
  25. package/dist/database/lifecycle.d.ts.map +1 -1
  26. package/dist/database/lifecycle.js +15 -4
  27. package/dist/database/lifecycle.js.map +1 -1
  28. package/dist/decorators/params.d.ts +21 -0
  29. package/dist/decorators/params.d.ts.map +1 -1
  30. package/dist/decorators/params.js +21 -1
  31. package/dist/decorators/params.js.map +1 -1
  32. package/dist/di/container.d.ts +15 -6
  33. package/dist/di/container.d.ts.map +1 -1
  34. package/dist/di/container.js +26 -3
  35. package/dist/di/container.js.map +1 -1
  36. package/dist/di/index.d.ts +1 -1
  37. package/dist/di/index.d.ts.map +1 -1
  38. package/dist/di/index.js.map +1 -1
  39. package/dist/di/inject.d.ts +2 -1
  40. package/dist/di/inject.d.ts.map +1 -1
  41. package/dist/di/inject.js +2 -1
  42. package/dist/di/inject.js.map +1 -1
  43. package/dist/docs/BENCHMARKS.md +4 -4
  44. package/dist/docs/content/README.md +43 -44
  45. package/dist/docs/content/boundaries.mdx +141 -48
  46. package/dist/docs/content/cli/commands.mdx +161 -107
  47. package/dist/docs/content/cli/overview.mdx +61 -46
  48. package/dist/docs/content/cli/usage.mdx +107 -30
  49. package/dist/docs/content/config.mdx +145 -147
  50. package/dist/docs/content/controllers.mdx +193 -464
  51. package/dist/docs/content/cron.mdx +183 -69
  52. package/dist/docs/content/decorators.mdx +449 -154
  53. package/dist/docs/content/errors.mdx +202 -305
  54. package/dist/docs/content/exisjs-mcp.mdx +59 -49
  55. package/dist/docs/content/installation.mdx +243 -157
  56. package/dist/docs/content/introduction.mdx +220 -48
  57. package/dist/docs/content/middleware.mdx +171 -497
  58. package/dist/docs/content/modules.mdx +141 -83
  59. package/dist/docs/content/providers.mdx +216 -180
  60. package/dist/docs/content/requests.mdx +168 -488
  61. package/dist/docs/content/responses.mdx +200 -533
  62. package/dist/docs/content/routing.mdx +239 -558
  63. package/dist/docs/content/security.mdx +233 -57
  64. package/dist/docs/content/structure.mdx +151 -240
  65. package/dist/docs/content/swagger.mdx +192 -91
  66. package/dist/docs/content/testing.mdx +205 -74
  67. package/dist/docs/content/validation.mdx +479 -341
  68. package/dist/docs/reference/README.md +34 -2
  69. package/dist/docs/reference/config.mdx +277 -73
  70. package/dist/docs/reference/context.mdx +197 -106
  71. package/dist/docs/reference/cron.mdx +266 -152
  72. package/dist/docs/reference/database.mdx +135 -53
  73. package/dist/docs/reference/decorators.mdx +234 -116
  74. package/dist/docs/reference/di.mdx +146 -112
  75. package/dist/docs/reference/error.mdx +155 -178
  76. package/dist/docs/reference/exis.mdx +141 -70
  77. package/dist/docs/reference/logger.mdx +110 -126
  78. package/dist/docs/reference/middleware.mdx +235 -158
  79. package/dist/docs/reference/plugin.mdx +136 -64
  80. package/dist/docs/reference/router.mdx +277 -251
  81. package/dist/docs/reference/sanitize.mdx +91 -87
  82. package/dist/docs/reference/swagger.mdx +280 -100
  83. package/dist/docs/reference/testing.mdx +223 -89
  84. package/dist/docs/reference/validator.mdx +194 -206
  85. package/dist/lib/inspect-routes.d.ts +2 -0
  86. package/dist/lib/inspect-routes.d.ts.map +1 -0
  87. package/dist/lib/inspect-routes.js +148 -0
  88. package/dist/lib/inspect-routes.js.map +1 -0
  89. package/dist/lib/start-server.js +13 -8
  90. package/dist/lib/start-server.js.map +1 -1
  91. package/dist/module/module.d.ts +6 -3
  92. package/dist/module/module.d.ts.map +1 -1
  93. package/dist/module/module.js +17 -3
  94. package/dist/module/module.js.map +1 -1
  95. package/dist/router/controller-registrar.d.ts.map +1 -1
  96. package/dist/router/controller-registrar.js +26 -4
  97. package/dist/router/controller-registrar.js.map +1 -1
  98. package/dist/router/scanner/cron-mounter.d.ts.map +1 -1
  99. package/dist/router/scanner/cron-mounter.js +9 -2
  100. package/dist/router/scanner/cron-mounter.js.map +1 -1
  101. package/dist/server/app.d.ts +3 -1
  102. package/dist/server/app.d.ts.map +1 -1
  103. package/dist/server/app.js +29 -8
  104. package/dist/server/app.js.map +1 -1
  105. package/dist/server/define.d.ts.map +1 -1
  106. package/dist/server/define.js +5 -0
  107. package/dist/server/define.js.map +1 -1
  108. package/dist/server/request.d.ts +2 -0
  109. package/dist/server/request.d.ts.map +1 -1
  110. package/dist/server/request.js +11 -0
  111. package/dist/server/request.js.map +1 -1
  112. package/dist/swagger/generator.d.ts.map +1 -1
  113. package/dist/swagger/generator.js +130 -10
  114. package/dist/swagger/generator.js.map +1 -1
  115. package/dist/telemetry/index.d.ts +12 -0
  116. package/dist/telemetry/index.d.ts.map +1 -0
  117. package/dist/telemetry/index.js +121 -0
  118. package/dist/telemetry/index.js.map +1 -0
  119. package/dist/testing/client.d.ts +1 -0
  120. package/dist/testing/client.d.ts.map +1 -1
  121. package/dist/testing/client.js +4 -1
  122. package/dist/testing/client.js.map +1 -1
  123. package/dist/testing/index.d.ts.map +1 -1
  124. package/dist/testing/index.js +20 -4
  125. package/dist/testing/index.js.map +1 -1
  126. package/dist/validator/builder.d.ts +26 -1
  127. package/dist/validator/builder.d.ts.map +1 -1
  128. package/dist/validator/builder.js +31 -0
  129. package/dist/validator/builder.js.map +1 -1
  130. package/dist/validator/engine.d.ts +23 -0
  131. package/dist/validator/engine.d.ts.map +1 -1
  132. package/dist/validator/engine.js +228 -31
  133. package/dist/validator/engine.js.map +1 -1
  134. package/dist/validator/index.d.ts +8 -4
  135. package/dist/validator/index.d.ts.map +1 -1
  136. package/dist/validator/index.js +4 -1
  137. package/dist/validator/index.js.map +1 -1
  138. package/dist/validator/tex-types.d.ts +15 -0
  139. package/dist/validator/tex-types.d.ts.map +1 -1
  140. package/dist/validator/tex-types.js +102 -0
  141. package/dist/validator/tex-types.js.map +1 -1
  142. package/dist/validator/tex.d.ts +1 -1
  143. package/dist/validator/tex.d.ts.map +1 -1
  144. package/dist/validator/tex.js +3 -1
  145. package/dist/validator/tex.js.map +1 -1
  146. package/dist/validator/types.d.ts +1 -0
  147. package/dist/validator/types.d.ts.map +1 -1
  148. package/package.json +47 -14
  149. package/dist/docs/content/dataloader.mdx +0 -170
  150. package/dist/docs/reference/dataloader.mdx +0 -91
@@ -1,36 +1,38 @@
1
1
  ---
2
- title: 'AI Assistants (MCP)'
3
- description: 'Connect AI agents like Claude and Cursor directly to your ExisJS projects.'
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)** is an open standard that allows AI coding assistants (like Claude, Cursor, and Google Antigravity) to access external tools and data sources.
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
- ExisJS provides an official MCP Server (`@exisjs/mcp`) that acts as a bridge between your AI agent and your local ExisJS workspace. It empowers the AI with the ability to dynamically read your framework documentation offline and flawlessly scaffold idiomatic ExisJS boilerplate code (routes, plugins, gateways, configurations).
12
+ ---
13
+
14
+ ## Overview
11
15
 
12
- <Info title="Why use the MCP?">
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
- ## Prerequisites
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
- - **Node.js (version >= 20.19)** installed on your machine.
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
- The easiest way to install the MCP server across all your coding agents is by using the `add-mcp` CLI:
25
+ ### Automatic Installation (`add-mcp`)
24
26
 
25
- <div className="my-6 max-w-lg">
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
- Add `-y` to skip the prompt and install to all detected agents. Add `-g` to install globally across all projects.
29
+ ```bash
30
+ npx add-mcp @exisjs/mcp@latest -y
31
+ ```
30
32
 
31
33
  ### Manual Configuration
32
34
 
33
- If you prefer to configure your AI client manually (or are using an unsupported client), you can add the following JSON to your client's MCP settings file:
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
- <details>
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
- <details>
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. Type: `exisjs-mcp`
62
- 5. Command: `npx -y @exisjs/mcp@latest`
63
- </details>
61
+ 4. Set **Name** to `exisjs-mcp`.
62
+ 5. Set **Command** to `npx -y @exisjs/mcp@latest`.
64
63
 
65
- ## Available Tools
64
+ ---
66
65
 
67
- Once the MCP server is installed and running, your AI assistant automatically gains access to the following capabilities:
66
+ ## Available MCP Tools
68
67
 
69
- ### 1. Documentation Readers
68
+ Once initialized, the assistant gains access to the following toolset:
70
69
 
71
- ExisJS ships its official markdown documentation directly inside the npm package. The MCP server reads these files locally from your `node_modules`.
70
+ ### 1. Documentation Tools
72
71
 
73
- - **`exis_list_local_docs`**: Recursively scans and lists all available ExisJS documentation topics.
74
- - **`exis_read_local_docs`**: Reads the exact markdown file requested by the AI so it can learn ExisJS best practices.
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
- *Because this runs locally, the AI reads the exact documentation that matches the ExisJS version installed in your project, preventing version mismatches!*
77
+ ### 2. Code Generation & Scaffolding Tools
77
78
 
78
- ### 2. Code Generators
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
- When you ask the AI to build a new feature, it will use these strict scaffolding tools to generate the correct file structures instead of guessing the syntax.
87
+ ---
81
88
 
82
- - **`exis_generate_route`**: Scaffolds an idiomatic ExisJS route controller (Functional or OOP).
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
- ## Usage Example
91
+ ### Example 1: Querying Framework APIs
88
92
 
89
- Once configured, simply open your ExisJS project in your AI IDE and ask it a question!
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
- Try asking:
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
- The AI will:
95
- 1. Use `exis_list_local_docs` to find the documentation on Gateways.
96
- 2. Use `exis_read_local_docs` to learn the exact syntax for your ExisJS version.
97
- 3. Use `exis_generate_gateway` to safely write the boilerplate into your codebase.
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
- # Getting Started
8
+ # Installation & Setup
7
9
 
8
- In this guide, you'll learn the core fundamentals of ExisJS. To get familiar with the essential building blocks, we'll scaffold a new project, explore the file structure, and create our very first API server.
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
- <Info title="Language Support">
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
- Please make sure that **Node.js (version >= 20)** is installed on your operating system.
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
- ## Setup
30
+ ## Scaffolding a New Project
19
31
 
20
- Setting up a new project can be done using our CLI tool. Open your terminal and run the following command to scaffold a new ExisJS project:
32
+ The quickest way to start a new ExisJS project is with the official `create-exisjs` scaffolding tool.
21
33
 
22
- <div className="my-6 max-w-lg">
23
- <CopyCommand command="npm create exisjs@latest my-backend" />
24
- </div>
34
+ ### Interactive Scaffolding
25
35
 
26
- You can also use your package manager of choice:
36
+ Run the creation command using your preferred package manager:
27
37
 
28
38
  ```bash
29
39
  # npm
30
- $ npm create exisjs@latest my-backend
40
+ npm create exisjs@latest my-api
31
41
 
32
42
  # pnpm
33
- $ pnpm create exisjs my-backend
43
+ pnpm create exisjs my-api
34
44
 
35
45
  # yarn
36
- $ yarn create exisjs my-backend
46
+ yarn create exisjs my-api
37
47
 
38
48
  # bun
39
- $ bun create exisjs my-backend
40
-
41
- # npx
42
- $ npx create-exisjs@latest my-backend
49
+ bun create exisjs my-api
43
50
  ```
44
51
 
45
- The CLI will prompt you with a few simple questions to customize your project:
52
+ The CLI prompts you with configuration options:
46
53
 
47
54
  ```text filename="Terminal"
48
- √ Would you like to use TypeScript? ... No / Yes
49
- √ Would you like to use ESLint? ... No / Yes
50
- √ Would you like your code inside a `src/` directory? ... No / Yes
51
- √ Would you like to customize the import alias (`@/*` by default)? ... No / Yes
52
-
53
- Creating a new Exis JS app in my-backend.
54
- ```
55
-
56
- The CLI will then create the `my-backend` directory, install all required dependencies, and populate the project with a conventional base structure.
57
-
58
- ## Core Files
59
-
60
- Once the installation is complete, your project directory will look something like this:
61
-
62
- <div className="bg-muted/30 border border-border/50 rounded-md p-4 mb-6 font-mono text-sm">
63
- <div className="flex gap-4 mb-2">
64
- <span className="text-muted-foreground w-40 shrink-0">exis.config.ts</span>{' '}
65
- <span>
66
- The root configuration for your application (CORS, Logger, Port).
67
- </span>
68
- </div>
69
- <div className="flex gap-4 mb-2">
70
- <span className="text-muted-foreground w-40 shrink-0">src/env.ts</span>{' '}
71
- <span>Environment variable validation and typing.</span>
72
- </div>
73
- <div className="flex gap-4 mb-2">
74
- <span className="text-muted-foreground w-40 shrink-0">src/http/</span>{' '}
75
- <span>The file-system routing directory.</span>
76
- </div>
77
- <div className="flex gap-4 mb-2 pl-4">
78
- <span className="text-muted-foreground w-36 shrink-0">server.ts</span>{' '}
79
- <span>The strict entry point of your application.</span>
80
- </div>
81
- <div className="flex gap-4 pl-4">
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
- async onClose(app) {
106
- // Gracefully close database connections here
107
- // await db.disconnect()
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
- ### Class-Based (OOP) Server Setup
180
+ > [!NOTE]
181
+ > `experimentalDecorators` and `emitDecoratorMetadata` are required when using the class-based (OOP) paradigm (`@Controller()`, `@Injectable()`).
113
182
 
114
- ```typescript filename="src/http/server.ts"
115
- import { Server } from 'exisjs/decorators'
116
- import type { App } from 'exisjs'
183
+ ### Step 3: Create `exis.config.ts`
117
184
 
118
- @Server()
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
- async onClose(app: App) {
129
- // Gracefully close database connections here
130
- // await db.disconnect()
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
- With ExisJS, the framework automatically handles booting up your server and loading your routes based on the file system. You don't need to manually call `app.listen()`!
211
+ ### Step 4: Configure NPM Scripts
136
212
 
137
- ## Your First Route
213
+ Add the standard ExisJS CLI commands to `package.json`:
138
214
 
139
- ExisJS uses **folder-based routing**. Your API structure maps directly to your folders in `src/http/`.
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
- ExisJS supports two primary styles of writing routes: **Functional** and **OOP (Class-based)**. You are free to use whichever paradigm fits your team best.
230
+ ## Verifying the Installation
142
231
 
143
- ### Functional Routing
232
+ ### 1. Create a Health Check Endpoint
144
233
 
145
- Functional routing provides a lean, inference-heavy developer experience similar to modern frontend frameworks. Let's declare our first route in `src/http/users/route.ts`:
234
+ Create `src/http/health/route.ts`:
146
235
 
147
- ```typescript filename="src/http/users/route.ts"
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
- getUsers: route.get('/', {
152
- handle(req) {
153
- // Return a realistic response structure
154
- return {
155
- data: [
156
- { id: 1, name: 'Alice' },
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
- ### OOP Routing
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/users/route.ts"
171
- import { Controller, Get, Req } from 'exisjs/decorators'
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 UsersController {
258
+ export default class HealthController {
176
259
  @Get('/')
177
- getUsers(@Req() req: Request) {
178
- // Return a realistic response structure
179
- return {
180
- data: [
181
- { id: 1, name: 'Alice' },
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
- In both examples, because this file is named `route.ts` and is located in the `users` folder, it automatically responds to `GET /users` requests. Whatever you return is automatically serialized to JSON.
270
+ ### 2. Start the Development Server
191
271
 
192
- ## Running the Application
272
+ Execute the `dev` script:
193
273
 
194
- Your generated `package.json` comes pre-configured with the Exis CLI commands. Start the development server with hot-reload by running:
195
-
196
- <div className="my-6 max-w-lg">
197
- <CopyCommand command="npm run dev" />
198
- </div>
274
+ ```bash
275
+ npm run dev
276
+ ```
199
277
 
200
- You will see the server boot up in your terminal:
278
+ Output:
201
279
 
202
280
  ```text filename="Terminal"
203
- 6:18:28 pm [exis] starting development server (v0.1.0)...
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
- EXIS v0.1.0 ready in 125 ms
291
+ Send an HTTP GET request to verify the route:
206
292
 
207
- → Local: http://localhost:4000/
208
- → Network: http://10.39.14.177:4000/
209
- → Environ: development
210
- → press h + enter to show help
293
+ ```bash
294
+ curl http://localhost:4000/health
211
295
  ```
212
296
 
213
- Open your browser and navigate to [http://localhost:4000/](http://localhost:4000/) (or the port defined in your `.env`). You will see:
297
+ Expected JSON response:
214
298
 
215
- ```json filename="Response"
299
+ ```json
216
300
  {
217
- "data": [
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`.