TypeScript web framework optimized for delivery π
- First class universal routing (SSR & SPA π§ββοΈ)
- Client side ES modules (π« webpack, β MJS)
- TypeScript sources and breakpoints in browser π§
- Built-in server environments (Node.js HTTP, AWS Lambda βοΈ)
- JSX π
- Structured request pipeline (initializers, middleware, controllers, views, etc ποΈ)
- Simple DOM operations (π« virtual dom, β
createElement
) - Simple remote function calls π°οΈ
- Code generators π
- Very few production NPM dependencies ππ¦
git clone git@github.com:respond-dev/respond.git [project-name]
cd [project-name]
npm install
npm run dev
βΉοΈ If you install AutoLaunch for VS Code, the
dev
tasks starts automatically.
npm run generate
Press <enter>
at each prompt to accept the defaults. You'll notice some updated files:
Location | Filename | Purpose |
---|---|---|
π controllers | homeController.ts |
Return elements or JSON from models and views |
π models | homeModel.ts |
Data store |
π routers | router.ts |
Return elements or JSON from controllers |
π styles | homeStyle.scss |
Sass style sheet |
π views | homeView.ts |
Return elements from JSX |
Visit http://localhost:3000 to view your new page.
There are five successive phases of the universal request pipeline. Each pipeline phase corresponds to directories of source files:
Request phase | Purpose |
---|---|
β π constructors | Builds input for initializers |
β‘ π initializers | Builds input for middleware |
β’ π middleware | Builds input for routers |
β£ π routers | Returns an element or string (JSON) |
β€ π settlers | Settles the final output |
βΉοΈ The input and output types for each phase are centrally located in π types/respond.
Server side requests begin with a Node HTTP, Lambda API Gateway, or Cloudflare Worker handler event. The server side request pipeline is pretty simple; all five pipeline phases are executed on every request. Request pipeline filenames that begin with client
are ignored on the server side.
Client side requests begin with an initial page load, a link click, or a window.history.pushState
call. The constructors
phase executes only on initial page load. The initializers
phase executes on initial page load or route change. The rest of the phases (middleware
, routers
, settlers
) execute for all requests, and receive cached input if the request is not from a page load or route change (also known as a refresh or redraw). Request pipeline filenames that begin with server
are ignored on the client side.
Request pipeline filenames that do not begin with client
or server
are considered universal.
Request phase | Server execution | Client execution |
---|---|---|
β π constructors | Every request | On page load (once) |
β‘ π initializers | Every request | On page load or route change |
β’ π middleware | Every request | Every request |
β£ π routers | Every request | Every request |
β€ π settlers | Every request | Every request |