{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "backup-restore",
  "type": "registry:block",
  "title": "Backup Restore",
  "description": "Backup run records, restore checklist, and continuity dashboard.",
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://stackfoundry.dev/r/drizzle-postgres.json"
  ],
  "files": [
    {
      "path": "packages/db/src/schema/backup-restore.ts",
      "type": "registry:file",
      "target": "packages/db/src/schema/backup-restore.ts",
      "content": "import { index, jsonb, pgTable, text, timestamp, uuid } from \"drizzle-orm/pg-core\";\n\nexport const backupRestore = pgTable(\n  \"backup_restore\",\n  {\n    id: uuid(\"id\").primaryKey().defaultRandom(),\n    ownerId: text(\"owner_id\"),\n    organizationId: text(\"organization_id\"),\n    key: text(\"key\").notNull(),\n    status: text(\"status\").notNull().default(\"pending\"),\n    metadata: jsonb(\"metadata\").$type<Record<string, unknown>>().notNull().default({}),\n    expiresAt: timestamp(\"expires_at\", { withTimezone: true }),\n    completedAt: timestamp(\"completed_at\", { withTimezone: true }),\n    createdAt: timestamp(\"created_at\", { withTimezone: true }).defaultNow().notNull(),\n  },\n  (item) => [\n    index(\"backup_restore_owner_idx\").on(item.ownerId),\n    index(\"backup_restore_organization_idx\").on(item.organizationId),\n  ]\n);\n"
    },
    {
      "path": "apps/web/src/lib/backup-restore.ts",
      "type": "registry:file",
      "target": "apps/web/src/lib/backup-restore.ts",
      "content": "export type BackupRestoreConfig = {\n  key: string;\n  enabled?: boolean;\n  metadata?: Record<string, unknown>;\n};\n\nexport function createBackupRestoreConfig(config: BackupRestoreConfig) {\n  return {\n    key: config.key,\n    enabled: config.enabled ?? true,\n    metadata: config.metadata ?? {},\n  };\n}\n\nexport const backupRestoreProductionChecks = [\n  \"Confirm access control\",\n  \"Record audit events for sensitive changes\",\n  \"Document rollback or recovery steps\",\n] as const;\n"
    },
    {
      "path": "apps/web/src/app/(console)/admin/backups/page.tsx",
      "type": "registry:page",
      "target": "apps/web/src/app/(console)/admin/backups/page.tsx",
      "content": "const tasks = [\n  \"Configure defaults\",\n  \"Connect persistence or provider adapter\",\n  \"Verify production checklist\",\n];\n\nexport default function BackupRestorePage() {\n  return (\n    <main className=\"flex flex-col gap-6 p-6\">\n      <div>\n        <h1 className=\"text-2xl font-semibold\">Backup Restore</h1>\n        <p className=\"text-muted-foreground\">Backup run records, restore checklist, and continuity dashboard.</p>\n      </div>\n      <ul className=\"grid gap-3\">\n        {tasks.map((task) => (\n          <li key={task} className=\"rounded-lg border p-4 text-sm\">{task}</li>\n        ))}\n      </ul>\n    </main>\n  );\n}\n"
    }
  ],
  "maintenanceSkills": [
    {
      "name": "backup-restore",
      "target": ".stackfoundry/skills/backup-restore/SKILL.md",
      "content": "---\nname: backup-restore\ndescription: Maintain the Backup Restore module installed by StackFoundry.\n---\n\n# Backup Restore Maintenance Instructions\n\n- Preserve the ownership and setup guidance in `docs.md`.\n- Keep source templates small and provider-neutral.\n- Update `tests/checklist.md` with behavior changes.\n- Do not commit secrets, local state, or generated machine metadata.\n- Keep Drizzle schema exports synchronized with `module.json`.\n\n## Shared Skills\n\nWhen provider, framework, or database behavior changes, load the installed shared skill before editing implementation details:\n\n- `.stackfoundry/skills/nextjs/SKILL.md` (source: `registry/skills/nextjs/SKILL.md`)\n- `.stackfoundry/skills/drizzle/SKILL.md` (source: `registry/skills/drizzle/SKILL.md`)\n\nKeep this module skill focused on ownership, installed files, env vars, deployment checks, and module-specific invariants.\n\n"
    },
    {
      "name": "nextjs",
      "target": ".stackfoundry/skills/nextjs/SKILL.md",
      "content": "---\nname: nextjs\ndescription: Maintain Next.js App Router code installed by StackFoundry modules.\n---\n\n# Next.js Operating Instructions\n\n## Installed Location\n\n- Installed target: `.stackfoundry/skills/nextjs/SKILL.md`\n- Registry source: `registry/skills/nextjs/SKILL.md`\n\nAgents maintaining an installed module should load this shared skill from the installed target when provider, framework, database, SDK, or platform behavior is involved. Keep provider-specific API details here instead of duplicating them inside module maintenance skills.\n\n- Keep server-only data access out of Client Components.\n- Put route handlers under `app/api` and UI routes under the relevant App Router segment.\n- Prefer Server Components for data loading and add `\"use client\"` only for interactivity.\n- Keep public environment variables prefixed with `NEXT_PUBLIC_`; keep secrets server-only.\n- Re-run typecheck and build after changing route handlers, layouts, or shared app configuration.\n"
    },
    {
      "name": "drizzle",
      "target": ".stackfoundry/skills/drizzle/SKILL.md",
      "content": "---\nname: drizzle\ndescription: Maintain Drizzle ORM and Postgres code installed by StackFoundry modules.\n---\n\n# Drizzle Operating Instructions\n\n## Installed Location\n\n- Installed target: `.stackfoundry/skills/drizzle/SKILL.md`\n- Registry source: `registry/skills/drizzle/SKILL.md`\n\nAgents maintaining an installed module should load this shared skill from the installed target when provider, framework, database, SDK, or platform behavior is involved. Keep provider-specific API details here instead of duplicating them inside module maintenance skills.\n\n- Keep database access in server-only code.\n- Add schema changes under `packages/db/src/schema` and export shared tables from the schema barrel.\n- Generate and commit migrations when schema changes are intended.\n- Use typed query helpers instead of raw SQL unless the query needs a documented escape hatch.\n- Include tenant, organization, or user scope in queries and cache tags whenever data is not global.\n"
    }
  ],
  "envVars": {},
  "docs": "# Backup Restore Module\n\nBackup run records, restore checklist, and continuity dashboard.\n\n## Why This Exists\n\nThis is a common launch-readiness component for production SaaS applications.\n\n## Owns\n\n- `packages/db/src/schema/backup-restore.ts`\n- `apps/web/src/lib/backup-restore.ts`\n- `apps/web/src/app/(console)/admin/backups/page.tsx`\n\n## Environment\n\nRequires `DATABASE_URL` through the `drizzle-postgres` dependency.\n\n## Maintenance\n\n- Keep the default module provider-neutral.\n- Add provider adapters as separate modules.\n- Verify install output with `stackfoundry add backup-restore --target <app> --dry-run`.\n",
  "meta": {
    "category": "operations",
    "env": [],
    "status": "ready",
    "maturity": "ready",
    "drizzle": {
      "schemaExports": [
        "backupRestore"
      ],
      "migrationRecommended": true
    },
    "recommendedFor": []
  }
}
