Hypertekt › Docs › Getting started

Getting started

From nothing to a live site in about 15 minutes: make a site, build its first pages on your own computer, then push it, publish it and give it a domain.

In this tutorial you make a small site for Slow Blink, a made-up cat cafe: a home page, and a page for each of its cats. You build it on your own computer with tekt, Hypertekt’s command, then push it to Hypertekt, publish it, and give it its domain. It takes about 15 minutes.

You’ll need:

  • Node 22.18 or later, or Bun 1.4 or later, to run tekt.
  • git.
  • A Hypertekt account that can make sites. While Hypertekt is invite-only, only people we’ve invited can make sites.
  • A domain for the last step, if you want the site live at its own address. Every other step works without a domain. Until you connect one, you can see the site at its preview link.

Install tekt

npm install -g @hypertekt/cli
tekt --version

With Bun, it’s bun add -g @hypertekt/cli.

The command is tekt. It’s also installed as hypertekt, if you’d rather spell it out.

Make the site

In the dashboard, under A new site, type the site’s name, like Slow Blink, and press Make the site. A new site is empty: it’s a git repository with nothing in it yet, waiting for its first push.

Sign in and clone it

tekt login
tekt clone slow-blink
cd slow-blink

tekt login opens the dashboard in your browser to approve this computer. Check that the code on the page matches the code in your terminal, then approve. tekt keeps the token the dashboard gives it, and git uses the same token, so you never type a password.

tekt clone finds the site by its name, its domain or its ID. A name can be typed whichever way is easiest: slow-blink, slowblink and "Slow Blink" all find the site called Slow Blink. The site is cloned into a folder named after it, slow-blink. The clone is on the site’s draft: the branch that everything you push goes to. The draft is built and previewed after every push, and only goes live when it’s published.

The first page

A site is a folder of files, and the folder you cloned is empty. tekt init would fill it with a starting set of files. Here you make four by hand instead, to see what each one is:

slow-blink/
  site.yaml
  layouts/base.html
  pages/index.html
  assets/site.css

site.yaml says what the site is:

name: Slow Blink
url: https://www.slowblink.example
language: en-US
timezone: America/Los_Angeles
description: A cat cafe in Portland with coffee, tea and cats from a local rescue who are looking for homes.
layout: base
business:
  type: CafeOrCoffeeShop
  phone: (503) 555-0187
  address: { street: 3120 SE Division St, city: Portland, region: OR, postcode: "97202", country: US }

url is the address the site will have, even before its domain is connected. www.slowblink.example is made up: if you have a domain for the last step, put yours here instead, starting with www. layout names the layout that pages are rendered inside. timezone is the time zone for the site’s hours and dates. business describes the business to search engines as structured data. Search results can then show the business’s address and phone number.

layouts/base.html is the layout every page is rendered inside. Each page fills the layout’s {{ slot }}:

<!doctype html>
<html lang="{{ site.language }}">
  <head>
    <link rel="stylesheet" href="{{ "site.css" | asset }}" />
  </head>
  <body>
    <header><a href="/">{{ site.name }}</a></header>
    <main>{{ slot }}</main>
  </body>
</html>

A template is HTML with tags in {{ }}. {{ site.name }} writes a value: the name from site.yaml. A | passes a value through a pipe, which gives back a new value. asset is a pipe.

There’s no <title> and no meta tags: Hypertekt writes them into every page’s <head> for you, from the page’s title and description.

pages/index.html is the home page. Every file in pages/ is a page, and its path is its address:

---
title: Coffee, tea and cats
description: A cat cafe in Portland with coffee, tea and cats from a local rescue who are looking for homes.
---
<h1>Coffee, tea and cats</h1>
<p>Have a latte with the cats from our partner rescue, and maybe take one home.</p>

The YAML between the --- lines is the page’s front matter: its title, its description, and any other values of its own.

assets/site.css is the stylesheet. Anything in assets/ is served as it is. {{ "site.css" | asset }} gives the file’s address with a version in it. The version changes whenever the file changes, so browsers never keep an old copy:

body {
  font-family: system-ui, sans-serif;
  max-width: 40rem;
  margin: 2rem auto;
  padding: 0 1rem;
}

Now see the site:

tekt start

tekt start serves the site at http://localhost:4321, and builds it again whenever you save a file.

A page for each cat

The cats are a collection: a list of items that all have the same fields. The site’s owner can add a cat in the dashboard’s Content tab without touching a template, and a page is made for each cat.

collections/cats.yaml says what a cat has:

label: Cats
fields:
  name: { type: text, required: true }
  slug: { type: slug, from: name }
  photo: { type: image, required: true }
  intro: { type: text, required: true, max: 160 }
  story: { type: markdown, required: true }
body: story

The slug is made from the name, for the cat’s page address. body: story keeps each cat’s story as the body of the cat’s file, below the other fields, so the story is easy to write.

Each item is a file in content/cats/. The file’s name, without its extension, is the item’s id, so content/cats/biscuit.md is the cat whose id is biscuit:

