Was thinking a bit about how a CMS could work with supabase.
One approach is to use a code generator.
All you’d need is a list of fields, and the code generator would do a bunch of work for you, like:
- Generating the SQL to create the tables.
- Adding the primary keys, foreign keys and common fields, like
- Generating the security policies. Only
publisheddata should be accessible to the public, while creating and updating would require authentication.
- Adding a trigger to set the
- Adding a
*_versionstable and a trigger to capture each change.
We also get a few things for free:
- The content is accessible via the standard supabase API, ie
await supabase.from('table_name').select('*'). So no special API is needed.
- It notifies whenever something changes via supabase’s
In the future, it could provide:
- A visual editor for doing CRUD, publishing, scheduling, and archiving.
- A way to migrate the DB automatically, without copy & paste.
- The ability to Attach files to rows using Supabase Storage.
- Add default values for fields.
scheduled_atis set, and
status = 'scheduled'a CRON job should run to mark the post
published, that will trigger realtime updates.
- Should it support field validations?