Create enterprise level server-side TypeScript applications. For REST, GraphQL, and Microservices.
Write Apollo GraphQL resolvers in a OOP fashion with TypeScript decorators.
Lightweight Inversion of Control and Dependency Injection for TypeScript applications.
TCP-based Redis-like Pub/Sub type of message broker, almost configuration-less.
Framework
Node.js framework for backend applications.
- Modular
 - Setup REST endpoints in no time
 - Microservices
 
$ npx peque new project-nameimport { Controller, Get, Module, PequeFactory } from '@pequehq/framework';
@Controller('/test')
class MyController {
  @Get('/hello')
  hello() {
    return { test: 'hello world' };
  }
}
@Module({ controllers: [MyController] })
class MyModule {}
const webserver = PequeFactory.createServer({
  cors: true,
  isCpuClustered: false,
  rootModule: MyModule,
});
webserver.start();GraphQL
OOP transposition of Apollo Server resolvers.
- Code resolvers in an OOP fashion
 - Use decorators like @Query() and @Mutation()
 - Easy testable
 
$ npm i @pequehq/graphql reflect-metadataimport { Resolver, ResolverService } from '@pequehq/graphql';
@Resolver()
class ResolverExample {
  @Query()
  countries(@Args('continent') continent: string): unknown {
    return [
      { id: 1, name: 'italy', continent: 'europe' },
      { id: 2, name: 'spain', continent: 'europe' },
      { id: 3, name: 'china', continent: 'asia' },
    ].filter((country) => country.continent === continent);
  }
}
const resolverService = new ResolverService();
const resolvers = resolverService.get([new ResolverExample()]);
// Add resolvers to your Apollo Server.IoC Container
TypeScript Dependency Injection.
- Easy dependency injection
 - Use it in backend or frontend apps
 - Full TypeScript support
 
$ npm i @pequehq/di reflect-metadataimport { Container, Injectable } from '@pequehq/di';
@Injectable()
class Foo {
  getPizza() {
    return 'pizza';
  }
}
@Injectable()
class Bar {
  constructor(private foo: Foo) {}
  
  test() {
    console.log(this.foo.getPizza())
  }
}
const DI = new Container();
DI.set(Foo, 'Foo');
DI.set(Bar, 'Bar');
DI.get<Bar>('Bar').test(); // prints "pizza"Message Broker
TCP-based Message Broker.
- Event-driven
 - Lightweight client dependency (< 100 KB)
 - Almost configuration-less
 
$ npx peque add smbimport { BrokerFactory } from '@pequehq/smb-broker';
const broker = new BrokerFactory().createBroker();
broker.create().then(() => {
  // things.
});import { BrokerClientFactory } from '@pequehq/smb-client';
const client = new BrokerClientFactory().make();
await client.connect({ connectionTimeout: 10000 });
client.subscribe('^topic', (command) => {
  console.log(command.action.message); // prints {"test":"message"}
});
client.message('topic', { test: 'message' });