ticket

Getting Started

Ticket is a Rails-shaped web framework written in Polar, for Polar projects. This page covers what it is, how far along it is, and what you need to try it.

What is Ticket?

If you've used Rails, most of Ticket will look familiar: resource routes, controllers with actions, views with layouts, and before-filters. What's different is that it's all Polar, so the type checker sees everything:

  • Routes are a zone. A routes block generates the router and a typed path helper for every named route. A typo in a controller name is a compile error on the route line.
  • Controllers are modules of functions. Each action takes a Conn and returns a Response. Its effects are in its signature.
  • Views are markup that type-checks. A views block turns JSX-style markup into functions returning Html, with escaping built in.
  • No hidden state. A Conn is a value. Filters return a new one or a response, and nothing is mutated behind your back.

How far along is it?

Ticket is built in milestones. F0 to F4 are done: routing, controllers, views and components, SQLite with migrations and typed queries, validations, forms, sessions, authentication, JSON and uploads, generators, tests, and production hardening. See the roadmap for what's next.

What you need

  • Node.js 22.5 or newer and git.
  • The polar toolchain, 0.4.0 or newer. The first step installs it.

1. Install Polar

Ticket is written in Polar and builds with it, so install the toolchain first. The installer puts polar in ~/.polar/bin.

$ curl -fsSL https://polar-lang.vercel.app/install.sh | sh
$ polar --version

If the install prints a line about your PATH, add it and open a new shell. polar --version should say 0.4.0 or newer. To build Polar from source instead, see Polar's getting started guide.

2. Install the ticket command

The installer checks out the newest release into ~/.ticket and links ~/.local/bin/ticket to it. It needs git, node and polar, and stops with a message if one is missing. Run it again to update.

$ curl -fsSL https://ticket-polar.vercel.app/install.sh | sh
$ ticket version

3. Create an app

$ ticket new my_app
$ cd my_app
$ ticket server

The app is now on http://127.0.0.1:3000. Prefer to add Ticket to an existing project? polar add github.com/stepanvanzuriak/ticket adds it from GitHub.

Where next

Build a one-page app in Your First App, or jump straight to Routing if you know Rails already.