Add module loader & registry (task 04)

Implements the extensibility foundation: ModuleManifest/DashboardWidget/EntityTypeRegistration types in _core/module.ts, a plain-Map registry singleton with registerModule/getRegistry/getEntityType/getWidget, and stub manifests for calendar/lists/notes. Root layout imports src/modules/index.ts for side-effect registration; AppNav reads the registry to render nav links. /debug/registry dumps the full registry JSON in dev using zod v4 + z.toJSONSchema(). Adding a fourth module requires one folder + one line in index.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ginnoir
2026-05-06 01:52:47 -05:00
co-authored by Claude Sonnet 4.6
parent 37977568ed
commit e237fe8449
13 changed files with 280 additions and 4 deletions
+24
View File
@@ -0,0 +1,24 @@
import Link from "next/link";
import { getRegistry } from "@/modules/_core/registry";
export function AppNav() {
const { modules } = getRegistry();
const navItems = modules.flatMap((m) => (m.nav ? [m.nav] : []));
return (
<nav className="border-b px-4 py-3 flex items-center gap-6">
<Link href="/" className="font-semibold text-sm">
famapp
</Link>
{navItems.map((item) => (
<Link
key={item.href}
href={item.href}
className="text-sm text-muted-foreground hover:text-foreground transition-colors"
>
{item.label}
</Link>
))}
</nav>
);
}