Skip to content

OmarMusayev/terminaltui

Repository files navigation

terminaltui

npm license node typescript dependencies tests

A framework for building beautiful, interactive terminal websites and apps. Write a config, get a TUI, distribute via npx.

terminaltui demo


Get Started

npm install -g terminaltui     # install
terminaltui init               # create a new project
terminaltui dev                # preview it
terminaltui build && npm publish   # now anyone can: npx your-project-name

Build something new

terminaltui create
# Answer a few questions → get a tailored AI prompt → paste into Claude Code

Already have a website?

cd ~/my-website
terminaltui convert
# paste the prompt into Claude Code — it reads your site and generates the TUI version

Minimal Config

import { defineSite, page, markdown, card, link } from "terminaltui";

export default defineSite({
  name: "My Site",
  theme: "dracula",
  pages: [
    page("home", {
      title: "Home",
      icon: "◆",
      content: [
        markdown("# Hello World\nWelcome to my terminal."),
        card({ title: "My Project", body: "Something cool", tags: ["typescript"] }),
        link("GitHub", "https://github.com/me"),
      ],
    }),
  ],
});

See it live

npx omar-musayev

A real portfolio built with terminaltui — AI chat, blog posts with parameterized routes, interactive forms, and a custom orange-on-black theme.


What people have built

Demo Run it Theme
Developer Portfolio terminaltui dev demos/developer-portfolio/site.config.ts cyberpunk
Restaurant npx demo-tui-restaurant gruvbox
Coffee Shop npx demo-tui-cafe catppuccin
Live Dashboard terminaltui dev demos/dashboard/site.config.ts hacker
Startup Landing terminaltui dev demos/startup/site.config.ts tokyoNight
Conference terminaltui dev demos/conference/site.config.ts nord
Band Page terminaltui dev demos/band/site.config.ts rosePine
Freelancer Studio terminaltui dev demos/freelancer/site.config.ts custom
Tetris npx tsx demos/tetris/index.ts cyberpunk

Restaurant

restaurant demo

Dashboard (live API data)

dashboard demo

Tetris (yes, really — a fully playable game built on the framework)

tetris


Features

21+ Components

Card, Timeline, Table, Hero, Gallery, Tabs, Accordion, Quote, Badge, ProgressBar, Link, List, Section, Divider, Image, and more.

Interactive Forms

TextInput, TextArea, Select, Checkbox, Toggle, RadioGroup, NumberInput, SearchInput, Button — with validation, submission, and notifications.

ASCII Art System

fonts and art

14 fonts, 15 scenes, 32 icons, 12 patterns, 9 shapes, 5 data visualizations. Image-to-ASCII conversion with braille mode.

10 Built-in Themes

theme switching

cyberpunk, dracula, nord, monokai, solarized, gruvbox, catppuccin, tokyoNight, rosePine, hacker. Plus custom themes.

Reactive State & Live Data

createState, computed, dynamic blocks, fetcher with auto-refresh, request HTTP client, WebSocket/SSE via liveData. Build real applications, not just static sites.

API Routes (Backend Built In)

Define backend endpoints directly in your config — no separate server needed:

api: {
  "GET /stats": async () => {
    const uptime = execSync("uptime -p").toString().trim();
    return { uptime, timestamp: Date.now() };
  },
  "POST /deploy": async (req) => {
    execSync(`docker run -d ${(req.body as any).image}`);
    return { success: true };
  },
}

Run shell commands, read files, query databases — anything Node can do. The framework starts a local server automatically. fetcher({ url: "/stats" }) just works. See API Routes docs for the full reference.

Parameterized Routes

route("project", {
  title: (params) => `Project: ${params.id}`,
  content: async (params) => {
    const data = await fetch(`/api/projects/${params.id}`).then(r => r.json());
    return [card({ title: data.name, body: data.description })];
  },
});

Persistent State

const store = createPersistentState({
  path: ".terminaltui/state.json",
  defaults: { theme: "cyberpunk", favorites: [] },
});
// Survives app restarts

Built-in Testing

terminaltui test --sizes --verbose

Headless TUI emulator — like Puppeteer for terminals. Test every page programmatically.


Navigation

Key Action
↑↓ / jk Navigate between items
Enter / → Select / activate
← / Esc Back
q Quit
: Command mode
1-9 Jump to page

When focused on a text input, just start typing — it auto-enters edit mode. Press Escape to return to navigation.


Documentation


Tech Stack

  • TypeScript — fully typed with strict mode
  • Zero dependencies — pure Node.js 18+
  • 1,572 tests across 10 suites (npm test)
  • Apple Terminal compatible — auto-detects and falls back to 256-color

terminaltui is a v1 framework — the API is ambitious and some features are foundational implementations that will deepen over time. Contributions welcome.

Contributing

See CONTRIBUTING.md for setup instructions.

License

MIT