- Home
- Skills
- Data & Databases
- Supabase CMS for a Static Portfolio Site
More screenshots
Works with the AI Agents you already use
Supabase CMS for a Static Portfolio Site
Visitors read published rows through PostgREST with the anonymous key and row level security decides what is visible.
$19
Supabase CMS for a Static Portfolio Site
Example session with this skill installed
Take a static portfolio site that still keeps its content in api/*.json and put a Supabase
CMS behind it. The design must not change: same markup, same classes, same sections. Content
moves to Postgres, the public page reads published rows with the anonymous key, and drafts
must never appear for a visitor even if the front end asks for them. Add a private admin at
/admin/ with editing for projects, experiences, education, skills, organizations,
photography, a motion gallery and a 3D render gallery, plus a settings screen for section
copy. One account only, no signup. Migrate the existing JSON into the new tables without a
visual diff, then deploy to Cloudflare Pages. Use the supabase-portfolio-cms skill.
- Read your context and instructions
- Compiled the supabase cms
Delivered against that request, using the playbook in the package.
Summary. Ten idempotent migrations create the schema, the policies and the storage
buckets; one pure mapper converts rows back into the shape the existing renderer already
paints; the admin dashboard is one schema-driven CRUD engine with twelve module declarations
instead of twelve hand-written screens; the content migration ran in dry-run mode first and
refused to import until every section compared byte for byte; verify-cms.mjs proved the
security boundary against the live project before the deploy.
| Deliverable | File | Check that it works |
|---|---|---|
| Schema, triggers, ordering | supabase/migrations/0001_schema.sql | re-running the file succeeds a second time |
| Row level security | supabase/migrations/0002_rls.sql | anon key reads published rows only, cannot insert, cannot read admin_users |
| Storage buckets and limits | supabase/migrations/0004_upload_fix.sql | admin upload succeeds, anonymous upload rejected |
| Row-to-DOM mapper | src/cms/shape.js | node --test tests/shape.test.mjs |
| Public loader with JSON fallback | src/cms/public-content.ts | page renders identically with Supabase unreachable |
| Admin dashboard, 12 modules | admin/ | create, publish, edit, reorder, delete without new view code |
| Fidelity-gated migration | scripts/migrate-to-supabase.mjs | dry run prints a pass per section, nothing written |
| First admin, no signup path | scripts/bootstrap-admin.mjs | account signs in at /admin/, auth signup disabled |
| End-to-end verification | scripts/verify-cms.mjs | public read, draft hidden, insert blocked, upload, delete |
| Credential-free demo | demo/ | npm test reports 84 passing tests |
-- run order, one file per concern, safe to re-run
0001_schema.sql 0002_rls.sql 0003_hardening.sql
0004_upload_fix.sql 0005_photography_section_settings.sql
0006_motion_gallery.sql 0007_motion_media_combined_type.sql
0008_render_3d.sql 0009_media_rotation.sql 0010_privilege_sweep.sql
node scripts/migrate-to-supabase.mjs # dry run, fidelity gate
node scripts/migrate-to-supabase.mjs --confirm
ADMIN_PASSWORD='...' node scripts/bootstrap-admin.mjs admin@example.com
node scripts/verify-cms.mjs # security and CRUD checks
npm run build && npx wrangler pages deploy dist --project-name <project> --branch=main
Next steps for the buyer. Create the Supabase project and run supabase/setup-all.sql
in the SQL editor; copy .env.example to .env and fill the four values; bootstrap the
single admin; run the migration dry run and read the per-section comparison before
--confirm; run verify-cms.mjs and fix the policy rather than the test if a check fails;
deploy to the existing production branch, then fetch the custom domain with a cache-busting
query and grep for a marker that only exists in the new build. Turn off "Allow new users to
sign up" in the Supabase auth settings at the same time as the bootstrap step.
Connects securely to your tools. The creator never sees your data.
About this skill
What the skill produces
A static or Vite site keeps its markup, its design and its renderer, and moves its content
into Supabase (Auth, PostgreSQL, Storage). Visitors read published rows through PostgREST
with the anonymous key and row level security decides what is visible. One allow-listed
account writes through a private admin dashboard at /admin/. A Cloudflare Pages deploy
ships the result.
The skill is a numbered procedure with a done-when condition per step, plus the working code: migrations, the admin SPA, the mapper, the migration tooling, the verification script and a demo harness that runs with no credentials.
What the package contains
| Item | Count | Path |
|---|---|---|
| Idempotent SQL migrations | 10 | supabase/migrations/0001 to 0010 |
| Paste-ready concatenation of the same migrations | 1,180 lines | supabase/setup-all.sql |
| Admin dashboard, plain ES modules, no framework | 20 files | admin/ |
| Pure row-to-DOM mapper | 1 file | src/cms/shape.js |
Public loader, PostgREST over plain fetch | 1 file | src/cms/public-content.ts |
| Migration, bootstrap, verification and repair scripts | 10 files | scripts/ |
| Node test suites | 10 suites, 84 tests | tests/ and demo/ |
| Supabase mock, fictional dataset, screenshot harness | 6 files | demo/ |
| Markdown documentation | 10 documents | docs/ |
| Screenshots in the archive | 0 | 25 stay in the repository for listing media; Agensi delivers text only |
| Archive | 82 files | about 331 KB compressed, 1.09 MB of text |
The ten migrations cover the schema, the row level security policies, a hardening pass,
the storage upload fix, the photography section settings, the motion gallery, the combined
media type, the 3D render gallery, media rotation and a final privilege sweep. The sweep
is last on purpose: two of the gallery migrations grant all on their new tables, and
grant all reintroduces TRUNCATE and REFERENCES. The sweep repeats the revoke after
every table exists and raises an exception if either privilege survives.
The procedure in seven lines
- Schema:
created_at,updated_attrigger,status(draftorpublished) and an ordering column on every content table, idempotent throughout. - Policies:
grant selecttoanon,grant alltoauthenticated, public read limited to published rows or an admin, child rows read through the parent,admin_userswith a select policy and no insert policy at all. - Storage:
portfolio-mediaanddocumentsbuckets, public read, admin-only write, MIME and size validated in the client because storage metadata is written after the row. - Mapper first: one pure function turns rows into the legacy
{ textData, imgData, settingsData }shape the existing renderer already consumes, so the renderer is not rewritten. - Migration with a fidelity gate: dry run by default,
--confirmwrites, and every write is gated behind an offline comparison that refuses to import when a section would render differently. - Admin engine: one schema-driven CRUD engine, twelve modules declared as data, hash routing, drafts that survive navigation, media sync that matches by id instead of delete-then-insert.
- Verify, then deploy:
verify-cms.mjsproves the security boundary end to end, then the build ships to Cloudflare Pages and the custom domain is checked for a marker that only exists in the new build.
Cost of the same work done by hand
The package answers the parts that are slow to get right without prior context:
- a policy set per table, with drafts invisible to the anonymous key and an admin allow-list that has no insert path in the client;
- storage policies that cannot inspect object metadata, and a client-side validation that compensates;
- a content migration that must not change rendering, gated on a byte-for-byte comparison;
- a CRUD interface for twelve modules built from declarations instead of twelve bespoke screens;
- a verification script that asserts the negative cases (anonymous insert blocked,
admin_usershidden, drafts absent) rather than the happy path only.
Pitfalls the playbook already accounts for
grant all includes TRUNCATE, which bypasses row level security, and a later migration that
adds a table with grant all reopens exactly that hole, which is why the last migration
repeats the revoke and asserts it. A key/value settings table
with unrestricted public read leaks future secrets. Recreating a policy is required to add
keys to a using list; altering it is not enough. Child-row sync by delete-then-insert
erases a gallery. Tags serialised as objects print [object Object]. Every CMS string
reaches innerHTML, so escaping, markdown sanitising and href scheme checks are part of
the renderer contract. Deploying to a non-production branch succeeds while the custom domain
keeps serving the old build.
What runs without credentials
demo/ is a dependency-free mock of the Supabase HTTP API serving a fictional dataset, plus
a capture harness. npm test runs 84 tests with no database and no network. The screenshots
in this listing were captured from that harness.
Scope
Built for one owner or a small allow-list, on a site whose content should live in a database rather than in git. Not built for multi-tenant products, editorial workflows with review and scheduling, or teams that need per-role permissions.
Ships no public front-end renderer and no site build, so it is not a deployable website on its own. Three behaviours remain untested in the shipped evidence: concurrent writes, the migration fidelity gate against a real content source, and adversarial storage deletion.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 7 days ago
Requires
Permissions
Allowed Hosts