Skip to content
forked from dryerjs/dryerjs

A framework to make graphql server with mongodb development faster.

License

Notifications You must be signed in to change notification settings

bachhm-dev/dryerjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DryerJS Logo

DryerJS is a powerful library that allows you to generate CRUD GraphQL APIs in a declarative way, seamlessly integrating with Apollo Server, Mongoose, and MongoDB. With DryerJS, you can streamline the development of your GraphQL APIs and focus on your application's logic instead of writing repetitive boilerplate code.

codecov Build Status Release Status npm version License Discord Paypal

Features

  • Declarative schema definition for GraphQL APIs.
  • Integration with Apollo Server for GraphQL endpoint setup.
  • Seamless interaction with MongoDB and Mongoose.
  • Fine-grained control over input/output data transformation.
  • Support for input validation and data manipulation.
  • Easily customizable to fit your specific needs.

Getting Started

To get started with DryerJS, follow these steps:

  1. Init NestJS project:

    npm i -g @nestjs/cli && nest new my-project
  2. Install dependencies:

    npm i @nestjs/graphql @nestjs/apollo @apollo/server class-transformer class-validator @nestjs/mongoose
  3. Install DryerJS as a dependency in your project

    npm install dryerjs
  4. Declare your first model on src/user.ts:

    import { Definition, Property } from 'dryerjs';
    
    @Definition()
    export class User {
      @Property()
      id: string;
    
      @Property()
      email: string;
    
      @Property()
      password: string;
    
      @Property()
      name: string;
    }
  5. Import your model and DryerJSModule in AppModule with other modules inside app.module.ts:

    import { Module } from '@nestjs/common';
    import { GraphQLModule } from '@nestjs/graphql';
    import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
    import { MongooseModule } from '@nestjs/mongoose';
    import { DryerModule } from 'dryerjs';
    
    import { User } from './user';
    
    @Module({
      imports: [
        GraphQLModule.forRoot<ApolloDriverConfig>({
          driver: ApolloDriver,
          autoSchemaFile: true,
          playground: true,
        }),
        MongooseModule.forRoot('mongodb://127.0.0.1:27017/test'),
        DryerModule.register({ definitions: [User] }),
      ],
    })
    export class AppModule {}
  6. Start server

    npm run start:dev
  7. Open browser and go to http://localhost:3000/graphql to see the GraphQL playground.

  8. Modify your model and see the changes in the GraphQL playground. Using Validate, Transform, Default, Enum, Embedded features to customize your model. Take a look at more complicated example models.

Documentation

We are actively working on documentation. In the meantime, you can explore our example project to see DryerJS in action.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A framework to make graphql server with mongodb development faster.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 76.9%
  • JavaScript 23.0%
  • Shell 0.1%