Anarchitecture Bricks Docs

Repository documentation hub for packages, guides, and generated references.

@anarchitects/identity-angular

Angular profile data access, explicitly scoped signal state, and reusable profile UI for the Anarchitecture identity domain.

Developer + AI Agent Start Here

Features

Installation

npm install @anarchitects/identity-angular
# or
yarn add @anarchitects/identity-angular
# or
pnpm add @anarchitects/identity-angular

Entry points

Import path Description
@anarchitects/identity-angular Root barrel for routine app wiring
@anarchitects/identity-angular/config Config tokens and provider helpers
@anarchitects/identity-angular/data-access Typed IdentityApi and data-access providers
@anarchitects/identity-angular/feature Feature providers and UserProfileFeature
@anarchitects/identity-angular/state Explicitly provided IdentityStore
@anarchitects/identity-angular/ui Profile view and Signal Forms editor components

Usage

Easy mode

Configure Angular HTTP once at the application root, compose the identity providers, and render the feature with the authenticated user id:

import { provideHttpClient } from '@angular/common/http';
import { provideIdentityFeature } from '@anarchitects/identity-angular';

export const appConfig = {
  providers: [
    provideHttpClient(),
    ...provideIdentityFeature({
      apiResourcePath: 'identity',
    }),
  ],
};
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { UserProfileFeature } from '@anarchitects/identity-angular';

@Component({
  selector: 'app-profile-page',
  imports: [UserProfileFeature],
  template: `<anarchitects-user-profile [authUserId]="authUserId" />`,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ProfilePage {
  readonly authUserId = 'authenticated-user-id';
}

The default API route is /api/identity/profiles. Set apiBaseUrl when the API is hosted on another origin.

Advanced composition

Applications can compose the layers independently and provide state at application, route, or component scope:

import { provideIdentityConfig } from '@anarchitects/identity-angular/config';
import { provideIdentityDataAccess } from '@anarchitects/identity-angular/data-access';
import { provideIdentityState } from '@anarchitects/identity-angular/state';

export const profileRoute = {
  path: 'profile',
  providers: [...provideIdentityConfig({ apiBaseUrl: 'https://api.example.com' }), ...provideIdentityDataAccess(), ...provideIdentityState()],
  loadComponent: () => import('@anarchitects/identity-angular/feature').then(({ UserProfileFeature }) => UserProfileFeature),
};

For custom orchestration, inject IdentityStore and use loadProfile(authUserId) and updateProfile(dto). The store exposes readonly profile, loading, saving, error, and hasProfile signals.

The editor keeps non-null string values internally and maps blank values back to the nullable fields defined by UpdateUserProfileRequestDTO at submission time.

Scripts

Development notes

Contributing

Preserve the ui <- feature -> state -> data-access layering and keep configuration shared through public provider helpers.

License

Licensed under the Apache License, Version 2.0.

Canonical version and verification

This source line consumes @anarchitects/identity-contracts@0.0.1 through the domain TS compatibility bindings. See the canonical conformance guide for exact checks, configured-host obligations and remaining capability gates. Generated implementation OpenAPI and passing fixtures do not approve a deployed host's security profile. Existing runtime support and TypeBox exports remain.

Source Links