|
1 | | -<div align="center"> |
2 | | - |
3 | 1 | # PureStack |
4 | 2 |
|
5 | | -**Pure frontend infrastructure for the AI age.** |
6 | | - |
7 | | -Coherent source for real products: content, interfaces, styles, scripts, |
8 | | -workflows, and tooling designed to belong together. |
9 | | - |
10 | | -</div> |
11 | | - |
12 | | ---- |
13 | | - |
14 | | -PureStack is a TypeScript-native frontend ecosystem for building content sites, |
15 | | -documentation, product frontends, admin surfaces, dashboards, and operational |
16 | | -tools from one coherent source model. |
| 3 | +**Build content sites and interactive pages with Markdown, components, and TypeScript.** |
17 | 4 |
|
18 | | -It is designed for a world where AI is not an assistant on the side, but part of |
19 | | -the everyday act of building software. |
| 5 | +PureStack turns a content directory into a static website. Write pages in |
| 6 | +Markdown or Regor MDX, use built-in components where they help, and add |
| 7 | +browser-side TypeScript only where a page needs behavior. The CLI handles |
| 8 | +routes, styles, assets, development preview, and release builds. |
20 | 9 |
|
21 | | -## Why PureStack Exists |
| 10 | +[Documentation](https://purestack.studio/guides/) | [Component catalog](https://purestack.studio/components/) | [npm package](https://www.npmjs.com/package/purestack) |
22 | 11 |
|
23 | | -AI can one-shot code in any framework. |
| 12 | +## What you can build |
24 | 13 |
|
25 | | -PureStack is built for what happens after the first shot: the long life of a |
26 | | -real product as features change, screens multiply, styles evolve, and the source |
27 | | -needs to stay understandable. |
| 14 | +- **Content and documentation sites:** file-based routes, frontmatter, navigation, |
| 15 | + page outlines, and optional search. |
| 16 | +- **Interactive pages:** server-rendered Regor components, page-specific |
| 17 | + TypeScript through `PageScript`, and mounted apps through `RegorApp`. |
| 18 | +- **Sites with a consistent visual system:** themes, semantic tones, typed |
| 19 | + styles, and a component library shared across pages. |
| 20 | +- **Static output:** generated HTML, CSS, JavaScript, and assets that can be |
| 21 | + served by a static host. |
28 | 22 |
|
29 | | -Most frontend stacks spread intent across too many layers: framework rules, |
30 | | -template syntax, CSS conventions, utility classes, build plugins, runtime |
31 | | -hydration, and editor-specific knowledge. AI can work there, but it has to keep |
32 | | -guessing across boundaries. |
| 23 | +`.mdx` and `.rmdx` pages use Regor components and expressions. Plain `.md` |
| 24 | +files work for prose pages. See the [Regor guide](https://purestack.studio/guides/regor/) |
| 25 | +for the markup and browser app model. |
33 | 26 |
|
34 | | -PureStack takes a different bet: |
| 27 | +## Quick start |
35 | 28 |
|
36 | | -**sustained AI generation is better when the product frontend is coherent, |
37 | | -typed, inspectable, and mostly TypeScript.** |
38 | | - |
39 | | -Markdown belongs where prose belongs. Everything else should be high-quality |
40 | | -source that humans can reason about and AI can inspect, compose, refactor, and |
41 | | -extend with confidence. |
42 | | - |
43 | | -## What This Repository Contains |
44 | | - |
45 | | -This repository contains the PureStack package workspace: the SSG pipeline, |
46 | | -Regor component system, typed style and HTML/CSS builders, runtime page scripts, |
47 | | -icon tooling, rendering foundation, shared types, and editor support. |
48 | | - |
49 | | -## Install |
| 29 | +Create a project and install the CLI: |
50 | 30 |
|
51 | 31 | ```sh |
52 | | -yarn add purestack |
53 | | -``` |
54 | | - |
55 | | -The public package provides the `purestack` CLI and the TypeScript API for custom |
56 | | -projects: |
57 | | - |
58 | | -```ts |
59 | | -import { buildSite, startDevServer } from 'purestack' |
60 | | -``` |
61 | | - |
62 | | -## The Core Packages |
63 | | - |
64 | | -PureStack has many packages, but three of them define the day-to-day experience. |
65 | | - |
66 | | -### `@purestack/ts-ssg` |
67 | | - |
68 | | -`ts-ssg` is the product frontend pipeline. |
69 | | - |
70 | | -It builds Markdown, MDX, and Regor MDX into a site or app surface, serves it in |
71 | | -development, watches content changes, and bundles TypeScript browser assets. It |
72 | | -is where content, templates, navigation, styles, scripts, and static assets meet |
73 | | -in one workflow. |
74 | | - |
75 | | -Feature shape: |
76 | | - |
77 | | -- Markdown, `.mdx`, and `.rmdx` content |
78 | | -- frontmatter-driven pages |
79 | | -- custom template maps |
80 | | -- file-based navigation |
81 | | -- page outline and table-of-contents support |
82 | | -- dev server with watch mode and live reload |
83 | | -- TypeScript browser asset bundling |
84 | | -- optional sitemap, robots, Pagefind, consent, and GA4 configuration |
85 | | -- build hooks for projects that need to observe or extend the pipeline |
86 | | - |
87 | | -### `@purestack/ts-components` |
88 | | - |
89 | | -`ts-components` is the product UI vocabulary. |
90 | | - |
91 | | -It provides Regor components for real product surfaces: forms, buttons, panels, |
92 | | -navigation, tabs, modals, toasts, charts, landing sections, pricing tables, |
93 | | -search, theme switching, virtual lists, and more. |
94 | | - |
95 | | -The package keeps component registration and style registration separate. That |
96 | | -lets the SSG pipeline generate site styles while browser-side TypeScript can |
97 | | -reuse the same component vocabulary. It also ships TypeScript source files for |
98 | | -better package-aware tooling and editor metadata. |
99 | | - |
100 | | -### `@purestack/ts-style` |
101 | | - |
102 | | -`ts-style` is the design coherence layer. |
103 | | - |
104 | | -It keeps themes, skins, semantic tones, breakpoints, utility styles, typography, |
105 | | -palette variables, and document layout styles in TypeScript. Components can use |
106 | | -shared tones like `neutral`, `accent`, `info`, `success`, `warning`, and |
107 | | -`danger` without scattering visual decisions across unrelated CSS conventions. |
108 | | - |
109 | | -## Using PureStack |
110 | | - |
111 | | -A PureStack content folder is centered around `siteConfig.json` and content |
112 | | -files: |
113 | | - |
114 | | -```txt |
115 | | -content/ |
116 | | - siteConfig.json |
117 | | - index.mdx |
118 | | - dashboard.ts |
| 32 | +mkdir my-site |
| 33 | +cd my-site |
| 34 | +npm init -y |
| 35 | +npm install purestack |
| 36 | +mkdir content |
119 | 37 | ``` |
120 | 38 |
|
121 | | -Minimal config: |
| 39 | +Create `content/siteConfig.json`: |
122 | 40 |
|
123 | 41 | ```json |
124 | 42 | { |
125 | | - "siteTitle": "My Product", |
126 | | - "outDir": "../dist/site" |
| 43 | + "siteTitle": "My Site", |
| 44 | + "logo": { "brand": "My Site", "href": "/" }, |
| 45 | + "outDir": "../dist/site", |
| 46 | + "publishDir": "../dist/publish" |
127 | 47 | } |
128 | 48 | ``` |
129 | 49 |
|
130 | | -Content can stay mostly Markdown while mounting TypeScript where behavior is |
131 | | -needed: |
| 50 | +Create `content/index.mdx`: |
132 | 51 |
|
133 | 52 | ```mdx |
134 | 53 | --- |
135 | | -title: Dashboard |
| 54 | +title: Welcome |
| 55 | +description: My first PureStack site. |
136 | 56 | template: doc |
137 | | -layout: |
138 | | - fullWidth: true |
139 | 57 | --- |
140 | 58 |
|
141 | | -# Dashboard |
| 59 | +# Welcome |
| 60 | + |
| 61 | +This page is built from MDX. |
142 | 62 |
|
143 | | -<RegorApp src="./dashboard.ts" id="dashboard-app" /> |
| 63 | +<Panel tone="info" variant="surface"> |
| 64 | + <p>Edit this file and see the page update.</p> |
| 65 | +</Panel> |
144 | 66 | ``` |
145 | 67 |
|
146 | | -The TypeScript asset is bundled for the browser: |
147 | | - |
148 | | -```ts |
149 | | -import { |
150 | | - defineBadgeComponents, |
151 | | - definePanelComponents, |
152 | | -} from '@purestack/ts-components' |
153 | | -import { createApp, html } from 'regor' |
154 | | - |
155 | | -const mount = document.querySelector('app#dashboard-app') |
156 | | - |
157 | | -if (mount instanceof HTMLElement) { |
158 | | - createApp( |
159 | | - { |
160 | | - components: { |
161 | | - ...defineBadgeComponents(), |
162 | | - ...definePanelComponents(), |
163 | | - }, |
164 | | - }, |
165 | | - { |
166 | | - element: mount, |
167 | | - template: html`<Panel tone="info"> |
168 | | - <Badge tone="success">Ready</Badge> |
169 | | - </Panel>`, |
170 | | - }, |
171 | | - ) |
172 | | -} |
| 68 | +Start the development server: |
| 69 | + |
| 70 | +```sh |
| 71 | +npx purestack serve --content ./content |
173 | 72 | ``` |
174 | 73 |
|
175 | | -Run the pipeline with a content directory: |
| 74 | +Open <http://127.0.0.1:4173/>. Add `content/about.mdx` to create `/about/`. |
| 75 | +The server watches your files and reloads the browser as you edit. |
| 76 | + |
| 77 | +When the site is ready: |
176 | 78 |
|
177 | 79 | ```sh |
178 | | -yarn purestack build --content ./content |
179 | | -yarn purestack serve --content ./content --port 4173 |
180 | | -yarn purestack publish --content ./content |
181 | | - |
182 | | -Usage: |
183 | | - purestack build --content <dir> [--clean] |
184 | | - purestack serve --content <dir> [--host <host>] [--port <port>] [--clean] [--no-watch] [--no-reload] |
185 | | - purestack publish --content <dir> |
186 | | - |
187 | | -Commands: |
188 | | - build Build a content directory into its configured outDir. |
189 | | - serve Start the dev server for a content directory. |
190 | | - publish Clean and build a publish artifact using the configured publishDir. |
| 80 | +npx purestack build --content ./content |
| 81 | +npx purestack publish --content ./content |
191 | 82 | ``` |
192 | 83 |
|
193 | | -## Package Map |
| 84 | +`build` writes to `dist/site`. `publish` creates a clean, minified artifact in |
| 85 | +`dist/publish`; it prepares files for deployment but does not upload them. |
| 86 | +Both paths come from `siteConfig.json` and are resolved relative to `content`. |
194 | 87 |
|
195 | | -| Package | Role | |
| 88 | +For browser behavior, add a TypeScript file beside a page and load it with |
| 89 | +`<PageScript src="./example.ts" />`. The [purestack package README](packages/purestack/README.md) |
| 90 | +has a complete example. |
| 91 | + |
| 92 | +## How PureStack fits together |
| 93 | + |
| 94 | +| Source | What PureStack does | |
| 95 | +| --- | --- | |
| 96 | +| `siteConfig.json` | Defines output paths, site identity, themes, navigation, and optional features. | |
| 97 | +| `.md`, `.mdx`, `.rmdx` | Turn content files into routes and HTML pages. | |
| 98 | +| Regor components | Render UI into pages at build time. | |
| 99 | +| `PageScript` and `RegorApp` | Bundle TypeScript and add browser behavior where requested. | |
| 100 | +| Static assets | Copies files from the content directory into the site output. | |
| 101 | + |
| 102 | +The [CLI guide](https://purestack.studio/guides/purestack-cli/) covers the |
| 103 | +commands and options. [Site configuration](https://purestack.studio/guides/site-config/) |
| 104 | +covers navigation, themes, search, sitemap, localization, and output paths. |
| 105 | + |
| 106 | +## Repository map |
| 107 | + |
| 108 | +| Path | Purpose | |
196 | 109 | | --- | --- | |
197 | | -| [`purestack`](packages/purestack) | Public package and CLI. Re-exports the TypeScript API from `@purestack/ts-ssg`. | |
198 | | -| [`@purestack/ts-ssg`](packages/ts-ssg) | Build and dev-server pipeline for Markdown, MDX, Regor MDX, templates, navigation, styles, scripts, and browser assets. | |
199 | | -| [`@purestack/ts-components`](packages/ts-components) | Regor component definitions, component metadata, and matching style registration for product frontend primitives. | |
200 | | -| [`@purestack/ts-style`](packages/ts-style) | Theme, skin, semantic tone, breakpoint, utility, typography, palette, and layout style infrastructure. | |
201 | | -| [`@purestack/ts-html`](packages/ts-html) | Typed HTML node and head helpers through `h`, `TSNode`, `createHead`, and head config utilities. | |
202 | | -| [`@purestack/ts-css`](packages/ts-css) | Typed CSS style builder exports including `Style`, `s`, `CSSProps`, color helpers, and gradient helpers. | |
203 | | -| [`@purestack/ts-page-scripts`](packages/ts-page-scripts) | Runtime script builders for theme switching, consent, auth state hints, code copy, menus, modals, nav menus, Pagefind search, page TOC, and tabs. | |
204 | | -| [`@purestack/ts-svg-icons`](packages/ts-svg-icons) | Tree-shakeable SVG icon access through provider exports and `getSvgIcon`. | |
205 | | -| [`@purestack/ts-render`](packages/ts-render) | Regor/static rendering support through `renderApp` and a component registry. | |
206 | | -| [`@purestack/ts-minidom`](packages/ts-minidom) | Minimal DOM implementation and DOM globals for rendering and tests. | |
207 | | -| [`@purestack/ts-common`](packages/ts-common) | Shared site config, frontmatter, navigation, template, consent, analytics, and SSG context types. | |
208 | | -| [`@purestack/ts-util`](packages/ts-util) | Browser-safe utility helpers for paths, public paths, escaping, merging, caching, logging, and type checks. | |
209 | | -| [`@purestack/ts-util-node`](packages/ts-util-node) | Node-only filesystem helpers. | |
210 | | -| [`ts-ssg-vscode`](packages/ts-ssg-vscode) | VS Code extension workspace for Regor MDX, template syntax, formatting, linked editing, diagnostics, and component metadata tooling. | |
211 | | - |
212 | | -## How The Pieces Fit |
213 | | - |
214 | | -PureStack keeps prose, product UI, styling, scripts, and build behavior close to |
215 | | -the source that defines them. |
216 | | - |
217 | | -- `.md` is for Markdown. |
218 | | -- `.mdx` is the familiar extension for Markdown with Regor components. |
219 | | -- `.rmdx` is the explicit Regor MDX extension when a project wants the dialect |
220 | | - to be visible in the filename. |
221 | | -- TypeScript assets are bundled for the browser by the SSG pipeline. |
222 | | -- Static Regor `html` and `svg` template tags are stripped during the SSG |
223 | | - browser bundling path so template syntax remains useful to tooling without |
224 | | - becoming a tree-shaking blocker. |
225 | | -- `@purestack/ts-components` ships source files for better package-aware |
226 | | - tooling and component metadata. |
227 | | - |
228 | | -PureStack does not require the backend to be TypeScript. It focuses on the |
229 | | -product frontend source: content, UI, state, styles, scripts, and tooling. |
230 | | - |
231 | | -## Development |
232 | | - |
233 | | -This repository uses Yarn workspaces and TypeScript 7 through `tsgo`. |
| 110 | +| [`packages/purestack`](packages/purestack) | Public `purestack` package, CLI, and TypeScript API. | |
| 111 | +| [`packages/ts-ssg`](packages/ts-ssg) | Content discovery, rendering, routing, builds, and development server. | |
| 112 | +| [`packages/ts-components`](packages/ts-components) | Built-in UI components and component metadata. | |
| 113 | +| [`packages/ts-style`](packages/ts-style) | Themes, skins, typography, and style generation. | |
| 114 | +| [`packages/ts-css`](packages/ts-css) and [`packages/ts-html`](packages/ts-html) | Typed CSS and HTML builders. | |
| 115 | +| [`packages/ts-page-scripts`](packages/ts-page-scripts) | Browser-side behavior used by site components. | |
| 116 | +| [`packages/ts-svg-icons`](packages/ts-svg-icons) | SVG icon providers and lookup. | |
| 117 | +| [`packages/ts-ssg-vscode`](packages/ts-ssg-vscode) | VS Code support for PureStack content and components. | |
| 118 | +| [`frontend`](frontend) | Source for purestack.studio, built with PureStack. | |
| 119 | +| [`packages/ts-ssg/sample-content`](packages/ts-ssg/sample-content) | A larger example site with content, components, and browser scripts. | |
| 120 | + |
| 121 | +The remaining workspace packages provide shared types, utilities, rendering, |
| 122 | +and DOM support. |
| 123 | + |
| 124 | +## Develop this repository |
| 125 | + |
| 126 | +This is a Yarn 4 workspace. Run commands from the repository root: |
234 | 127 |
|
235 | 128 | ```sh |
236 | 129 | yarn install |
237 | 130 | yarn build |
238 | | -yarn test |
| 131 | +yarn dev |
239 | 132 | ``` |
240 | 133 |
|
241 | | -Useful workspace commands: |
| 134 | +`yarn dev` serves the included sample site. To work on the PureStack website, |
| 135 | +run `yarn frontend`; its development server opens at |
| 136 | +<http://127.0.0.1:4700/>. See the [frontend README](frontend/README.md) for |
| 137 | +the site-specific workflow. |
| 138 | + |
| 139 | +Useful checks and build commands: |
242 | 140 |
|
243 | 141 | ```sh |
244 | | -yarn dev |
| 142 | +yarn test run |
245 | 143 | yarn bundle |
246 | | -yarn lint |
| 144 | +yarn package |
247 | 145 | ``` |
248 | 146 |
|
249 | | -`yarn dev` runs the `@purestack/ts-ssg` sample-content workflow. `yarn build` |
250 | | -runs package builds across the workspace. `yarn test` runs Vitest. |
| 147 | +`yarn bundle` creates distributable package builds. `yarn package` packs the |
| 148 | +non-private workspace packages into local tarballs. |
251 | 149 |
|
252 | 150 | ## License |
253 | 151 |
|
254 | | -MIT. |
| 152 | +[MIT](LICENSE). Bugs and feature requests: [GitHub issues](https://github.com/PureStackStudio/PureStack/issues). |
0 commit comments