# genxdb

> GenXDB is a command-line interface tool that is used to design and generate models easily and quickly using the json format based on different orms such as TypeORM and Prisma

Latest version **2.2.0** (published 2024-03-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install genxdb
pnpm add genxdb
yarn add genxdb
bun add genxdb
```

Provides the command `genxdb`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2024-03-01 |
| First published | 2024-02-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 28.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Fiido |
| Maintainers | fiido |
| Keywords | cli, orm, typeorm, sequelize, prisma, mysql, postgresql, sqlserver |

## Links

- npm: https://www.npmjs.com/package/genxdb
- Repository: https://github.com/RBosio/genXDB
- Issues: https://github.com/RBosio/genXDB/issues
- npm.io page: https://npm.io/package/genxdb

## Dependencies (5)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [figlet](https://npm.io/package/figlet.md) ^1.7.0
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.5
- [inquirer](https://npm.io/package/inquirer.md) ^9.2.14
- [jsonfile](https://npm.io/package/jsonfile.md) ^6.1.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2024-03-01
- 2.1.0 — 2024-03-01
- 2.0.0 — 2024-03-01
- 1.2.4 — 2024-02-26
- 1.2.3 — 2024-02-26
- 1.2.2 — 2024-02-26
- 1.1.0 — 2024-02-15

## README

<div align="center">

<h1>GenXDB - The cli tool to generate models on different orms.</h1>

<p>
  <br>
  <img src="https://raw.githubusercontent.com/RBosio/genxdb/main/src/public/logo.png" alt="GenXDB logo" width="240px" height="240px"/>
  <br><br>
  <em>GenXDB is a command-line interface tool that is used to design and generate models easily and quickly<br> using the json format based on different orms such as TypeORM and Prisma</em>
  <br>
</p>

</div>

<hr>

## Development Setup

### Prerequisites

- Install [Node.js](https://nodejs.org/en) which includes [Node Package Manager][npm]

### Setting Up a Project

- Create a file in the project root dir named **genxdb.json**.

- Install GenXDB globally:

```
npm install -g genxdb
```

- Run the application:

```
genxdb
```

## Source file example

```json
{
  "database": [
    {
      "name": "user",
      "columns": [
        {
          "name": "id",
          "type": "number"
        },
        {
          "name": "name",
          "type": "string"
        },
        {
          "name": "surname",
          "type": "string",
          "nullable": true
        },
        {
          "name": "status",
          "type": "boolean",
          "default": true
        },
        {
          "name": "email",
          "type": "string",
          "unique": true
        },
        {
          "name": "password",
          "type": "string"
        },
        {
          "name": "created_at",
          "type": "Date",
          "default": "CURRENT_TIMESTAMP"
        }
      ],
      "primary": "id",
      "relations": [
        {
          "table": "task",
          "relation": "1-N"
        }
      ]
    },
    {
      "name": "task",
      "columns": [
        {
          "name": "id",
          "type": "number"
        },
        {
          "name": "name",
          "type": "string",
          "length": 150
        }
      ],
      "primary": "id",
      "relations": [
        {
          "table": "user",
          "relation": "N-1"
        }
      ]
    },
    {
      "name": "role",
      "columns": [
        {
          "name": "id",
          "type": "number"
        },
        {
          "name": "name",
          "type": "string"
        }
      ],
      "primary": "id",
      "relations": [
        {
          "table": "user",
          "relation": "N-M"
        }
      ]
    }
  ]
}
```

## Output files example

### user.entity.ts

<img src="https://raw.githubusercontent.com/RBosio/genxdb/main/src/public/user.png" alt="User entity" />

### task.entity.ts

<img src="https://raw.githubusercontent.com/RBosio/genxdb/main/src/public/task.png" alt="Task entity" />

### role.entity.ts

<img src="https://raw.githubusercontent.com/RBosio/genxdb/main/src/public/role.png" alt="Role entity" />

<div align="center">

## Relations

|     Name     | Type |
| :----------: | :--: |
|  One to one  | 1-1  |
| One to many  | 1-N  |
| Many to one  | N-1  |
| Many to many | N-M  |

</div>

## Author

👤**Rocco Bosio**

- Github: [@RBosio](https://github.com/RBosio)

## Contributing

Contributions, issues and feature requests are welcome!

Feel free to check [issues page](https://github.com/RBosio/genXDB/issues).

## Show your support

Give a ⭐️ if this project helped you!

## License

Copyright © 2024 [Rocco Bosio](https://github.com/RBosio).

This project is [MIT](https://github.com/RBosio/GenXDB/blob/main/LICENSE) licensed.

---
_Source: https://npm.io/package/genxdb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
