All Projects β†’ whats-good β†’ uniform-graphql

whats-good / uniform-graphql

Licence: other
Code-first GraphQL apis in TypeScript with complete & robust end-to-end type safety.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to uniform-graphql

graphql-sequelize-generator
A Graphql API generator based on Sequelize.
Stars: ✭ 20 (-54.55%)
Mutual labels:  resolvers, graphql-api
strapi-graphql-documentation
Collections of queries and mutations that hopefully help you in a Strapi project powered by GraphQL API πŸš€
Stars: ✭ 45 (+2.27%)
Mutual labels:  graphql-api
Aws Appsync React Workshop
Building real-time offline-ready Applications with React, GraphQL & AWS AppSync
Stars: ✭ 193 (+338.64%)
Mutual labels:  graphql-api
open-soql
Open source implementation of the SOQL.
Stars: ✭ 15 (-65.91%)
Mutual labels:  resolvers
Rails Devise Graphql
A Rails 6 boilerplate to create your next Saas product. Preloaded with graphQL, devise, JWT, CanCanCan, RailsAdmin, Rubocop, Rspec, i18n and more.
Stars: ✭ 199 (+352.27%)
Mutual labels:  graphql-api
Graphql Code Generator
A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
Stars: ✭ 7,993 (+18065.91%)
Mutual labels:  resolvers
Gqlify
[NOT MAINTAINED]An API integration framework using GraphQL
Stars: ✭ 182 (+313.64%)
Mutual labels:  graphql-api
graphql-pokeapi
πŸ”΄ The Unofficial GraphQL for PokeAPI
Stars: ✭ 137 (+211.36%)
Mutual labels:  graphql-api
DotNetGraphQL
A sample demonstrating how to create a GraphQL Backend in .NET and consume it from a .NET mobile app created using Xamarin
Stars: ✭ 78 (+77.27%)
Mutual labels:  graphql-api
GraphQL.RepoDB
A set of extensions for working with HotChocolate GraphQL and Database access with micro-orms such as RepoDb (or Dapper). This extension pack provides access to key elements such as Selections/Projections, Sort arguments, & Paging arguments in a significantly simplified facade so this logic can be leveraged in the Serivces/Repositories that enca…
Stars: ✭ 25 (-43.18%)
Mutual labels:  resolvers
36 Graphql Concepts
πŸ“œ 36 concepts every GraphQL developer should know.
Stars: ✭ 209 (+375%)
Mutual labels:  graphql-api
Graphqlize
A Clojure & JVM library for developing GraphQL API instantly from Postgres and MySQL databases
Stars: ✭ 240 (+445.45%)
Mutual labels:  graphql-api
Apollo Server
🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.
Stars: ✭ 12,145 (+27502.27%)
Mutual labels:  resolvers
Grial
A Node.js framework for creating GraphQL API servers easily and without a lot of boilerplate.
Stars: ✭ 194 (+340.91%)
Mutual labels:  graphql-api
react-apollo-form
Build React forms based on GraphQL APIs.
Stars: ✭ 195 (+343.18%)
Mutual labels:  graphql-api
Graphql Spqr Spring Boot Starter
Spring Boot 2 starter powered by GraphQL SPQR
Stars: ✭ 187 (+325%)
Mutual labels:  graphql-api
Type Graphql
Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
Stars: ✭ 6,864 (+15500%)
Mutual labels:  resolvers
graphql-dependency
Cross service dependencies for GraphQL API with underlying @imqueue services
Stars: ✭ 17 (-61.36%)
Mutual labels:  graphql-api
documentation-site
This repository contains source for TravelgateX documentation. TravelgateX is a collection of GraphQL APIs for the travel trade.
Stars: ✭ 17 (-61.36%)
Mutual labels:  graphql-api
gnt
🍸 GraphQL Normalized Types
Stars: ✭ 32 (-27.27%)
Mutual labels:  graphql-types

UniformGraphQL

