Skip to content

ngxsmk-gatekeeperMiddleware Engine for Angular

Route and HTTP request protection through a composable middleware pattern

ngxsmk-gatekeeper

Quick Start โ€‹

Install the library:

bash
npm install ngxsmk-gatekeeper

Use in your Angular app:

typescript
import { provideGatekeeper, gatekeeperGuard } from 'ngxsmk-gatekeeper';
import { createAuthMiddleware } from 'ngxsmk-gatekeeper';

export const appConfig: ApplicationConfig = {
  providers: [
    provideRouter(routes),
    provideHttpClient(),
    provideGatekeeper({
      middlewares: [createAuthMiddleware()],
      onFail: '/login',
    }),
  ],
};

Protect your routes:

typescript
const routes: Routes = [
  {
    path: 'dashboard',
    component: DashboardComponent,
    canActivate: [gatekeeperGuard],
  },
];

What's New in v1.2.0 โ€‹

  • Angular 22 / TypeScript 6 Support - Toolchain upgraded to @angular/build@22, ng-packagr@22, and TypeScript 6.0. Tested across Angular 17-22.
  • Dedicated Testing Entry Point - All test helpers, mock contexts, and assertions now ship via the ngxsmk-gatekeeper/testing secondary entry point for tree-shakeable, test-only imports.
  • Cache Middleware next Option - createCacheMiddleware can wrap a downstream middleware and cache its allow/deny result (see cacheOnlySuccess).
  • Expanded Test Coverage - Comprehensive unit tests for the Gatekeeper Agent and core middleware (97+ tests passing).

What Problem Does It Solve? โ€‹

Angular applications often need to protect routes and HTTP requests based on authentication, authorization, feature flags, or other business logic. ngxsmk-gatekeeper provides:

  • โœ… A unified middleware pattern for both route and HTTP protection
  • โœ… Composable middleware functions that can be chained together
  • โœ… A single configuration that applies to both routes and HTTP requests
  • โœ… Support for synchronous, Promise-based, and Observable-based middleware
  • โœ… Built-in middleware examples for common scenarios

Fully Open Source โ€‹

ngxsmk-gatekeeper is 100% open source and completely free to use. All features are available without any restrictions:

  • โœ… Core Middleware Engine
  • โœ… Route & HTTP Protection
  • โœ… Debug Mode & Benchmarking
  • โœ… Authentication Adapters (Auth0, Firebase, JWT)
  • โœ… Compliance Mode (SOC2, ISO)
  • โœ… License Verification
  • โœ… Plugin Architecture
  • โœ… Angular Schematics
  • โœ… CLI Tool
  • โœ… Visual Builder
  • โœ… Testing Utilities
  • โœ… Template Library
  • โœ… Observability Dashboard
  • โœ… Middleware Marketplace
  • โœ… Showcase Gallery
  • โœ… All features included

Learn more about the plugin architecture โ†’

Released under the MIT License.