Brand logo
phis.dev
  • Home
  • Docs
  • Download
  • About us
Architecture
Four tiles, one of them lifted out of its place

Build on phis

Only for writing your own Site or Module: @phis/ui and @phis/contracts from npm, the entry points and the contracts they keep.
On this page
In short
How it fits
What matters
Example
Brand logo
phis.dev
Quick Links
Privacy
Download
Installation
Docs
Architecture
About us
GitHub
Support
Terms & Conditions
Contact
Register
© 2026 phis.dev. All rights reserved.

In short

@phis/ui is the shared UI, CMS renderer and Module host for Sites: Next.js App Router applications built on Ant Design and served by a phis Core. This page is for people who write their own Site or Module and need to know which entry points to import and which contracts the package keeps.

How it fits

A Site is a Next.js 16 app created with phis init. Its route files are thin wrappers over factories in @phis/ui/next/*, and @phis/ui renders the Areas, Pages, Widgets and Forms that the Core API stores in PostgreSQL. Modules are installed into the Site with the phis CLI and enabled per Area in the Builder. Backend state, sessions, authorization and Add-ons belong to the Core, not to this package.

What matters

  • Import from subpaths. The root export @phis/ui is not an integration surface. Use the grouped subpaths from package.json#exports, such as next/config, module and widgets.
  • Route files hold no logic. They delegate to @phis/ui/next/* factories and contain no CMS, locale or access logic, so behaviour fixes arrive by updating the package rather than editing the Site.
  • Import only the Areas a route needs. Each Area (public, app, admin, builder, editor, accounting) is a separate module graph.
  • Public pages are rendered once. A Public page is rendered once for every anonymous visitor, so nothing on it may depend on who is looking.
  • Build local Modules before adding them. A package resolves through its exports, which point into dist, so a local or workspace package must be built before it is added and rebuilt after every change.
  • Pre-v1 means no compatibility layers. Any release may change a contract or stored shape. Pin an exact version and upgrade the package, the Core and Modules together.

Example

phis init <site key>
phis module add --site <site key> --package <name>
The Site's next.config must set transpilePackages: ["@phis/ui"]. After adding a Module, rebuild the Site and enable the Module per Area in the Builder.