JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q50328F
  • License MIT

Scaffolds NextJs API Route handlers in NestJs-like structure with react-query integration. Generate controllers, validation, DTOs and hooks.

Package Exports

  • @echemane/engines
  • @echemane/engines/bin/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@echemane/engines) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Engines

Scaffolds NextJs API Route handlers in NestJs-like structure with react-query integration. Generate controllers, validation, DTOs and hooks.

Installation

  1. install globally in your system
npm i -g @echemane/engines
  1. Install dependencies inside your current working directory
npm i next-api-decorators class-validator class-transformer path-to-regexp @tanstack/react-query
  1. Setup your QueryClientProvider. See @tanstack/react-query docs
  2. Set "experimentalDecorators": true, and "emitDecoratorMetadata": true in tsconfig.json
{
    "compilerOptions": {
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        ...
    },
}

Usage

engine create <name>

Generates engine which consist of the following; Data Transfer Objects (DTO) and REST Endpoints inside /page/api folder. See example below.

engine create product

Generate react-query hooks using --hooks or -h option

example:

engine create product -h

engine guard <name>

Generates next-api-decorator guard. example:

engine guard auth

This will generate AuthGuard inside src/engines/guards