Prisma 2+ generator to emit a JSON file that can be run with json-server

Overview

npm version npm HitCount npm

Logo

Prisma JSON Server Generator

A Prisma generator that automates creating a JSON file that can be run as a server from your Prisma schema.
Explore the options »

Report Bug · Request Feature

Buy Me A Coffee

Table of Contents

About The Project

Automatically generate a JSON file that can be run as a server from your Prisma Schema. Updates every time npx prisma generate runs.

Installation

Using npm:

 npm install prisma-json-server-generator

Using yarn:

 yarn add prisma-json-server-generator

Usage

1- Star this repo 😉

2- Add the generator to your Prisma schema

generator json_server {
  provider       = "prisma-json-server-generator"
  outputFileName = "jsonFile.json"
}

3- Install json-server

npm install -g json-server

4- Run npx prisma generate for the following schema.prisma, or your schema

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
  posts Post[]
}

model Post {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  title     String
  content   String?
  published Boolean  @default(false)
  viewCount Int      @default(0)
  author    User?    @relation(fields: [authorId], references: [id])
  authorId  Int?
}

5- Now you're ready to run your JSON server!

json-server --watch db.json

Additional Options

Option  Description Type  Default
output Output directory for the generated JSON server file string ./generated
outputFileName JSON output file name string db.json

Use additional options in the schema.prisma

generator json_server {
  provider       = "prisma-json-server-generator"
  output         = "./json-server"
}

Community

Stargazers repo roster for @omar-dulaimi/prisma-json-server-generator

Acknowledgement

Source of one of the icons used in making the logo: Json icons created by Smashicons - Flaticon

You might also like...

This is a library to alternate and self-host the Prisma Data Proxy (cloud.prisma.io)

This is a library to alternate and self-host the Prisma Data Proxy (cloud.prisma.io)

Alternative Prisma Data Proxy This is a library to alternate and self-host the Prisma Data Proxy (cloud.prisma.io). In order to deploy your project to

Dec 28, 2022

With this File Manager prepared for PHP/Js, you can perform all file operations on your server without any problems.

FileManager With this File Manager prepared for PHP/Js, you can perform all file operations on your server without any problems. Instead of downloadin

Sep 23, 2022

Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

Mar 29, 2022

Feel free to create new file, don't hesitate to pull your code, the most important thing is that the file name here must match your nickname so that file does not conflict with other people.

Hacktoberfest Indonesia Apa Itu Hacktoberfest ? Hacktoberfest adalah acara tahunan yang bertujuan untuk mendorong berkontribusi kedalam ekosistem open

Dec 15, 2022

Prisma Generator for Pothos Codegen.

Prisma Generator for Pothos Codegen.

Prisma Generator Pothos Codegen This is a prisma generator that auto generate all input types for Crud Operations to Pothos. Use it as args for crud o

Dec 22, 2022

MQTT broker that can run on any stream server

 MQTT broker that can run on any stream server

Nest.js MQTT broker that can run on any stream server Topics What is MQTT ? Installation Usage Handlers Events Methods Packets Middleware & Plugins De

Nov 26, 2022

Create a C# .NET core EntityFramework ORM from your schema.prisma file

A note of forewarning to the would-be user... This was a failure. I'm making a note here: huge regret. It's hard to overstate my dissatisfaction. 🍰 S

Dec 24, 2022

JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

Jan 4, 2023

TypeScript + Prisma + Express API Server 系统

TypeScript + Prisma + Express API Server 系统 一键化使用 Docker的应用 Graphql 基于Express的一键搭建模板 Makefile docker husky eslint lint-staged prettier TypeScript ts-n

Jul 13, 2022
Releases(0.2.0)
  • 0.2.0(Jul 13, 2022)

    What's Changed

    • Upgrade-to-prisma-4 by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-json-server-generator/pull/2

    Full Changelog: https://github.com/omar-dulaimi/prisma-json-server-generator/commits/0.2.0

    Source code(tar.gz)
    Source code(zip)
Owner
Omar Dulaimi
Full Stack Software Engineer
Omar Dulaimi
Prisma 2+ generator to emit Joi schemas from your Prisma schema

Prisma Joi Generator Automatically generate Joi schemas from your Prisma Schema, and use them to validate your API endpoints or any other use you have

Omar Dulaimi 26 Dec 24, 2022
Prisma +2 generator to emit a tRPC shield from your Prisma schema

Prisma tRPC Shield Generator Automatically generate a tRPC Shield from your Prisma Schema. Updates every time npx prisma generate runs. Table of Conte

Omar Dulaimi 27 Dec 24, 2022
Prisma 2+ generator to emit Zod schemas from your Prisma schema

Prisma Zod Generator Automatically generate Zod schemas from your Prisma Schema, and use them to validate your API endpoints or any other use you have

Omar Dulaimi 212 Dec 27, 2022
Prisma 2+ generator to emit fully implemented tRPC routers

Prisma tRPC Generator Automatically generate fully implemented tRPC routers from your Prisma Schema. This includes routers, app router and of course a

Omar Dulaimi 370 Jan 3, 2023
A NestJS module that allows you use Prisma, set up multiple Prisma services, and use multi-tenancy in each Prisma service.

NestJS Prisma Module Installation To use this package, first install it: npm i @sabinthedev/nestjs-prisma Basic Usage In order to use this package, yo

Sabin Adams 39 Dec 2, 2022
Types generator will help user to create TS types from JSON. Just paste your single object JSON the Types generator will auto-generate the interfaces for you. You can give a name for the root object

Types generator Types generator is a utility tool that will help User to create TS Interfaces from JSON. All you have to do is paste your single objec

Vineeth.TR 16 Dec 6, 2022
A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM deffiniation and appropriate file structure.

Welcome to function-stencil ?? A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM

Ben Smith 21 Jun 20, 2022
Run a command, watch the filesystem, stop the process on file change and then run the command again...

hubmon Run a command, watch the filesystem, stop the process on file change and then run the command again... Install You can install this command lin

Hubert SABLONNIÈRE 7 Jul 30, 2022
Serve file server with single zip file as file system in Deno.

zipland Serve file server with one-single zip file in Deno. Support zip just zip32 with deflated or uncompressed serving plaintext deflate Examples Yo

Yongwook Choi 18 Nov 2, 2022