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

@acontplus/ng-config

v2.0.3

Published

Angular configuration management library providing environment tokens, application settings, dependency injection patterns, and runtime configuration services for enterprise applications.

Readme

@acontplus/ng-config

Angular configuration library providing dependency injection tokens, repository interfaces, and configuration constants for AcontPlus applications.

Installation

# Using npm
npm install @acontplus/ng-config

# Using pnpm
pnpm add @acontplus/ng-config

Features

  • Injection Tokens: Type-safe DI tokens for environment, core config, and authentication
  • Repository Interfaces: Base repository patterns and auth token repository contracts
  • Configuration Constants: Authentication and application configuration constants
  • Base Repository: Abstract base repository with common CRUD operations
  • TypeScript Support: Full type safety with comprehensive interfaces

Quick Start

1. Provide Environment Configuration

// app.config.ts
import { ApplicationConfig } from '@angular/core';
import { ENVIRONMENT } from '@acontplus/ng-config';
import { Environment } from '@acontplus/core';
import { environment } from './environments/environment';

export const appConfig: ApplicationConfig = {
  providers: [{ provide: ENVIRONMENT, useValue: environment }],
};
// environments/environment.ts
import { Environment } from '@acontplus/core';

export const environment: Environment = {
  isProduction: false,
  apiBaseUrl: 'http://localhost:3000/api/',
  tokenKey: 'access_token',
  refreshTokenKey: 'refresh_token',
  clientId: 'my-app',
  loginRoute: 'login',
};

2. Inject and Use Environment

import { inject, Injectable } from '@angular/core';
import { ENVIRONMENT } from '@acontplus/ng-config';

@Injectable({ providedIn: 'root' })
export class ApiService {
  private environment = inject(ENVIRONMENT);

  getApiUrl(): string {
    return this.environment.apiBaseUrl;
  }

  isProduction(): boolean {
    return this.environment.isProduction;
  }
}

API Reference

ENVIRONMENT Token

Injection token for environment configuration with default factory.

Type: InjectionToken<Environment>

Default Value:

{
  isProduction: false,
  apiBaseUrl: 'http://localhost:4200/api/',
  tokenKey: 'access_token',
  refreshTokenKey: 'refresh_token',
  clientId: 'angular-app',
  loginRoute: 'auth',
}

Environment Interface:

interface Environment {
  apiBaseUrl: string; // Base URL for API requests
  isProduction: boolean; // Production mode flag
  tokenKey: string; // Storage key for access token
  refreshTokenKey: string; // Storage key for refresh token
  clientId: string; // Application client identifier
  loginRoute: string; // Route path for login page
}

Usage:

import { inject } from '@angular/core';
import { ENVIRONMENT } from '@acontplus/ng-config';

@Injectable({ providedIn: 'root' })
export class AuthService {
  private env = inject(ENVIRONMENT);

  getTokenKey(): string {
    return this.env.tokenKey;
  }

  getLoginRoute(): string {
    return this.env.loginRoute;
  }
}

CORE_CONFIG Token

Injection token for core application configuration.

Type: InjectionToken<CoreConfig>

Usage:

import { inject } from '@angular/core';
import { CORE_CONFIG } from '@acontplus/ng-config';

@Injectable({ providedIn: 'root' })
export class ConfigService {
  private config = inject(CORE_CONFIG);

  getApiTimeout(): number {
    return this.config.apiTimeout;
  }
}

AUTH_TOKEN Token

Injection token for authentication token configuration.

Type: InjectionToken<string>

Usage:

import { inject } from '@angular/core';
import { AUTH_TOKEN } from '@acontplus/ng-config';

@Injectable({ providedIn: 'root' })
export class TokenService {
  private tokenKey = inject(AUTH_TOKEN);

  getStorageKey(): string {
    return this.tokenKey;
  }
}

Repository Interfaces

AuthTokenRepository

Interface for authentication token storage and retrieval.

export interface AuthTokenRepository {
  getToken(): string | null;
  setToken(token: string): void;
  removeToken(): void;
  getRefreshToken(): string | null;
  setRefreshToken(token: string): void;
  removeRefreshToken(): void;
}

Usage:

import { AuthTokenRepository } from '@acontplus/ng-config';

@Injectable({ providedIn: 'root' })
export class LocalStorageTokenRepository implements AuthTokenRepository {
  getToken(): string | null {
    return localStorage.getItem('access_token');
  }

  setToken(token: string): void {
    localStorage.setItem('access_token', token);
  }

  removeToken(): void {
    localStorage.removeItem('access_token');
  }

  getRefreshToken(): string | null {
    return localStorage.getItem('refresh_token');
  }

  setRefreshToken(token: string): void {
    localStorage.setItem('refresh_token', token);
  }

  removeRefreshToken(): void {
    localStorage.removeItem('refresh_token');
  }
}

BaseRepository

Interface for common CRUD operations.

export interface BaseRepository<TEntity = any, TId = number> {
  findById(id: TId): Observable<TEntity>;
  findAll(): Observable<TEntity[]>;
  create(entity: Omit<TEntity, 'id'>): Observable<TEntity>;
  update(id: TId, entity: Partial<TEntity>): Observable<TEntity>;
  delete(id: TId): Observable<void>;
}

Usage:

import { BaseRepository } from '@acontplus/ng-config';
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';

interface User {
  id: number;
  name: string;
  email: string;
}

@Injectable({ providedIn: 'root' })
export class UserRepository implements BaseRepository<User, number> {
  constructor(private http: HttpClient) {}

  findById(id: number): Observable<User> {
    return this.http.get<User>(`/api/users/${id}`);
  }

  findAll(): Observable<User[]> {
    return this.http.get<User[]>('/api/users');
  }

  create(user: Omit<User, 'id'>): Observable<User> {
    return this.http.post<User>('/api/users', user);
  }

  update(id: number, user: Partial<User>): Observable<User> {
    return this.http.put<User>(`/api/users/${id}`, user);
  }

  delete(id: number): Observable<void> {
    return this.http.delete<void>(`/api/users/${id}`);
  }
}

Configuration Constants

Authentication API

import { AUTH_API } from '@acontplus/ng-config';

// Authentication API paths
const authPath = AUTH_API.AUTH; // 'auth/'

Default Configuration

import { DEFAULT_CONFIG } from '@acontplus/ng-config';

// Full application defaults
const apiTimeout = DEFAULT_CONFIG.apiTimeout; // 30000
const retryAttempts = DEFAULT_CONFIG.retryAttempts; // 2
const enableCorrelationTracking = DEFAULT_CONFIG.enableCorrelationTracking; // true