npm.io
11.2.4 • Published 2 weeks ago

@vsaas/loopback

Licence
MIT
Version
11.2.4
Deps
13
Size
323 kB
Vulns
0
Weekly
0

@vsaas/loopback

@vsaas/loopback is a fork of loopback focused on keeping LoopBack 3 style applications running while reducing maintenance overhead.

The goal of this fork is practical compatibility for the common upstream use cases, not byte-for-byte preservation of the original package. The internals were intentionally simplified and modernized:

  • TypeScript source with build output in dist/
  • English-only messages
  • no i18n catalogs or strong-globalize
  • no legacy browser bundling surface
  • public legacy subpaths preserved through exports even though the old root .js wrappers were removed
  • modern tooling with tsdown, vitest, and oxlint
  • callback-compatible APIs that continue to work with Promise and async/await

Installation

npm install @vsaas/loopback

If you are also using the related forks, pair it with @vsaas/loopback-boot, @vsaas/loopback-datasource-juggler, and @vsaas/remoting.

Quick start

const loopback = require('@vsaas/loopback');

const app = loopback();

app.dataSource('db', {
  connector: 'memory',
});

const Product = app.registry.createModel('Product', {
  name: String,
  price: Number,
});

app.model(Product, {
  dataSource: 'db',
  public: true,
});

app.use('/api', loopback.rest());
app.listen(3000);

Scope

This package still provides the main building blocks existing loopback users expect:

  • the LoopBack application factory and Express integration
  • built-in models such as User, AccessToken, ACL, Role, and Application
  • registry, datasource, and model wiring on top of @vsaas/loopback-datasource-juggler
  • REST middleware and remoting integration used by LoopBack 3 applications
  • compatibility with loopback-boot application layouts and convention-based model loading

If you are migrating an existing codebase, the intent is that the public API should feel familiar even though the implementation is leaner.

Supported Surface

The supported application-facing surface intentionally includes:

  • the main entrypoint: require('@vsaas/loopback')
  • application creation via loopback()
  • middleware exports such as loopback.rest(), loopback.static(), loopback.token(), loopback.status(), loopback.urlNotFound(), and loopback.favicon()
  • built-in models, registry helpers, and datasource helpers exposed from the main module
  • package subpaths used by LoopBack 3 apps and boot scripts: @vsaas/loopback/common/models/*.json, @vsaas/loopback/common/models/*.js, @vsaas/loopback/lib/*.js, and @vsaas/loopback/server/middleware/*.js

Those legacy-looking .js subpaths are still supported for compatibility, but they now resolve to compiled files in dist/ via package.json exports.

Email Transport Configuration

The built-in email datasource continues to use Nodemailer under the hood.

Built-in Nodemailer transport types supported directly by this package:

  • smtp
  • sendmail
  • ses
  • stream
  • json

LoopBack compatibility transport types also preserved by this fork:

  • direct
  • stub

Unknown transport types still follow the legacy plugin convention and try to load nodemailer-<type>-transport. For example, type: 'mailgun' expects nodemailer-mailgun-transport to be installed. This means supported built-ins do not require extra transport packages, while typos or unsupported custom types still fail fast with a module resolution error.

SMTP example
app.dataSource('email', {
  connector: loopback.Mail,
  transport: {
    type: 'smtp',
    host: 'smtp.example.com',
    port: 587,
    secure: false,
    auth: {
      user: process.env.SMTP_USER,
      pass: process.env.SMTP_PASSWORD,
    },
  },
});
SES example

type: 'ses' uses Nodemailer's built-in SES transport with @aws-sdk/client-sesv2. You can either pass a prebuilt SES config, provide sesClient plus SendEmailCommand, or rely on the default AWS credential chain.

app.dataSource('email', {
  connector: loopback.Mail,
  transport: {
    type: 'ses',
    region: process.env.AWS_REGION,
  },
});
Stream and JSON examples

These transports are useful for tests, previews, or custom delivery pipelines because they generate the message without sending it.

app.dataSource('email', {
  connector: loopback.Mail,
  transport: {
    type: 'stream',
    buffer: true,
  },
});
app.dataSource('email', {
  connector: loopback.Mail,
  transport: {
    type: 'json',
    skipEncoding: true,
  },
});

All other Nodemailer transport-specific options are passed through to nodemailer.createTransport() after the LoopBack-specific type and alias fields are normalized.

Notes for Fork Users

  • This is a maintained fork, not the upstream package.
  • Messages are English-only by design.
  • The old root runtime wrappers were removed as implementation details, but supported package entrypoints remain exported.
  • Browser-specific packaging from upstream is not part of the maintained surface.
  • The test entrypoint is vitest, while the large legacy suite still runs underneath for compatibility.

Development

npm run build
npm run typecheck
npm run lint
npm test

License

MIT. See LICENSE.

Keywords