UI Architecture Strategy
This document is the source of truth for frontend implementation strategy in apps/frontend.
How the Current UI Works
Shell
AppShellowns global layout (header, left nav, account menu, widgets).- Left nav is user-customizable (order + hide/show persisted locally).
- Mobile nav is drawer-style; desktop can collapse nav.
Routing
src/app/router.tsxdeclares route map.- Route wrappers in
src/routes/*should be composition-only. - Feature logic lives in
src/features/*.
Settings Model
- Three scopes:
/settings/company/settings/user/settings/platform(super admin only)
Content Workflow Model
- Brand Identity
- Campaigns
- Calendar
- Content production
- Operations
- Insights
Add a New Page (Recommended Pattern)
- Create feature page in
src/features/<domain>/components/<Domain>Page.tsx. - Create route wrapper in
src/routes/<domain>/<Domain>Route.tsx. - Add route to
src/app/router.tsx. - Add nav item in
AppShellonly if user-facing. - Add tests:
- feature page behavior (
*.test.tsx) - route guards if auth behavior changed
- feature page behavior (
- Add/update docs in
apps/docs/clients/features/*andapps/docs/internal/features/*.
Example
tsx
// src/routes/example/ExampleRoute.tsx
import { ExamplePage } from "@/features/example/components/ExamplePage";
export function ExampleRoute() {
return <ExamplePage />;
}tsx
// router.tsx snippet
{ path: "/example", element: <ExampleRoute /> }Change an Existing Page (Safe Refactor Pattern)
- Confirm route contract (URL and params) before editing.
- Preserve API payload compatibility (
fromBackend/toPayloadhelpers). - Keep selected state obvious in any list/detail workflow.
- Maintain action hierarchy (single primary CTA).
- Re-run page tests and update docs in same PR.
Bad Patterns to Avoid
- Mixing business logic into route wrapper files.
- Introducing hardcoded color values instead of semantic tokens.
- Using the same visual style for selected and unselected controls.
- Overloading one column with creation + filters + detail editing without clear grouping.
- Shipping undocumented future behavior in docs without issue tracking.
- Leaving stale references to legacy routes (
/company/*,/user-profile/*,/social-posts).
Future Work Discipline
Any future behavior mentioned in docs must include a GitHub issue link.
Current tracked items: