open-index/open-npm huggingface dataset:
npm package: @nl-framework/core
Description: Core runtime for the nl-framework Bun ecosystem: dependency injection, module system, configuration, lifecycle.
Latest version: 0.3.5

# @nl-framework/core

Foundational runtime for the Nael Framework, providing dependency injection, module lifecycle management, configuration hooks, and bootstrap primitives.

## Installation

```bash
bun add @nl-framework/core reflect-metadata
```

Enable the Reflect metadata polyfill once near the process entry point:

```ts
import 'reflect-metadata';
```

## Highlights

- **Modular architecture** – compose applications from focused modules with predictable dependency graphs.
- **Lifecycle hooks** – implement `OnModuleInit` / `OnModuleDestroy` to manage external resources safely.
- **Configuration ready** – pair with `@nl-framework/config` for strongly typed configuration injection.

## Quick start

```ts
import 'reflect-metadata';
import { Application, Module, Injectable } from '@nl-framework/core';

@Injectable()
class HelloService {
  getGreeting(name: string) {
    return `Hello, ${name}!`;
  }
}

@Module({
  providers: [HelloService],
})
class AppModule {}

const app = await Application.create(AppModule);
await app.init();

const service = app.getApplicationContext().get(HelloService);
console.log(service.getGreeting('Nael Developer'));

await app.close();
```

## License

Apache-2.0
npm package: @nl-framework/graphql
Description: GraphQL module for nl-framework with code-first schema generation and Apollo Federation support.
Latest version: 0.3.5

# @nl-framework/graphql

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

## Installation

```bash
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

```ts
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
npm package: @nl-framework/http
Description: HTTP server adapter for nl-framework built on Bun, with routing, middleware, and controller integration.
Latest version: 0.3.5

# @nl-framework/http

HTTP routing primitives for the Nael Framework featuring controllers, route decorators, middleware, and guard integration.

## Installation

```bash
bun add @nl-framework/http
```

Import `reflect-metadata` in your entry point if you haven’t already:

```ts
import 'reflect-metadata';
```

## Highlights

- **Annotation-based routing** – declare controllers, routes, and guards using decorators like `@Controller`, `@Get`, and `@UseGuards`.
- **Request context** – access params, query, headers, and user state through typed handler signatures.
- **Automatic DTO validation** – request bodies annotated with class-validator rules are transformed with `class-transformer`, stripped of unknown properties, and rejected with a structured 400 response when invalid.
- **Auth-friendly** – pair with `@nl-framework/auth` to secure routes using session guards or middleware.

## Quick start

```ts
import { Controller, Get, Post, Body, Param } from '@nl-framework/http';
import { Module } from '@nl-framework/core';
import { bootstrapHttpApplication } from '@nl-framework/platform';
import { IsEmail, IsOptional, IsString } from 'class-validator';

class CreateUserDto {
  @IsEmail()
  email!: string;

  @IsOptional()
  @IsString()
  name?: string;
}

@Controller('/users')
class UsersController {
  private readonly users = new Map<string, { id: string; email: string; name?: string }>();

  @Get('/')
  list() {
    return Array.from(this.users.values());
  }

  @Get('/:id')
  findOne(@Param('id') id: string) {
    return this.users.get(id);
  }

  @Post('/')
  create(@Body() body: CreateUserDto) {
    const id = crypto.randomUUID();
    const user = { id, email: body.email, name: body.name };
    this.users.set(id, user);
    return user;
  }
}

@Module({ controllers: [UsersController] })
class AppModule {}

const app = await bootstrapHttpApplication(AppModule, { port: 3000 });
await app.start();
console.log('HTTP server ready on http://localhost:3000');
```

## License

Apache-2.0