---
name: Biscuit
photo: { path: cats/biscuit.jpg, alt: "Biscuit, a ginger tabby, with his eyes closed in a slow blink" }
intro: A big ginger tabby who naps in the window and slow blinks at everyone who comes in.
---

Biscuit is calm, patient with children, and will fall asleep on your lap if you sit still long enough.

A photo’s path is its path in assets/, so put a photo of a cat at assets/cats/biscuit.jpg. Any photo will do, straight from a phone.

Biscuit’s slug is made from his name, so it’s biscuit too. The id names the item’s file, and the slug is what goes in the address of its page. They’re often the same, but they don’t have to be.

pages/cats/[slug].html makes one page per cat, at /cats/biscuit. each says which collection the pages are made from, and the [slug] in the file’s name is filled from each cat’s slug:

---
each: cats as cat
title: "{{ cat.name }}"
description: "{{ cat.intro }}"
image: "{{ cat.photo }}"
---
<h1>{{ cat.name }}</h1>
{{> ht/picture image=cat.photo widths="600 1200" sizes="(min-width: 40rem) 40rem, 100vw"}}
{{ cat.story | markdown }}

{{> name}} uses a partial: a template for one part of a page, which is given its values as name=value. ht/picture is one of the built-in components, which are partials that every site has. It makes resized copies of the photo in modern formats. Then it writes a <picture> element with the alt text, width and height, so the browser can pick the right copy for each screen. The image in the front matter is the picture shown when the page is shared. {{ cat.story | markdown }} writes the story’s Markdown as HTML.

Last, list the cats on the home page. Add this to the end of pages/index.html:

<h2>Meet the cats</h2>
<ul>
  {{#each cats as cat}}
  <li><a href="{{ cat | url }}">{{ cat.name }}</a>: {{ cat.intro }}</li>
  {{/each}}
</ul>

{{#each cats as cat}} goes through the collection, calling each item cat in turn. {{ cat | url }} is the address of the cat’s page. If the page’s address changes, the link changes with it, so the link never breaks.

When something’s wrong

Everything is checked before it’s built: templates, collections and their items, links, and the site’s search and accessibility basics. Change cat.name in the link to cat.nmae, and tekt start says:

pages/index.html:11:40  error  unknown-field  "cats" items have no field "nmae". Did you mean "name"?

tekt start keeps serving the last version that built until the error is fixed. An error stops a build, so a mistake is never a blank spot on the live site. A warning doesn’t stop a build, but it’s still worth fixing. A picture with no alt text gets a warning, for example. tekt check checks the site without building it. With --strict, it fails on warnings too, which is useful in CI.

On Hypertekt, checking works the same way. A draft that doesn’t build can’t be published, so the live site stays as it was. The preview keeps showing the last version that built. The dashboard’s Checks tab lists the problems with their files and lines.

Put cat.name back before you continue.

Push it

tekt push

tekt push commits everything in the folder, brings in anything new on the draft, and pushes. The first push also gives the site a .gitignore, so what tekt builds and your .env stay on your computer. Then tekt push waits for the draft to build and prints the preview’s address:

Committed your changes.
Pushed 1a2b3c4 to q3x8mk2tz7wa's draft. Building it…
Built. Its preview: https://preview-k7m2q9xh4tpr3wza.hypertekt.page

If the draft doesn’t build, tekt push says what’s wrong instead, and fails. tekt status says how things stand at any time:

tekt status
Slow Blink (q3x8mk2tz7wa)
  Draft:    1a2b3c4, built
  Preview:  https://preview-k7m2q9xh4tpr3wza.hypertekt.page
  Live:     nothing published yet

The preview is the draft, as visitors will see it. In the dashboard, the site’s Preview tab shows the same preview. The Content tab shows the cats.

You can work with git directly as well. tekt push and tekt pull are git underneath: the draft is a branch called draft, and the site’s remote is origin.

Publish it

tekt publish

Publishing builds the draft as it will be served, and makes that build a release. tekt releases lists the site’s releases. tekt rollback makes the previous release live again. tekt rollback <release> makes any earlier release live. A publish or a rollback reaches every visitor within about a minute and a half.

A release is served at the site’s domain. Until a domain is connected, the published site isn’t served anywhere, so the preview link is still the place to look at it.

Give it a domain

A published site is served at its own domain. In the dashboard, open the site’s Settings › General. Under Domains, connect the domain you put in site.yaml’s url, starting with www (for example, www.example.com). Settings gives you two DNS records to add where the domain is managed: one proves the domain is yours, and the other points it at Hypertekt. Once the records are in place, the site is live at its address, and Hypertekt makes its certificate for you. Connect a domain has the details, and what to do when a domain doesn’t connect.

What next

  • Hand it to its owner. tekt invite owner@example.com --owner invites the site’s owner, who keeps it up to date in the dashboard. They have their own guide, Help for owners.
  • Give it a design. Partials, layouts and the rest of the template language are in the reference.
  • Add a form, like a form for asking to meet a cat. What visitors send lands in the dashboard’s Inbox, and is emailed to the owner.