Repository instructions for coding agents working in the evjs monorepo.
- Read CONTRIBUTING.md for package ownership, contributor workflow, and focused validation.
- Read ARCHITECTURE.md before changing graph, build, runtime, bundler, or deployment ownership.
- Use docs/docs/ for public framework behavior.
The Page-and-Route authoring source of truth is the convention matrix in docs/docs/project-structure.md. Update its English and Chinese versions together whenever pages, API routes, server functions, examples, or scaffolds change.
Before editing, inspect the affected package, its tests, and the implementation source listed below. When prose and tested behavior disagree, fix the prose or the implementation rather than preserving the mismatch.
| Concern | Implementation source | Primary coverage |
|---|---|---|
| Page files and URL segments | packages/ev/src/_internal/build/conventions/page-route-conventions.ts |
discovery/page-routes.ts, packages/ev/tests/build-tools-page-routes.test.ts |
| API route files and URL segments | packages/ev/src/_internal/build/conventions/server-route-conventions.ts |
discovery/server-routes.ts, packages/ev/tests/build-tools-server-routes.test.ts |
| Global middleware discovery | packages/ev/src/_internal/build/discovery/server-conventions.ts |
packages/ev/tests/build-tools-server-routes.test.ts, packages/ev/tests/commands.test.ts |
| HTTP method middleware composition | packages/server/src/routes/api-handler.ts |
packages/server/tests/api-handler.test.ts, packages/ev/tests/server-middleware-runtime.test.ts |
| Public configuration and routing mode | packages/ev/src/config/resolution.ts through packages/ev/src/config/index.ts |
packages/ev/tests/config.test.ts |
| Graph and build planning | packages/ev/src/_internal/build/graph/*, plan/* |
packages/ev/tests/build-tools-graph-plan.test.ts |
| Plugin settings and generated Page types | packages/ev/src/config/plugins.ts, _internal/build/plugins/settings.ts, typegen/plugin-types.ts |
packages/ev/tests/plugin-settings.test.ts, plugin-types.test.ts |
| Shared output contracts | packages/shared/src/manifest |
packages/shared/tests/manifest.test.ts |
- Use
@evjs/evfor simple configuration, its public authoring subpaths for application code,@evjs/ev/pluginfor plugin authoring, and@evjs/ev/deploymentfor deployment helpers. Reserve@evjs/ev/_internal/*for the CLI, adapters, and generated framework code. - Publish Pages only with
src/pages/**/page.*, and keep exactly one supportedpage.*file in each Page directory. The directory determines the URL; other colocated files remain ordinary source.application.routesis an advanced SPA-only alternative toroutingand usesroutesfor nesting. - Publish API routes only with
src/apis/**/api.*orsrc/apis/**/http.*, and keep exactly one supported anchor file in each route directory.api.*exports uppercase HTTP methods;http.*exports namedhttp.get/post/...bindings (or existing{ method, path?, handler }domain operations) with a directory URL prefix. Put global middleware insrc/middlewares/middleware.*, default-exporting one handler or an ordered non-empty array. Compose HTTP method policies withwithMiddlewares(handler, middlewares)from@evjs/ev/api; share chains through ordinary imports.RouteHandlerFnalso lives in@evjs/ev/api. Import middleware types and request logging from@evjs/ev/middleware, and request context helpers from@evjs/ev/server-context. - Server-function modules begin with
"use server";and export supported named values. Adjacentpage.config.tsowns static metadata, rendering choices, and page-level plugin options. - Install plugins through
config.plugins. Keep application and page options independent, and derive route or document behavior from the page tree. - Keep framework semantics in
packages/ev/src/_internal/buildand shared contracts inpackages/shared/src/manifest. Bundler adapters consume the build plan; they do not rediscover routes or rendering behavior. Utoopack is the default adapter and Webpack is the validation or fallback adapter. - Treat
.ev,src/route-types.d.ts,src/plugin-types.d.ts,dist,.turbo, andnode_modulesas generated output. Do not edit them or copy them into scaffolds. - Keep English and Chinese documentation behaviorally equivalent. User docs
should explain framework design and user workflows, not implementation call
flow. Describe current behavior; keep release history in
CHANGELOG.mdand active gaps inROADMAP.md. - Keep package roots, public subpath entries, and executable entry files as façades. Place implementation in capability-owned directories and use leaf imports within a domain so barrels do not hide ownership or create cycles.
Use the focused commands in CONTRIBUTING.md while editing. Before submitting a repository change, run:
npm run check-types
npm run lint
npm test
git diff --checkFor documentation-only changes, run npm run lint, build the documentation,
and run git diff --check. Add focused tests when prose defines a runtime
contract or a diagnostic URL.