- 0.1.0Latest
- 0.1.1
- 0.1.2
- 0.1.3
- 0.2.0
- 0.2.1
- 0.2.2
- 0.3.0
- 0.4.0
- 0.4.1
- 0.4.2
- 0.4.3
- 0.5.0
- 0.5.1
- 0.5.2
- 0.5.3
- 0.5.4
- 0.6.0
- 0.6.1
- 1.0.0
- 1.1.0
- 1.2.0
- 1.2.1
- 1.2.2
- 1.2.3
- 1.2.4
- 1.2.5
- 1.3.0
- 1.3.1
- 1.3.2
- 2.2.0
- 2.1.0
- 2.0.0
- 2.0.0-beta
- 1.9.0
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8.0
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.0
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.1
- 1.4.0
- 1.3.5
- 1.3.4
- 1.3.3
- v.1.3.2
- v1.3.1
- v1.3.0
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
- v0.6.1
- v0.6.0
- v0.5.4
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.0
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
Peko
🐔🦕 The Featherweight Deno Library for Modern JS Apps. 🌏
Serve around the world effortlessly with Deno Deploy!
Summary
- First-class frontend - server-side render then rapidly hydrate with preloaded JS modules (~10kb Preact example).
- Production-ready backend - reliablility and performance with Typescript and configurable page caching.
- Software minimalism - no build-step, just a sleek runtime using only the Deno std library.
- Ease of adoption - intuitive functions & zero fixed project structure.
Read on, star/fork/clone away and feel free to contribute any ideas!
Getting started
- Install Deno
-
$ git clone https://github.com/sebringrose/peko.git
-
$ cd peko
-
$ deno run --allow-net --allow-env --allow-read --watch examples/preact/app.js
-
Edit
./examples/preact/src
for frontend changes and play with./examples/preact/app.js
for app server logic.
Import Peko into your own project:
import * as peko from "https://deno.land/x/peko/mod.ts"
Note: Lit-html VS Code plugin recommended if using HTM & Preact.
Deployment
Docker & Deno Deploy deployment guides coming soon!
This project aims to be ready for production soon but it is not complete with extensive testing yet! Use at your own risk.
How does it work?
Deno http server receives page requests and renders your frontend source modules to HTML. The Preact example codebase uses Preact UI components and preact-render-to-string for Server-Side Rendering (SSR). The HTML is injected into an HTML template along with any custom defined tags and request metadata before being served to the user’s browser client.
If env.ENVIRONMENT === "production"
page renders are also cached so subsequent requests can be served instantly until the page’s configurable cache lifetime is reached.
Why is this cool?
Because it provides all of the SEO and UX benefits of SSR with no JavaScript transpilation or bundling required - the server and browser use the exact same code! This completely eliminates part of the traditional JavaScript SSR toolchain, increasing project maintainability and simplicity of development.
Better yet, Peko is not build for any specific frontend framework or library. You can use React, Preact, Vue… you name it! Simply plug your rendering function into Peko’s SSRRoute data along with a URL for the root module of your app and add the client-side hydration logic to your HTML template.
Note: Your root app component must be exported as default.
It is all possible because of the unique combination of powerful new JavaScript tools. Deno, unlike Node.js, is built to the ECMAScript specification. This makes it compatible with browser JavaScript and vice versa which elimates the need to generate separate client and server JavaScript bundles (the support for URL imports is the secret sauce). UI libraries like Preact combined with htm offer lightning fast client-side hydration with a transpiler-free JavaScript markup syntax. On top of this Deno has native TypeScript support, a rich runtime API and a standard library full of great tools as well as a passionate community supporting it.
Differences between other frameworks like Next.js, etc.
Peko is built with one radical design decision: it isn’t built to support the infinite universe of npm packages (as these often require bundling and transpilation). This is a deliberate step away from the inflated state that many modern web applications find themselves in. Just make sure your source modules can run directly in the browser without transpilation!