Version Documentation Maintenance License: MIT

Code-first GraphQL apis in TypeScript with complete & robust end-to-end type safety.

🏠 Docs: https://uniform-graphql.whatsgood.dog

Features

  • 🀝 Uniform type system: write once in TypeScript, get GraphQL schema for free.
  • πŸ‘¨β€πŸ’» Code-first by default, but can be partially used as schema-first.
  • πŸš€ No code generation. Your code becomes instantly usable.
  • πŸ”¬ Sophisticated type system adjusted to the complexities of GraphQL.
  • πŸ’‘ Single source of truth for your api.
  • 😌 No manual typecasting, no decorators, no runtime type checking.

⚠️ Disclaimer: This is a very young and unstable library. We’re still at v0. We have a pretty robust core, but everything is subject to change.

Install

npm install @whatsgood/uniform-graphql

⚠️ graphql is a peer dependency

Examples

Go to the examples directory to see a demo

Quick Start

import { t, SchemaBuilder } from '@whatsgood/uniform-graphql';
import { ApolloServer } from 'apollo-server-express';
import express from 'express';

const Membership = t.enum({
  name: 'Membership',
  values: {
    free: null,
    paid: null,
    enterprise: null,
  },
});

const Animal = t.object({
  name: 'Animal',
  fields: {
    id: t.id,
    age: t.integer,
    name: t.string,
  },
});

const User = t.object({
  name: 'User',
  fields: {
    id: t.id,
    fullName: t.string.nullable,
    membership: Membership,
    pets: t.list(Animal),
  },
});

const schemaBuilder = new SchemaBuilder();

schemaBuilder.query('user', {
  type: User,
  args: {
    id: t.id,
  },
  resolve: async (_, args, context) => {
    return {
      id: args.id,
      fullName: () => 'John Johnson',
      membership: 'enterprise' as const,
      pets: async () => [
        {
          name: 'Lulu',
          id: 'cat-1',
          age: 10,
        },
      ],
    };
  },
});

schemaBuilder.mutation('signup', {
  type: User,
  args: {
    email: t.string,
  },
  resolve: (_, args, context) => {
    return {
      id: 'newly signedup user id',
      fullName: 'newly signed up user name',
      membership: 'free' as const,
      pets: [],
    };
  },
});

schemaBuilder.fieldResolvers(User, {
  fullName: async (root) => {
    return 'overriding fullname';
  },
});

const apolloServer = new ApolloServer({
  schema: schemaBuilder.getSchema();
});

const PORT = 4001;

const app = express();
apolloServer.applyMiddleware({ app });

app.listen({ port: PORT }, () => {
  console.log(
    `πŸš€ Server ready at http://localhost:${PORT}${apolloServer.graphqlPath}`,
  );
});

Recommended TSConfig

{
  "compilerOptions": {
    "target": "es2018",
    "module": "commonjs",
    "lib": ["es2018", "esnext.asynciterable"],
    "strict": true
  }
}

Roadmap

  • Stabilize the t.scalar type factory
  • IOC & containers
  • Documentation website
  • Write tests (There are none right now)
  • Design a logo (open to suggestions)
  • Argument validation
  • Remove lodash and become 0 dependency
  • Enable query building through the object syntax: t.query({ currentUser: ..., todos: ...}) instead of t.query('currentUser', ...)
  • Subscriptions support
  • Enable schema-first features: mock an api without implementing it.

Acknowledgements

uniform-graphql stands on the shoulders of 2 giants:

  1. type-graphql: This is arguably the strongest code-first GraphQL solution for TypeScript. The author is very friendly and helpful, and has managed to create and maintain a great community. I urge you to go check them out and say hi.

  2. io-ts: The techniques I’ve found in this library have truly opened my mind to the limitless potential of TypeScript. io-ts is the library that convinced me that this library was possible.

This library is type-graphql in substance and io-ts in form.

Author

πŸ‘€ Kerem Kazan

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].