Use Remult Kit instead.
remult-cli
is a command-line tool designed to simplify the process of generating Remult entities from a PostgreSQL database.
Inspired by prisma db pull
, this tool streamlines the creation of Remult entities, making database integration smoother and more efficient.
Generate Remult entities using the default settings:
npx remult-cli pull
For more advanced usage, you can utilize the --help
flag to explore the available options:
npx remult-cli --help
# All entities from two schemas:
npx remult-cli pull --schemas auth public
# All entities from all schemas:
npx remult-cli pull --schemas '*'
--connectionString
: Your PostgreSQL database connection string. Only PostgreSQL databases are supported.--tableProps
: Customize properties for generated tables (default:allowApiCrud: true
).--output
: Define the output directory for the generated Remult entities (default:./src/shared
).--defaultOrderBy
: Will put a default order by if we see one of this column name. (default:order,name
).--customDecorators
: Will replace the default decorator by a custom one. (Should be a stringified JSON object). Let's describe this example:{"@Fields.string":"@KitFields.string#@kitql/remult"}
, here we replace the default@Fields.string
decorator by@KitFields.string
from the@kitql/remult
import.
Alternatively, you can utilize a .env
file to set configuration values. Example:
DATABASE_URL=postgres://user:pass@host:port/db-name
TABLE_PROPS=allowApiCrud: (r) => r?.authenticated() ?? false
OUTPUT=./fancy/place
DEFAULT_ORDER_BY = "order,name,nom,username"
CUSTOM_DECORATORS = '{"@Fields.string":"@KitFields.string#@kitql/remult","@Fields.dateOnly":"@KitFields.dateOnly#@kitql/remult"}'
After setting up your .env
file, run the following command:
npx remult-cli pull
- Clone the repository:
git clone https://github.com/Yedidyar/remult-cli.git
- Install dependencies:
pnpm install
- Start the development server:
pnpm dev
- Begin development:
pnpm start
- Run CI locally with 🌍 earthly 🌍
- Install earthly for yours OS (you can see there yours OS pre-requisites)
- Run
earthly -P +all
(you can also add the--interactive
flag for debugging)
We welcome contributions from the community! If you find any issues or have ideas for enhancements, please submit bug reports, feature requests, or pull requests through our GitHub repository.
remult-cli
is licensed under the MIT License.