# generator-jkv2

> Opinionated Yeoman generator for full-stack mono-repo TypeScript projects.

Latest version **0.1.2** (published 2021-01-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install generator-jkv2
pnpm add generator-jkv2
yarn add generator-jkv2
bun add generator-jkv2
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2021-01-15 |
| First published | 2020-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 169.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dmytro Yankovskyi |
| Maintainers | dizzzmas |
| Keywords | yeoman-generator |

## Links

- npm: https://www.npmjs.com/package/generator-jkv2
- Repository: https://github.com/jetbridge/generator-jkv2
- Homepage: https://github.com/jetbridge/generator-jkv2#readme
- Issues: https://github.com/jetbridge/generator-jkv2/issues
- npm.io page: https://npm.io/package/generator-jkv2

## Dependencies (8)

- [yaml](https://npm.io/package/yaml.md) ^1.10.0
- [ts-morph](https://npm.io/package/ts-morph.md) ^9.1.0
- [camelcase](https://npm.io/package/camelcase.md) ^6.2.0
- [pluralize](https://npm.io/package/pluralize.md) ^8.0.0
- [kebab-case](https://npm.io/package/kebab-case.md) ^1.0.0
- [typescript](https://npm.io/package/typescript.md) ^4.1.3
- [prepend-file](https://npm.io/package/prepend-file.md) ^2.0.0
- [yeoman-generator](https://npm.io/package/yeoman-generator.md) ^1.1.1

## Recent versions

- 0.1.2 (latest) — 2021-01-15
- 0.1.1 — 2021-01-10
- 0.1.0 — 2020-12-27

## README

# JKv2 Yeoman generator
Opinionated generator for mono-repo web apps.

Features:
- Monorepo with npm7 workspaces (backend, core, frontend)
- No framework. Plain Typescript functions and API Gateway routing to Lambdas running in VPC
- TypeORM & Postgres
- Cognito

## Quickstart

### Pre-requisites
* npm 7
* yeoman
* jkv2 generator

```shell
npm i -g npm@7 yo generator-jkv2
yo jkv2
```

### Useful commands
- `yo jkv2:model`  # Create a new TypeORM model and CRUD for it

- `yo jkv2:api`  # Create a new API endpoint for a model

- `npm run db:init:local`  # Re-creates local DB, migrates and seeds it

- `npm run db:migrate:generate -n $name`  # Create a new migrations

- `npm run sls:deploy:dev`  # Deploy to the dev environment


### AWS services schema
![](public/servicesSchema.png)

### VPC/Aurora Data API
Currently VPC connection is recommended.

It offers DB driver that doesn’t have problems with types unlike the one used by Aurora Data API. However using it is a bit more pricy and there are problems with Lambda timeouts after hitting 10 requests per second on a Lambda.
Once the Data API is somewhat more mature we should consider switching to it.

### API validation/serialization
[lambda-middleware](https://dbartholomae.github.io/lambda-middleware/) and [class-validator](https://github.com/typestack/class-validator) packages are used for incoming request body validation.

Currently when serializing responses there’s no option to exclude unwanted fields.

### Setting up Cognito
In your `.env.local` or in your env variables config on e.g. Netlify you'll have to assign the following env variables:
```shell
REACT_APP_COGNITO_IDENTITY_POOL_ID,
REACT_APP_COGNITO_REGION,
REACT_APP_COGNITO_IDENTITY_POOL_REGION,
REACT_APP_COGNITO_USER_POOL_ID,
REACT_APP_COGNITO_USER_POOL_APP_CLIENT_ID,
REACT_APP_API_REGION
```
To find some of the values you should login to your aws account

`REACT_APP_COGNITO_USER_POOL_ID`
![](public/settingUpCognito/how_to_get_cognito_pool_id.png)

`REACT_APP_COGNITO_USER_POOL_APP_CLIENT_ID`
![](public/settingUpCognito/how_to_get_cognito_app_client_id.png)

`REACT_APP_IDENTITY_POOL_ID`
![](public/settingUpCognito/how_to_get_cognito_identity_pool_id.png)

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