- 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.
- Production-Ready Backend - Reliable and performant with Deno-native Typescript and configurable Response caching.
- Software Minimalism - No build-step, just a sleek runtime using only the Deno std library.
- Ease of Adoption - Intuitive API & types with zero enforced directory 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.ts
-
Edit
./examples/preact/src
for frontend changes and play with./examples/preact/app.ts
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 HTTP requests and matches them to your defined app routes. If a route with matching HTTP path and url is found, the route’s middleware function is run followed by the handler function.
Peko contains premade Server-Side Rendering (SSR) and Static Asset handlers that can be easily accessed using Peko.addStaticRoute
or Peko.addSSRRoute
. The Preact example codebase uses Preact UI components with preact-render-to-string and a simple HTML Document Template Literal for SSR.
Advanced templating can be done with eta - take a look at /examples/eta-templating
. Or for an example of a custom SSR handler that implements Peko’s internal Response caching system have a look at /examples/custom-ssr
!
Caching only enabled if config.devMode == false
. You can manually edit the config using Peko.setConfig({ ... })
or keep the default but set env.ENVIRONMENT = "production"
to test caching locally.
Note: Peko.addSSRRoute({ ... })
is the only route function that implements caching by default.
Why is this cool?
Because it provides all of the SEO and UX benefits of SSR without any 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!