# @shotero/gen-api

> ObjectionJS model and api generator from database

Latest version **0.1.6** (published 2022-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @shotero/gen-api
pnpm add @shotero/gen-api
yarn add @shotero/gen-api
bun add @shotero/gen-api
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2022-09-20 |
| First published | 2022-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 18 |
| Dependencies | 4 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | shotero |
| Maintainers | lemonchiffon |
| Keywords | postgresql, db, objectionjs |

## Links

- npm: https://www.npmjs.com/package/@shotero/gen-api
- Repository: https://github.com/shotero/gen-api
- Issues: https://github.com/shotero/gen-api/issues
- npm.io page: https://npm.io/package/@shotero/gen-api

## Dependencies (4)

- [pluralize](https://npm.io/package/pluralize.md) ^8.0.0
- [cosmiconfig](https://npm.io/package/cosmiconfig.md) ^7.0.1
- [pg-structure](https://npm.io/package/pg-structure.md) ^7.13.0
- [@shotero/gen-schema](https://npm.io/package/@shotero/gen-schema.md) ^0.0.1

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [btrz-health-check](https://npm.io/package/btrz-health-check.md) — 474 weekly downloads

## Recent versions

- 0.1.6 (latest) — 2022-09-20
- 0.1.5 — 2022-09-20
- 0.1.4 — 2022-09-20
- 0.1.3 — 2022-09-20
- 0.1.2 — 2022-09-20

## README

# Gen API

Generate ObjectionJS models automatically from postgresql database

## Install

`npm install @shotero/gen-api`

## Usage

- Create configuration(checkout sample config)
- Create a generator script in your project repository with the following content

```js
import { generate } from '@shotero/gen-api';

generate();
```

Run the script

## Example project:

https://github.com/shotero/mates-backend

## Configuration

> .generatorrc.js

```js
module.exports = {
  baseUrl: 'https://myproject.com',
  schemaVersion: 'http://json-schema.org/draft-07/schema#',
  generate: {
    controller: true,
    route: true
  },
  paths: {
    import: '#api',
    write: process.cwd()
  },
  db: {
    database: 'mydb',
    user: 'me'
  },
  schemas: [
    {
      name: 'public',
      renames: {},
      ignores: ['hello']
    }
  ]
};
```

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