Public catalog API: templates, methods, and core values #54
Reference in New Issue
Block a user
Delete Branch "adilallo/PublicAPI"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Exposes curated rule templates and built-in governance methods (communication, membership, decision-making, conflict management, and core values) through public, machine-readable HTTP APIs. External clients and integrations can discover the full catalog without importing
messages/en/create/customRule/*.jsonor duplicating slug→copy maps.Builds on existing facet ranking (
GET /api/templates?facet.*,GET /api/create-flow/methodsscores). The in-app wizard can keep usinguseMessages(); these routes are the stable contract for out-of-app consumers (English v1).Changes
GET /api/templates/[slug]— single seeded template plus{ section, slug }composition fromtemplateMethodsFromBody; 404 when unknown;Cache-Control: public, max-age=3600GET /api/create-flow/methods(extended) — full deck withlabel,description,sectionsfor method sections; core values viasection=coreValues(aliasvalues); 1-based ids ("1","2", …); optionalmatcheswhenfacet.*is present; full deck returned (ranking preserved, zero-score methods stay in list)lib/server/governanceCatalog.ts— assembles DTOs from messages JSON (server-only)getRuleTemplateBySluginlib/server/ruleTemplates.tsCATALOG_SECTION_IDSinlib/create/customRuleFacets.ts;catalogSectionIdSchemainmethodFacetsSchemas.tsfetchTemplateDetailBySlug/ updatedfetchTemplateBySluginlib/create/fetchTemplates.ts(detail endpoint instead of full-list scan)governanceCatalog.test.ts,templatesBySlugRoute.test.ts, extendedcreateFlowMethodsRoute.test.tsandmethodFacets.test.tsCONTRIBUTING.mdAPI table,template-recommendation-matrix.md§9 (de-ticketed),backend-linear-tickets.mdTicket 22 / CR-115 entryScreenshots
N/A — API and documentation only.
How to Test
docker compose up -d postgres,.envwithDATABASE_URL,npx prisma migrate dev,npx prisma db seed,npm run devnpx next build