npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

create-aggain

v3.0.4

Published

Um gerador moderno de BFF com suporte para Express e Koa

Readme

🚀 create-aggain


✨ Features

🎯 Core

  • TypeScript - Type-safe por padrão
  • Express, Koa ou Deno - Escolha seu framework
  • Arquitetura Limpa - Controllers → Services → Models
  • Hot Reload - Desenvolvimento rápido com tsx watch

🔐 Autenticação & Segurança

  • JWT Authentication - Sistema completo de autenticação
  • Password Hashing - bcrypt para senhas
  • Rate Limiting - Proteção contra DDoS
  • CORS & Helmet - Segurança de headers
  • Validação com Zod - Validação de dados robusta

🗄️ Banco de Dados

  • MongoDB - com Mongoose
  • PostgreSQL - com TypeORM
  • MySQL - com TypeORM
  • CRUD Completo - Templates prontos

📚 Developer Experience

  • Swagger UI - Documentação automática
  • Winston Logger - Logging estruturado
  • Error Handling - Classes de erro personalizadas
  • Health Checks - Endpoints /health e /ready
  • Environment Config - Gerenciamento de .env

🐳 DevOps

  • Docker & Docker Compose - Containerização pronta
  • Jest + Supertest - Suite de testes configurada
  • ESLint + Prettier - Code quality
  • CI/CD Ready - Pronto para deploy

🚀 Quick Start

Instalação Rápida

# API completa com MongoDB e autenticação
npx create-aggain minha-api -f express -d mongodb --docker

cd minha-api
npm install
npm run dev

Acesse:

  • API: http://localhost:3000
  • Docs: http://localhost:3000/api-docs
  • Health: http://localhost:3000/health

Mais Exemplos

# API com PostgreSQL
npx create-aggain minha-api -f express -d postgresql

# API simples (sem banco de dados)
npx create-aggain minha-api -f express

# API com Koa e MySQL
npx create-aggain minha-api -f koa -d mysql --docker --tests

# API Deno
npx create-aggain minha-api -f deno

📖 Documentação Completa

📚 Leia a Documentação Completa - Guia detalhado com exemplos e melhores práticas

Conteúdo da Documentação


🎯 O que é Gerado?

Estrutura Completa

meu-projeto/
├── src/
│   ├── config/              # Configurações (env, swagger)
│   ├── controllers/         # Controllers REST
│   ├── services/            # Lógica de negócio
│   ├── models/              # Models do banco (quando selecionado)
│   ├── routes/              # Rotas da API
│   ├── middlewares/         # Auth, validation, error
│   ├── utils/               # Logger, errors, database
│   └── index.ts             # Entry point
├── tests/                   # Testes com Jest
├── .env                     # Variáveis de ambiente
├── .env.example             # Template de .env
├── docker-compose.yml       # Docker Compose (opcional)
├── Dockerfile               # Dockerfile (opcional)
└── README.md                # Documentação do projeto

Endpoints Gerados

Health Checks:

  • GET /health - Status da aplicação
  • GET /ready - Readiness probe

Auth (quando banco selecionado):

  • POST /api/auth/register - Registrar usuário
  • POST /api/auth/login - Login

Users (quando banco selecionado):

  • GET /api/users - Listar usuários (protegido)
  • GET /api/users/:id - Buscar por ID (protegido)
  • POST /api/users - Criar usuário
  • PUT /api/users/:id - Atualizar (protegido)
  • DELETE /api/users/:id - Deletar (protegido)

Docs:

  • GET /api-docs - Swagger UI

🔧 Geração Incremental de Recursos

Após criar seu projeto, você pode gerar recursos adicionais usando o comando aggain-generate:

Comandos Disponíveis

# Após npm install, você pode usar qualquer uma das formas abaixo:

# Usando npm run generate
npm run generate crud product

# Ou usando npx diretamente
npx aggain-generate crud product

# Exemplos de outros comandos:

# Gerar uma rota
npm run generate route user

# Gerar um controller
npm run generate controller product

# Gerar um service
npm run generate service order

# Gerar um model
npm run generate model customer

# Gerar um middleware
npm run generate middleware auth

# Gerar um teste
npm run generate test user

# Gerar CRUD completo (model + service + controller + route + test)
npm run generate crud product

Exemplos Práticos

1. Criar recurso completo de Produtos:

cd meu-projeto
npm install  # Certifique-se de ter as dependências instaladas
npm run generate crud product

