New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@nl-framework/graphql

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nl-framework/graphql

GraphQL module for nl-framework with code-first schema generation and Apollo Federation support.

latest
npmnpm
Version
0.3.5
Version published
Maintainers
1
Created
Source

@nl-framework/graphql

Code-first GraphQL layer for the Nael Framework with resolver decorators, schema generation, and Apollo Federation support.

Installation

bun add @nl-framework/graphql graphql

Highlights

  • Resolver decorators – annotate queries, mutations, subscriptions, and field resolvers with expressive decorators.
  • Schema tooling – generate SDL from TypeScript metadata or stitch existing schemas with federation directives.
  • Input sanitization – arguments decorated with class-validator rules are transformed via class-transformer before resolvers execute, rejecting invalid payloads with BAD_USER_INPUT errors.
  • Module integration – register resolvers alongside providers using standard Nael modules.

Quick start

import { Module } from '@nl-framework/core';
import { Resolver, Query, Mutation, Args, InputType, Field } from '@nl-framework/graphql';
import { NaelFactory } from '@nl-framework/platform';
import { IsEmail, IsOptional, IsString, MinLength } from 'class-validator';

@InputType()
class CreateUserInput {
  @Field()
  @IsEmail()
  email!: string;

  @Field({ nullable: true })
  @IsOptional()
  @IsString()
  @MinLength(2)
  name?: string;
}

@Resolver('User')
class UsersResolver {
  private readonly users = new Map<string, { id: string; email: string; name?: string }>();

  @Query(() => [String])
  users() {
    return Array.from(this.users.values());
  }

  @Mutation(() => String)
  createUser(@Args('input', () => CreateUserInput) input: CreateUserInput) {
    const id = crypto.randomUUID();
    this.users.set(id, { id, email: input.email, name: input.name });
    return id;
  }
}

@Module({
  providers: [UsersResolver],
  resolvers: [UsersResolver],
})
class GraphqlModule {}

const app = await NaelFactory.create(GraphqlModule);
const { graphql } = await app.listen({ http: 4000 });
console.log('GraphQL ready at', graphql?.url ?? 'http://localhost:4000/graphql');

License

Apache-2.0

Keywords

bun

FAQs

Package last updated on 06 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts