Hello World
Executable 2.x Reference
The release contract for this page is the checked-in
examples/hello-world
project. It is a deliberately small JavaScript application with checkJs
typechecking, the Native adapter, explicit rateLimit.enabled: false, Vext
Docs, and exactly two routes: GET / and GET /health.
After startup, verify /, /health, /openapi.json, and /docs. The example
uses "vextjs": "file:../.." only inside this repository; generated and normal
consumer projects install the published vextjs package.
The source directory is authoritative: its file-tree contract, scripts, typecheck/build, HTTP endpoints, OpenAPI output, and Docs branding are validated before release.
Extended TypeScript Tutorial
The walkthrough below is a separate teaching variant. It demonstrates extra
validation and response APIs, but it is not the executable release fixture and
must not be used to infer that those extra routes exist in
examples/hello-world.
Complete project structure
1. Initialize project
Use the vext create scaffolding to quickly create:
Or create manually:
2. Configuration file
package.json
tsconfig.json
3. Configuration
adapter: 'native' uses the built-in Native adapter (http.createServer + route-core) and has no third-party HTTP framework dependency. You can switch to 'hono', 'fastify', 'express', or 'koa' without rewriting route business logic. Review the current benchmarks and test your workload before choosing.
4. Routing
5. Entry file
6. Run
Development mode
Development mode features:
-
Automatic hot reloading of file modifications (three-layer strategy: routing/service/configuration smart refresh)
-
Beautify log output (built-in pretty format)
-
Automatically enable OpenAPI documentation (visit
http://localhost:3000/docs)
Production mode
7. Verification
After startup, you can use curl or browser verification:
8. Response format description
VextJS enables export wrapping by default (config.response.wrap: true), and all res.json() responses will be automatically wrapped into a unified format:
Successful response:
Error response:
If packaging is not required (e.g. inter-microservice communication), it can be disabled in the configuration:
Key concepts review
Next step
- 📖 Read Quick Start to learn more about the complete project construction process
- 📖 Read CRUD API Examples to learn about database integration
- 📖 Read Project Structure to understand the convention directory specification
- 📖 Read Routing to learn more about the three-stage routing definition