Isso criará:

  • src/models/product.model.ts
  • src/services/product.service.ts
  • src/controllers/product.controller.ts
  • src/routes/product.routes.ts
  • tests/product.test.ts

2. Adicionar rota customizada:

npm run generate route payment
npm run generate controller payment

3. Criar middleware de autenticação:

npm run generate middleware authorization

Especificar Framework

Por padrão, o comando detecta o framework do projeto automaticamente. Você também pode especificar:

npm run generate route user -- -f express
npm run generate route user -- -f koa

Nota: O -- é necessário quando você passa argumentos adicionais através de npm run.


🛠️ Requisitos

  • Node.js >= 18.0.0
  • npm >= 7.0.0 ou yarn >= 1.22.0
  • Docker (opcional, para desenvolvimento com containers)

⚙️ Opções de CLI

create-aggain <nome-do-projeto> [opções]

| Opção | Alias | Valores | Padrão | Descrição | |-------|-------|---------|--------|-----------| | --framework | -f | express, koa, deno | express | Framework web | | --database | -d | mongodb, postgresql, mysql | - | Banco de dados | | --port | -p | 1-65535 | 3000 | Porta do servidor | | --typescript | - | boolean | true | Usar TypeScript | | --tests | - | boolean | true | Incluir testes | | --docker | - | boolean | false | Incluir Docker |


📦 Stack Tecnológica

Backend

  • Express.js / Koa / Deno - Framework web
  • TypeScript - Type safety
  • Zod - Validação de schema
  • Winston - Logging

Database

  • Mongoose - MongoDB ODM
  • TypeORM - PostgreSQL/MySQL ORM
  • bcrypt - Password hashing

Security

  • jsonwebtoken - JWT authentication
  • helmet - Security headers
  • cors - CORS middleware
  • express-rate-limit - Rate limiting

DevTools

  • Jest - Testing framework
  • Supertest - HTTP testing
  • ESLint - Linting
  • Prettier - Code formatting
  • tsx - TypeScript execution

Docs

  • Swagger JSDoc - OpenAPI generation
  • Swagger UI Express - Interactive API docs

💡 Casos de Uso

  • MVPs e Protótipos - Start rápido com estrutura profissional
  • APIs REST - Backend para aplicações web/mobile
  • Microserviços - Serviços isolados e escaláveis
  • BFF (Backend for Frontend) - Camada entre frontend e serviços
  • Hackathons - Setup rápido para competições
  • Aprendizado - Estrutura de referência para estudos

🤝 Contribuindo

Contribuições são bem-vindas! Veja nosso Guia de Contribuição.

Como Contribuir

  1. Fork o projeto
  2. Crie uma branch (git checkout -b feature/MinhaFeature)
  3. Commit suas mudanças (git commit -m 'feat: adiciona MinhaFeature')
  4. Push para o branch (git push origin feature/MinhaFeature)
  5. Abra um Pull Request

Convenções


📊 Status do Projeto

  • ✅ Express Generator - Completo
  • ✅ MongoDB Integration - Completo
  • ✅ PostgreSQL Integration - Completo
  • ✅ MySQL Integration - Completo
  • ✅ JWT Authentication - Completo
  • ✅ Swagger Documentation - Completo
  • ⚠️ Koa Generator - Parcial
  • ⚠️ Deno Generator - Parcial

📝 Exemplos Reais

Exemplo 1: E-commerce API

npx create-aggain ecommerce-api \
  -f express \
  -d mongodb \
  --docker \
  --tests

cd ecommerce-api
npm install
docker-compose up -d
npm run dev

Exemplo 2: Blog API

npx create-aggain blog-api \
  -f express \
  -d postgresql \
  -p 4000

cd blog-api
npm install
npm run dev

Exemplo 3: Auth Service

npx create-aggain auth-service \
  -f koa \
  -d mongodb \
  --docker

cd auth-service
npm install
docker-compose up -d
npm run dev

🌟 Showcase

Projetos criados com create-aggain:

  • 🏪 E-commerce Backend - API completa para loja online
  • 📱 Social Network API - Backend para rede social
  • 📚 Learning Platform - API de plataforma educacional
  • 💬 Chat Service - Serviço de mensagens em tempo real

Quer adicionar seu projeto aqui? Abra uma issue!


📄 Licença

MIT © create-aggain


🙏 Agradecimentos

Desenvolvido com ❤️ para a comunidade de desenvolvedores