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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@oxlayer/create-backend

v0.1.4

Published

Scaffold a new OxLayer backend API with PostgreSQL, Redis, RabbitMQ, and observability

Downloads

233

Readme

@oxlayer/create-backend

Scaffold a new OxLayer backend API with full observability stack.

Features

Generated backend includes:

  • PostgreSQL - Database with Drizzle ORM and auto-migration
  • Redis - Caching layer
  • RabbitMQ - Event bus for domain events
  • OpenTelemetry - Metrics and tracing (Prometheus + Jaeger)
  • Grafana - Pre-configured dashboards
  • k6 - Performance testing suite
  • OpenAPI - Interactive documentation (Scalar UI)
  • Test Infrastructure - Builders, fixtures, and mocks

Usage

Interactive Mode

npx @oxlayer/create-backend my-api

Quick Mode (Defaults)

npx @oxlayer/create-backend my-api --defaults

What Gets Created

my-api/
├── src/
│   ├── config/              # Configuration modules
│   │   ├── app.config.ts
│   │   ├── postgres.config.ts
│   │   ├── redis.config.ts
│   │   ├── rabbitmq.config.ts
│   │   ├── metrics.config.ts
│   │   ├── logging.config.ts
│   │   ├── openapi.config.ts
│   │   └── index.ts
│   ├── controllers/         # HTTP handlers
│   │   └── items.controller.ts
│   ├── db/                 # Database schema
│   ├── domain/             # Domain entities & events
│   │   ├── item.ts
│   │   └── events.ts
│   ├── infrastructure/     # DI container
│   │   └── container.ts
│   ├── repositories/       # Data access layer
│   │   └── item.repository.ts
│   ├── use-cases/          # Business logic
│   │   ├── create-item.usecase.ts
│   │   ├── list-items.usecase.ts
│   │   ├── get-item.usecase.ts
│   │   ├── update-item.usecase.ts
│   │   ├── delete-item.usecase.ts
│   │   └── index.ts
│   ├── __tests__/          # Unit & integration tests
│   │   ├── unit/
│   │   └── integration/
│   └── test/               # Test utilities
│       ├── builders/       # Test data builders
│       ├── fixtures/       # Test fixtures
│       └── mocks/          # Mock implementations
├── grafana/               # Grafana dashboards
│   └── provisioning/
├── perf-tests/            # k6 performance tests
├── docker-compose.yml     # Full infrastructure
├── package.json
├── tsconfig.json
├── .env.example
└── README.md

Tenancy template (multi-tenant)

npx @oxlayer/create-backend my-api --template tenancy

Generated Commands

cd my-api
pnpm install
pnpm dev        # Start development server
pnpm test       # Run tests
pnpm build      # Build for production

Infrastructure

Generated docker-compose.yml includes:

  • PostgreSQL 15
  • Redis 7
  • RabbitMQ 3 (with management UI)
  • Prometheus
  • Grafana
  • Jaeger
  • OpenTelemetry Collector
  • Quickwit (logs)

Start all services:

docker-compose up -d

API Endpoints

  • GET /health - Health check
  • GET /docs - Interactive API documentation (Scalar UI)
  • GET /openapi.json - OpenAPI specification
  • GET /metrics - Prometheus metrics
  • GET /api/items - List items (example)
  • POST /api/items - Create item (example)
  • etc.

Performance Tests

# Quick smoke test (30s)
k6 run perf-tests/quick-test.js

# Full load test (up to 3000 RPS)
k6 run perf-tests/load-test.js

# Soak test (1 hour, memory leak detection)
k6 run perf-tests/soak-test.js

Observability

  • Grafana: http://localhost:3000 (admin/admin)
  • Prometheus: http://localhost:9090
  • Jaeger: http://localhost:16686
  • RabbitMQ UI: http://localhost:15672 (guest/guest)
  • API Docs: http://localhost:3001/docs

Example Usage

After scaffolding:

cd my-api
pnpm install
pnpm dev

The example includes:

  • Item entity with CRUD operations
  • Domain events (Item.Created, Item.Updated, Item.Deleted)
  • Repository pattern using PostgresRepositoryTemplate
  • Use case pattern (CreateUseCaseTemplate, ListUseCaseTemplate, etc.)
  • Controller extending BaseController with Zod validation
  • Test infrastructure with builders, fixtures, and mocks
  • OpenAPI documentation with schemas and paths
  • Performance tests for load and soak testing
  • Grafana dashboards for metrics

Templates

The generator uses templates located in template/ with placeholder variables:

  • {{PROJECT_NAME}} - Project title case name
  • {{PROJECT_SLUG}} - URL-safe project name
  • {{PROJECT_DESCRIPTION}} - Project description
  • {{PROJECT_AUTHOR}} - Author name
  • {{PORT}} - API port
  • {{DB_NAME}} - Database name

Development

# Install dependencies
pnpm install

# Build CLI
pnpm build

# Test CLI locally
node dist/index.js test-api

License

MIT