supabase/postgres-meta ? reverse-engineered prompt

Reverse engineered prompt

Build me a small TypeScript service that exposes a REST API for managing Postgres databases.

I want to be able to list and edit database objects like tables, columns, schemas, roles, functions, triggers, extensions, and publications, and also run SQL queries directly. It should return the database structure in a clean, easy to read format, and support basic create, update, and delete actions for the main objects.

Please include a simple way to connect to a Postgres instance through environment variables, and make it work for more than one database if possible. I’d also like a couple of utility endpoints for things like formatting and parsing SQL, and if it fits, add support for generating API docs or typed client output from the schema.

This is meant to run in a trusted internal environment, so keep it lightweight and practical. If you need to check current docs for Postgres behavior or query formatting, feel free to look them up online.