- 1.107.2-beta.4Latest
- 1.107.2-beta.3
- 1.107.2-beta.2
- 1.107.2-beta.1
- 1.107.1
- 1.107.0
- 1.106.4
- 1.106.3
- 1.106.2
- 1.106.1
- 1.106.0
- 1.105.5
- 1.105.4
- 1.105.3
- 1.105.2
- 1.105.1
- 1.105.0
- 1.104.2
- 1.104.1
- 1.104.0
- 1.103.0
- 1.102.6
- 1.102.5
- 1.102.4
- 1.102.3
- 1.102.2
- 1.102.1
- 1.102.0
- 1.101.22
- 1.101.21
- 1.101.20
- 1.101.19
- 1.101.18
- 1.101.17
- 1.101.16
- 1.101.15
- 1.101.14
- 1.101.13
- 1.101.12
- 1.101.11
- 1.101.10
- 1.101.9
- 1.101.8
- 1.101.7
- 1.101.6
- 1.101.5
- 1.101.4
- 1.101.3
- 1.101.2
- 1.101.1
- 1.101.0
- 1.100.1
- 1.100.0
- 1.99.3
- 1.99.2
- 1.99.1
- 1.99.0
- 1.98.3
- 1.98.2
- 1.98.1
- 1.98.0
- 1.97.7
- 1.97.6
- 1.97.5
- 1.97.4
- 1.97.3
- 1.97.2
- 1.97.1
- 1.97.0
- 1.96.11
- 1.96.10
- 1.96.9
- 1.96.8
- 1.96.7
- 1.96.6
- 1.96.5
- 1.96.4
- 1.96.3
- 1.96.2
- 1.96.1
- 1.96.0
- 1.95.9
- 1.95.8
- 1.95.7
- 1.95.6
- 1.95.5
- 1.95.4
- 1.95.3
- 1.95.2
- 1.95.1
- 1.95.0
- 1.94.8
- 1.94.7
- 1.94.6
- 1.94.5
- 1.94.4
- 1.94.3
- 1.94.2
- 1.94.1
- 1.94.0
- 1.91.0-alpha.4
- 1.93.0
- 1.93.0-alpha.4
- 1.93.0-alpha.3
- 1.93.0-alpha.2
- 1.93.0-alpha.1
- 1.93.0-alpha.0
- 1.92.5
- 1.92.4
- 1.92.3
- 1.92.0
- 1.91.0-alpha.3
- 1.91.0-alpha.2
- 1.91.0
- 1.91.0-alpha.0
- 1.90.2
- 1.90.1
- 1.90.0
- 1.89.9-alpha.1
- 1.89.8
- 1.89.7
- 1.89.6
- 1.89.5
- 1.89.4
- 1.89.3
- 1.89.2
- 1.89.1
- 1.89.0
- 1.88.19
- 1.88.18
- 1.88.17
- 1.88.16
- 1.88.15
- 1.88.14
- 1.88.13
- 1.88.12
- 1.88.11
- 1.88.10
- 1.88.9
- 1.88.8
- 1.88.7
- 1.88.6
- 1.88.5
- 1.88.4
- 1.88.3
- 1.88.2
- 1.88.1
- 1.88.0
- 1.86.5
- 1.86.4
- 1.86.3
- 1.86.2
- 1.86.1
- 1.86.0
- 1.85.9
- 1.85.8
- 1.85.6
- 1.85.7
- 1.85.5
- 1.85.4
- 1.85.3
- 1.85.2
- 1.85.1
- 1.85.0
- 1.84.9
- 1.84.8
- 1.84.7
- 1.84.6
- 1.84.5
- 1.84.4
- 1.84.3
- 1.84.2
- 1.84.1
- 1.84.0
- 1.83.8
- 1.83.7
- 1.83.6
- 1.83.5
- 1.83.4
- 1.83.3
- 1.83.2
- 1.83.1
- 1.83.0
- 1.82.2
- 1.82.1
- 1.82.0
- 1.81.10
- 1.81.9
- 1.81.8
- 1.81.7
- 1.81.6
- 1.81.5
- 1.81.4
- 1.81.3
- 1.81.2
- 1.81.1
- 1.81.0
- 1.80.4
- 1.80.3
- 1.80.2
- 1.80.1
- 1.80.0
- 1.79.3
- 1.79.2
- 1.79.1
- 1.79.0
- 1.78.1
- 1.78.0
- 1.77.0
- 1.76.1
- 1.76.0
- 1.75.6
- 1.75.5
- 1.75.4
- 1.75.3
- 1.75.2
- 1.75.1
- 1.75.0
- 1.74.1
- 1.74.0
- 1.73.1
- 1.73.0
- 1.72.0
- 1.71.10
- 1.71.9
- 1.71.8
- 1.71.7
- 1.71.6
- 1.71.5
- 1.71.4
- 1.71.3
- 1.71.2
- 1.71.1
- 1.71.0
- 1.70.8
- 1.70.7
- 1.70.6
- 1.70.5
- 1.70.4
- 1.70.3
- 1.70.2
- 1.70.1
- 1.70.0
- 1.69.9
- 1.69.8
- 1.69.7
- 1.69.4
- 1.69.3
- 1.69.2
- 1.69.1
- 1.69.0
- 1.68.1
- 1.68.0
- 1.67.10
- 1.67.9
- 1.67.8
- 1.67.7
- 1.67.6
- 1.67.5
- 1.67.4
- 1.67.3
- 1.67.2
- 1.67.1
- 1.67.0
- 1.66.13
- 1.66.12
- 1.66.11
- 1.66.10
- 1.66.9
- 1.66.8
- 1.66.7
- 1.66.6
- 1.66.5
- 1.66.4
- 1.66.3
- 1.66.2
- 1.66.1
- 1.66.0
- 1.65.8
- 1.65.7
- 1.65.6
- 1.65.5
- 1.65.4
- 1.65.3
- 1.65.2
- 1.65.1
- 1.65.0
- 1.64.2
- 1.64.1
- 1.64.0
- 1.63.19
- 1.63.18
- 1.63.17
- 1.63.15
- 1.63.14
- 1.63.13
- 1.63.12
- 1.63.11
- 1.63.10
- 1.63.9
- 1.63.8
- 1.63.7
- 1.63.6
- 1.63.5
- 1.63.4
- 1.63.3
- 1.63.2
- 1.63.1
- 1.63.0
- 1.62.3
- 1.62.2
- 1.62.1
- 1.62.0
- 1.61.5
- 1.61.4
- 1.61.3
- 0.36.7
- 1.61.2
- 1.61.1
- 1.61.0
- 1.60.27
- 1.60.26
- 1.60.25
- 1.60.24
- 1.60.23
- 1.60.22
- 1.60.21
- 1.60.20
- 1.60.19
- 1.60.18
- 1.60.17
- 1.60.16
- 1.60.15
- 1.60.14
- 1.60.13
- 1.60.12
- 1.60.11
- 1.60.10
- 1.60.9
- 1.60.8
- 1.60.7
- 1.60.6
- 1.60.5
- 1.60.4
- 1.60.3
- 1.60.2
- 1.60.1
- 1.60.0
- 1.59.10
- 1.59.9
- 1.59.8
- 1.59.7
- 1.59.6
- 1.59.4
- 1.59.5
- 1.59.3
- 1.59.2
- 1.59.1
- 1.59.0
- 1.58.0
- 1.57.32
- 1.57.31
- 1.57.30
- 1.57.29
- 1.57.28
- 1.57.27
- 1.57.26
- 1.57.25
- 1.57.24
- 1.57.23
- 1.57.22
- 1.57.21
- 1.57.20
- 1.57.19
- 1.57.18
- 1.57.17
- 1.57.16
- 1.57.15
- 1.57.14
- 1.57.13
- 1.57.12
- 1.57.11
- 1.57.10
- 1.57.9
- 1.57.8
- 1.57.7
- 1.57.6
- 1.57.5
- 1.57.4
- 1.57.3
- 1.57.2
- 1.57.1
- 1.57.0
- 1.56.2
- 1.56.1
- 1.56.0
- 1.55.1
- 1.55.0
- 1.54.2
- 1.54.0
- 1.53.10
- 1.53.9
- 1.53.8
- 1.53.7
- 1.53.6
- 1.53.5
- 1.53.4
- 1.53.3
- 1.53.2
- 1.53.1
- 1.53.0
- 1.52.20
- 1.52.19
- 1.52.18
- 1.52.17
- 1.52.16
- 1.52.15
- 1.52.14
- 1.52.13
- 1.52.12
- 1.52.11
- 1.52.10
- 1.52.9
- 1.52.8
- 1.52.7
- 1.52.6
- 1.52.5
- 1.52.4
- 1.52.3
- 1.52.1
- 1.52.0
- 1.51.6
- 1.51.5
- 1.51.4
- 1.51.3
- 1.51.2
- 1.51.1
- 1.51.0
- 1.50.5
- 1.50.4
- 1.50.3
- 1.50.2
- 1.50.1
- 1.50.0
- 1.49.0
- 1.48.7
- 1.48.6
- 1.48.5
- 1.48.4
- 1.48.3
- 1.48.2
- 1.48.1
- 1.48.0
- 1.47.6
- 1.47.5
- 1.47.4
- 1.47.3
- 1.47.2
- 1.47.1
- 1.47.0
- 1.46.7
- 1.46.6
- 1.46.5
- 1.46.4
- 1.46.3
- 1.46.2
- 1.46.1
- 1.46.0
- 1.45.11
- 1.45.10
- 1.45.9
- 1.45.8
- 1.45.7
- 1.45.6
- 1.45.5
- 1.45.4
- 1.45.3
- 1.45.2
- 1.45.1
- 1.45.0
- 1.44.8
- 1.44.7
- 1.44.6
- 1.44.5
- 1.44.4
- 1.44.3
- 1.44.2
- 1.44.1
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.11
- 1.41.10
- 1.41.9
- 1.41.8
- 1.41.7
- 1.41.6
- 1.41.5
- 1.41.4
- 1.41.3
- 1.41.2
- 1.41.1
- 1.41.0
- 1.40.2
- 1.40.1
- 1.40.0
- 1.39.8
- 1.39.7
- 1.39.6
- 1.39.5
- 1.39.4
- 1.39.3
- 1.39.2
- 1.39.1
- 1.39.0
- 1.38.2
- 1.38.1
- 1.38.0
- 1.37.6
- 1.37.5
- 1.37.4
- 1.37.3
- 1.37.2
- 1.37.1
- 1.37.0
- 1.36.20
- 1.36.19
- 1.36.18
- 1.36.17
- 1.36.16
- 1.36.15
- 1.36.14
- 1.36.13
- 1.36.12
- 1.36.11
- 1.36.10
- 1.36.9
- 1.36.8
- 1.36.7
- 1.36.6
- 1.36.5
- 1.36.4
- 1.36.3
- 1.36.2
- 1.36.1
- 1.36.0
- 1.35.12
- 1.35.11
- 1.35.10
- 1.35.9
- 1.35.8
- 1.35.7
- 1.35.6
- 1.35.5
- 1.35.4
- 1.35.3
- 1.35.2
- 1.35.1
- 1.35.0
- 1.34.6
- 1.34.5
- 1.34.4
- 1.34.3
- 1.34.2
- 1.34.1
- 1.34.0
- 1.33.7
- 1.33.6
- 1.33.5
- 1.33.4
- 1.33.3
- 1.33.2
- 1.33.1
- 1.33.0
- 1.32.2
- 1.32.1
- 1.32.0
- 1.31.13
- 1.31.12
- 1.31.11
- 1.31.10
- 1.31.9
- 1.31.8
- 1.31.6
- 1.31.5
- 1.31.4
- 1.31.3
- 1.31.2
- 1.31.1
- 1.31.0
- 1.30.11
- 1.30.10
- 1.30.9
- 1.30.8
- 1.30.7
- 1.30.6
- 1.30.5
- 1.30.4
- 1.30.3
- 1.30.2
- 1.30.1
- 1.30.0
- 1.29.10
- 1.29.9
- 1.29.8
- 1.29.7
- 1.29.6
- 1.29.5
- 1.29.4
- 1.29.3
- 1.29.2
- 1.29.1
- 1.29.0
- 1.28.1
- 1.28.0
- 1.28.0-beta.6
- 1.28.0-beta.5
- 1.28.0-beta.4
- 1.28.0-beta.3
- 1.28.0-beta.2
- 1.28.0-beta.1
- 1.27.10
- 1.27.9
- 1.27.8
- 1.27.7
- 1.27.6
- 1.27.5
- 1.27.4
- 1.27.3
- 1.27.2
- 1.27.1
- 1.27.0
- 1.26.5
- 1.26.4
- 1.26.3
- 1.26.2
- 1.26.1
- 1.26.0
- 1.25.7
- 1.25.6
- 1.25.5
- 1.25.4
- 1.25.3
- 1.25.2
- 1.25.1
- 1.25.0
- 1.24.7
- 1.24.6
- 1.24.5
- 1.24.4
- 1.24.3
- 1.24.2
- 1.24.1
- 1.24.0
- 1.23.9
- 1.23.8
- 1.23.7
- 1.23.6
- 1.23.5
- 1.23.4
- 1.23.3
- 1.23.2
- 1.23.1
- 1.23.0
- 0.3.39-als
- 1.22.14
- 1.22.13
- 1.22.12
- 1.22.11
- 1.22.10
- 1.22.9
- 1.22.8
- 1.22.7
- 1.22.6
- 1.22.5
- 1.22.4
- 1.22.3
- 1.22.2
- 1.22.1
- 1.22.0
- 1.21.9
- 1.21.8
- 1.21.7
- 1.21.6
- 1.21.5
- 1.21.4
- 1.21.3
- 1.21.2
- 1.21.1
- 1.21.0
- 1.20.1
- 1.20.0
- 1.19.9
- 1.19.8
- 1.19.7
- 1.19.6
- 1.19.5
- 1.19.4
- 1.19.3
- 1.19.2
- 1.19.1
- 1.19.0
- 1.18.1
- 1.18.0
- 1.17.6
- 1.17.5
- 1.17.4
- 1.17.3
- 1.17.2
- 1.17.1
- 1.17.0
- 1.16.3
- 1.16.2
- 1.16.1
- 1.16.0
- 1.15.0
- 1.14.7
- 1.14.6
- 1.14.4
- 1.14.3
- 1.14.2
- 1.14.1
- 1.14.0
- 1.13.1
- 1.13.0
- 1.12.12
- 1.12.11
- 1.12.10
- 1.12.9
- 1.12.8
- 1.12.7
- 1.12.6
- 1.12.5
- 1.12.4
- 1.12.3
- 1.12.2
- 1.12.1
- 1.12.0
- 1.11.1
- 1.11.0
- 1.10.0
- 1.9.20
- 1.9.19
- 1.9.18
- 1.9.17
- 1.9.16
- 1.9.15
- 1.9.14
- 1.9.13
- 1.9.12
- 1.9.11
- 1.9.10
- 1.9.9
- 1.9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- 0.3.34-beta.2
- 0.3.34-beta.1
- 0.3.34-beta
- 0.3.33
- 0.3.32
- 0.3.31
- 0.3.31-beta.2
- 0.3.31-beta.1
- 0.3.29
- 0.3.28
- 0.3.27
- 0.3.26
- 0.3.25
- 0.3.24
- 0.3.23
- 0.3.22
- 0.3.22-beta
- 0.3.20
- 0.3.20-beta.0
- 0.3.19
- 0.3.18
- 0.3.17
- 0.3.17-workbench.0
- 0.3.16
- 0.3.15
- 0.3.14
- 0.3.14-beta
- 0.3.13
- 0.3.12
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.16-functions
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14a
- 0.1.14
- 0.1.13
- v0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.0.33-test
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.32
- 0.0.31
- 0.31.0
- 0.0.30
- 0.0.29
- 0.0.28
- 0.0.27
- 0.0.26
- 0.0.25
- 0.0.24
- 0.0.23
- 0.0.22
- 0.0.21
- 0.0.20
- 0.0.19
- 0.0.18
- 0.0.17
- 0.0.16
- 0.0.15
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
deco.cx/live â the edge-native DXP
Live is the edge-native digital experience platform for fresh apps.
Live allows developers to create sections
(UI components) and functions
(data fetchers) that can be configured in a visual editor UI by anyone in the digital experience team. This means business users can now create and evolve the content and configuration of their digital experience without the need for developers to deploy changes. Developers can add edit functions to existing routes, and business users can create completely dynamic pages composed from these building blocks via UI.
Besides pages, Live also lets teams manage flags, experiments and campaigns with an instant, global configuration management service optimized for the edge. Using matcher
and effect
functions, configuration changes can be applied to any specific audience. Every change is instantly available to matched users, from gradual rollout of features, to A/B testing content, to targeting specific users with personalized content.
Live is designed to be fast, secure and easy to use. Thatâs why we built it on top of extraordinary open-source technologies, including fresh, a framework for building edge-native applications, supabase, a managed Postgres DB and auth wrapper, and jitsu, a data collector. And Live is also open source and free, so you have zero vendor lock-in.
We, the creators of Live, offer a managed Live infrastructure at deco.cx where you can scale from zero to millions of users without worrying about infrastructure. If you like the framework, give us a try :) life is too short to deal with CDN configuration and database management.
Creating a new Live site
Want to create a Live site from scratch?
- First, fork and clone the deco start template repo.
- Then, in the project directory, run
deno task start
. - Finally, go to https://localhost:8080 and follow the instructions in the home page.
- From there, you can sign up at
deco.cx
to use the online editor and deploy your site to the edge.
Adding live to an existing fresh site
Assuming you have a working fresh site, you can configure Live in 4 quick steps:
1. Add Live to your dependencies
First add the $live
import to your import_map.json
file:
{
"imports": {
"$live/": "https://deno.land/x/live@0.3.0/",
"(...)": "(...)"
}
}
dev
task from fresh with Liveâs
2. Replace the Now, letâs replace the dev
import in dev.ts
. Just change $fresh/dev.ts
to $live/dev.ts
:
import dev from "$live/dev.ts";
await dev(import.meta.url, "./main.ts");
3. Add the middleware to allow Live to intercept requests and access components
Then create a routes/_middleware.tsx
file and add the following code:
import manifest from "../fresh.gen.ts";
import { withLive } from "$live/live.ts";
export const handler = withLive(manifest, {
site: "start",
siteId: 8,
domains: ["mysitename.com"],
});
4. Mount the Live handler on a catch-all route
Finally, in order to allow the creation of dynamic pages in any route, mount live
as a handler for a catch-all route. Create routes/[...path].tsx
:
import { live } from "$live/live.ts";
import LivePage from "$live/components/LivePage.tsx";
export const handler = live();
export default LivePage;
Great! Live is now setup. You can verify itâs working by going to any route that will trigger the catch all. For example, go to https://localhost:8080/start. You should see an empty page with an âEdit in deco.cxâ button. Clicking it will redirect you to the deco.cx/live editor, which opens your site in an iframe.
Now, the fun begins! Creating sections
allow you to create UI components that can be used in any page and can be configured in the admin UI. This allows non-developers to reuse components and compose new pages, experiment on content, etc, all without requiring any code deploy.
Sections: creating configurable components
Now, letâs create a configurable section
.
Sections are ordinary UI components, but they can be configured in the Live UI.
They are the building blocks of your site and their configuration can vary dynamically: with experiments, like A/B tests, with scheduled campaigns, or by targeting specific users.
Create the sections/
folder and a new sections/Hello.tsx
file with the following code:
export interface Props {
name: string;
}
export default function Hello({ name }: Props) {
return <div>Hello {name}</div>;
}
Go to http://localhost:8080/start to see a page that mounts the Hello section. This page was already created, as an example.
Now, when you go to any page, you should see the Hello
section available in the Add Component
drawer.
Add it to a page. You should see a name
field in the sectionâs configuration editor.
When you save this configuration, youâll have a draft version of the page with the Hello
section.
Functions: creating configurable data fetchers
Now, letâs create a configurable function
.
// TODO
Live scripts
Live ships some utilitary scripts which you can add to your project as needed.
Images
One of the most transfered data on the internet are images. Live has first class support for uploading, storing and optimizing images.
Uploading images
To upload images, you first need a section component setup. In your section componet import our special Image type and export it as the section prop.
// ./sectios/MySection.tsx
import type { Image } from "$live/std/ui/types/Image.ts";
export interface Props {
src: Image
alt: string
}
export default function MySection({ src, alt }: Props) {
return <img src={src} alt={alt} />
}
This will create the following image uploader widget on the section editor.
After drag and dropping the target image on this widget, live will upload the image and generate a url. This url will be passed as a prop to your component. Use this prop to render the image in your section
Optmizing images
Business users may upload huge images (>500Kb) on the image uploader. Itâs up to the developer to make sure all images are loaded efficiently by making the images responsive, light and correctly encoded. Hopefully, live already ships all of these best practices into an <Image />
component. To use this image component on the above example:
// ./sectios/MySection.tsx
import LiveImage from "$live/std/ui/components/Image.tsx";
import type { Image } from "$live/std/ui/types/Image.ts";
export interface Props {
src: Image
alt: string
}
export default function MySection({ src, alt }: Props) {
return <LiveImage src={src} alt={alt} width={500} height={350} />
}
This will create a responsive image that fits most screens and encode it depending on the browserâs User Agent, all while distributing the image globally in a CDN!
HTML to Component script
You can use the component
script to transform any HTML in your clipboard
into a Preact component.
Add the component
task to your deno.json
file:
{
"tasks": {
"start": "(...)",
"component": "deno eval 'import \"$live/scripts/component.ts\"'"
},
"importMap": "./import_map.json"
}
Then copy some HTML into your clipboard. For example:
<div>
<span>Hello World</span>
<img src="/test.jpg">
<!-- note the unclosed img tag, which is invalid JSX -->
</div>
Then run the component
task passing the ComponentName as first argument:
deno task component MyTestComponent
The new component will be generated in ./components/MyTestComponent.tsx
and
should look like this:
export default function MyTestComponent() {
return (
<div>
<span>Hello World</span>
<img src="/test.jpg" /> {/* note the closed img tag! */}
</div>
);
}
Aditionally, the import snippet will replace your clipboard content:
import MyTestComponent from "../components/MyTestComponent.tsx";
Local development
cd examples/counter
- Create an
.env
file with:
SUPABASE_KEY=...
SUPABASE_ACCOUNT=...
DECO_SITE=...
deno task start
Now browse:
http://localhost:8080/
for a dynamic page http://localhost:8080/test
for a
static page