Skip to content

Guide · Open source

How to use Marko: install, write templates and render pages

Updated · written with AI from the project's own documentation and checked against our catalogue data

Marko is an open-source JavaScript framework for building user interfaces. You write templates in an HTML-like syntax instead of JSX, and it can render pages on a server, in the browser, or both. This guide explains what Marko is, what you need before starting, how to get the source, and when it is a good fit compared with React, Vue, Svelte or Preact.

Markomarko-js/marko · ★ 14.5k · MIT

Quick start

  1. 1Install Node.js. Node.js is the listed prerequisite for Marko. Install it before you start.
  2. 2Clone the repository. Run git clone https://github.com/marko-js/marko to get the source code, as shown in the project README.
  3. 3Read the README and docs. Open the README in the repository and the docs at markojs.com for the full setup steps, which the source excerpt does not include.
  4. 4Write a template. Create an HTML-style Marko template for your page, following the official syntax.
  5. 5Render on server or browser. Choose whether the template renders on the server, in the browser, or both, based on your project needs.

What is Marko and who is it for?

Marko is a declarative, HTML-based language for building web apps. Developers use it to build interactive websites and web apps, and it can render pages on the server, in the browser, or both.

It is a good match for JavaScript developers who prefer HTML-style templates over JSX, and for teams that need server-side rendering in Node.js. It is less suited to a plain static website, where plain HTML or a static site generator is simpler, and to teams that depend heavily on a large existing React component ecosystem, since Marko's ecosystem is smaller.

  • Good fit: HTML-style templates, server-side rendering in Node.js, exploring alternatives to React, Vue or Svelte
  • Poor fit: a simple static site, or a project that relies on a large React component library

What do you need before you install Marko?

The only prerequisite listed for Marko is Node.js. Install Node.js first, then follow the install steps for Marko.

Marko is released under the MIT licence, so you can use it freely in your own projects, subject to the terms of that licence.

  • Node.js (the listed prerequisite)

How do you get the Marko source code?

The install method for Marko is through a package manager. The README in the repository gives the following command to get the source code by cloning the repository. Run it in the folder where you want the project to live.

The source excerpt used for this guide comes from packages/runtime-tags/README.md. Check the project homepage at markojs.com and the repository README for the full set of setup steps, since the excerpt does not cover every step.

git clone https://github.com/marko-js/marko

How do you write and render a Marko template?

Marko templates use an HTML-like syntax, so the markup you write looks familiar to anyone who knows HTML. The framework can render these templates on the server, in the browser, or both.

The source does not include a full template example, so consult the official documentation at markojs.com for exact syntax and rendering examples.

  • Write the page structure in HTML-style markup
  • Choose where it renders: server, browser, or both
  • Use the official docs at markojs.com for exact syntax

How does Marko compare with React, Vue, Svelte and Preact?

Marko sits in the same general space as React, Vue, Svelte and Preact: JavaScript frameworks for building user interfaces. Its main difference is the HTML-style template syntax, where the others are often associated with JSX or their own template formats.

Choose Marko if its template style and server rendering fit your project. Choose a more established option if you need a larger library of ready-made components.

  • Marko: HTML-style templates, server, browser or both rendering
  • React, Preact: JSX-based component model
  • Vue, Svelte: their own component formats
  • Pick the one whose ecosystem your team can use

What people use it for

  • Building interactive websites with HTML-style templates
  • Server-side rendering of pages in a Node.js application
  • Building web apps as an alternative to React, Vue or Svelte
  • Trying out a framework that avoids JSX

Frequently asked questions

What do I need to install Marko?

The listed prerequisite is Node.js. Install Node.js, then get the source with the git clone command from the project README.

Is Marko free to use?

Yes. Marko is released under the MIT licence, which allows free use, including in commercial projects, under the licence terms.

Is Marko a good alternative to React?

It can be, if you prefer HTML-style templates over JSX and want server-side rendering in Node.js. If you depend on a large React component ecosystem, React may be the safer choice because Marko's ecosystem is smaller.

How does Marko compare with Vue, Svelte or Preact?

All are JavaScript frameworks for user interfaces. Marko's distinctive feature is its HTML-like template syntax, while the others use JSX or their own component formats.

Should I use Marko for a simple static website?

Probably not. For a plain static site, plain HTML or a static site generator is simpler than a full framework.

Where can I find troubleshooting help for Marko?

The source excerpt does not include troubleshooting details. Check the repository README and the official site at markojs.com for documentation and support information.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Marko suits JavaScript developers who want HTML-style templates and server-side rendering in Node.js, and teams curious about alternatives to React, Vue or Svelte. Skip it for a simple static website, or if your project depends heavily on a large existing React component library.

Install options & downloads