@webjsdev/server
v0.8.29
Published
webjs dev/prod server: SSR, router, API, server actions, live reload
Maintainers
Readme
@webjsdev/server
Dev + production server for webjs: file-based routing, streaming SSR, server actions, WebSocket upgrades, and live reload.
Rarely installed directly. Use @webjsdev/cli
to scaffold and run an app, which pulls this package in as a dependency.
Features
- File-based routing at parity with NextJs App Router:
page.ts,layout.ts,route.ts,error.ts,loading.ts,not-found.ts,middleware.ts,[param],[...slug],(groups),_private. - Streaming SSR with Suspense boundaries.
- Server actions: import a
.server.tsfunction from a client component and it auto-rewrites into a type-safe RPC stub. webjs's built-in serializer on the wire keeps Date/Map/Set/BigInt/TypedArray/Blob/File/FormData/cycles all surviving. - WebSockets: export
WSfromroute.tsand it becomes a WebSocket endpoint on the same path. - Live reload for dev.
- Bare-specifier resolution for npm packages via import maps,
resolved through jspm.io at runtime (Rails 7 + importmap-rails
posture). Browser fetches bundles directly from
ga.jspm.ioCDN; webjs's server does not bundle vendor packages. Runwebjs vendor pinto commit resolved URLs to.webjs/vendor/importmap.json(deterministic deploys), or--downloadto additionally vendor bundle bytes for offline-capable production.
Install
npm install @webjsdev/server @webjsdev/coreUse
Normally invoked via the CLI:
webjs dev
webjs startOr programmatically:
import { startServer } from '@webjsdev/server';
await startServer({ port: 8080, appDir: process.cwd(), dev: true });See the full framework docs at https://github.com/webjsdev/webjs.
License
MIT
