A comprehensive Nx monorepo containing Angular libraries providing Domain-Driven Design (DDD) architecture, core utilities, and Angular Material UI components for enterprise applications.
- core: Core library with pricing calculations, constants, environment configuration, domain models, and clean architecture patterns
- ng-auth: Angular authentication module with JWT token management, route guards, URL redirection, and session handling
- ng-components: Angular Material UI components including cards, tables, dialogs, theme toggle, and styling utilities
- ng-config: Angular configuration library with environment tokens and app configuration services
- ng-customer: Customer management components and services following clean architecture
- ng-infrastructure: Angular infrastructure with HTTP interceptors, repositories, adapters, and core services
- ng-notifications: Notification system with toast notifications, alerts, and snackbars using ngx-toastr and SweetAlert2
- ui-kit: UI kit library for reusable components (under development)
- utils: Shared utility functions for converters, formatters, helpers, and validators
- demo-app: Demo application showcasing DDD architecture patterns and library usage
- demo-app-e2e: End-to-end tests for the demo application
- API Response Handling - DDD patterns for standardized API response handling
- Frontend Architecture Guide - Architecture patterns and guidelines
- Style Guide - Design principles and component guidelines
- Development Setup - Code quality tools and configuration
- Node.js 18+
- pnpm
# Clone the repository
git clone https://github.com/Acontplus-S-A-S/acontplus-libs.git
cd acontplus-libs
# Install dependencies
pnpm install
# Start demo app
pnpm start- Clean Architecture: Proper separation of concerns with distinct layers
- CQRS Pattern: Command Query Responsibility Segregation implementation
- BaseRepository Pattern: Generic, extensible data access layer with factory pattern
- Use Case Pattern: Business logic components with validation and authorization
- Response Standardization: Unified API response handling with interceptors
- Nx Monorepo: Efficient build system with caching and dependency management
- Multi-Application Support: Designed for sharing across multiple Angular apps
- Modern Angular Practices: Latest Angular patterns and best practices
- Consistent Architecture: Same patterns across all applications
- Easy Configuration: Environment-specific settings and runtime updates
- Scalable BaseRepository Management: Centralized registration and dynamic creation
- Better Testing: Dependency injection for mocking and isolated components
- Developer Experience: Clear patterns, consistent API design, better error messages
- Fast Builds: Nx caching and parallelization for efficient development
- Code Sharing: Seamless sharing of libraries across applications
pnpm start- Start the demo application with SSLpnpm run build- Build the demo applicationpnpm run watch- Build demo app in watch modepnpm run test- Run tests for all projectspnpm run test:watch- Run tests in watch modepnpm run test:coverage- Run tests with coveragepnpm run build:all- Build all projectspnpm run build:libs- Build all library packagespnpm run lint- Lint all projectspnpm run lint:fix- Lint and auto-fix issuespnpm run format- Format all code with Prettierpnpm run format:check- Check code formattingpnpm run clean- Reset Nx cachepnpm run local-registry- Start local npm registry for developmentpnpm run e2e- Run end-to-end tests
This project uses manual publishing due to npm's enhanced security requirements (2FA, security keys).
-
Bump version using the patch-version script:
# For patch version (bug fixes) .\scripts\patch-version.ps1 <package-name> # For minor version (new features) pnpm --filter @acontplus/<package-name> exec npm version minor # For major version (breaking changes) pnpm --filter @acontplus/<package-name> exec npm version major
-
Build the package:
pnpm nx build <package-name> --configuration=production
-
Publish with web authentication:
cd dist/packages/<package-name> npm publish --access=public
This opens your browser for authentication with security keys (Windows Hello, hardware keys, or TOTP).
# 1. Bump version (minor for new features)
pnpm --filter @acontplus/ng-auth exec npm version minor
# 2. Build for production
pnpm nx build ng-auth --configuration=production
# 3. Publish to npm
cd dist/packages/ng-auth
npm publish --access=public
cd ../../..Use the patch version script to bump package versions and update dependencies:
# Interactive mode - prompts for package selection
.\scripts\patch-version.ps1
# Direct mode - specify package name
.\scripts\patch-version.ps1 -PackageName "@acontplus/utils"
.\scripts\patch-version.ps1 -PackageName "core"The script will:
- Show all available packages with current versions
- Prompt for package selection and confirmation
- Patch the version using
npm version patch(e.g., 1.0.11 β 1.0.12) - Automatically update all dependencies across the workspace
- Run
pnpm installto update the lock file - Display a summary of changes
# Build specific project
pnpm exec nx build core
pnpm exec nx build ng-components
# Test specific project
pnpm exec nx test core
pnpm exec nx test ng-components
# Lint specific project
pnpm exec nx lint core
# Show project graph
pnpm exec nx show projects
# Show dependency graph
pnpm exec nx graphThis workspace is an Nx monorepo containing Angular libraries and applications:
- Libraries:
core,ng-auth,ng-components,ng-config,ng-customer,ng-infrastructure,ng-notifications,ui-kit,utils - Applications:
demo-app,demo-app-e2e
Always build dependencies before dependents:
core- Base utilities, no dependenciesutils- Shared utilities, may depend on coreng-config- Configuration services, depends on coreng-infrastructure- Infrastructure services, depends on ng-config and coreng-auth- Authentication module, depends on ng-infrastructure, ng-config, and coreng-components- UI components, depends on coreng-customer- Customer management, depends on ng-components, ng-auth, ng-notifications, and coreng-notifications- Notification components, no dependenciesui-kit- Additional UI components (under development)demo-app- Demo application, depends on all libraries
Always use pnpm exec nx commands instead of direct tool execution for
consistency and caching.
Use pnpm exec nx affected:* commands to only run operations on projects
affected by your changes:
pnpm exec nx affected:build
pnpm exec nx affected:test
pnpm exec nx affected:lintNx automatically caches build and test results. Clear cache when needed:
ppnpm run clean # Resets Nx cacheFor testing library changes in applications:
# Start local npm registry
ppnpm run local-registry
# Build and publish libraries locally
pnpm exec nx release --local
# Use local versions in applicationsUse Nx generators for consistent project structure:
# Generate new library
pnpm exec nx g @nx/angular:library my-lib
# Generate component in specific library
pnpm exec nx g @nx/angular:component my-component --project=ng-components- targetDefaults: Shared configuration for build, test, lint targets
- namedInputs: Defines what files trigger rebuilds
- generators: Custom generator configurations
- release: Publishing configuration
- Fast Builds: Nx caching reduces build times significantly
- Affected Commands: Only run operations on changed projects
- Dependency Graph: Visual understanding of project relationships
- Code Generation: Consistent project structure with generators
- Scalability: Efficient handling of large monorepos
- Developer Experience: Rich tooling and automation
- Ensure dependencies are built first
- Check
pnpm exec nx graphfor dependency relationships - Use
pnpm exec nx resetto clear cache
- Run tests individually:
pnpm exec nx test <project> - Check test configuration in
project.json - Ensure proper imports in test setup
- Use path mappings defined in
tsconfig.base.json - Libraries are available as
@acontplus/<lib-name> - Check package.json exports in each library
This workspace was migrated from npm workspaces to Nx monorepo:
- Before: Manual dependency management with npm workspaces
- After: Automated dependency management with Nx
- Benefits: Better caching, affected commands, visual tools
- Commands: Updated to use
pnpm exec nxinstead of npm scripts
- Global Rules: Applied to all TypeScript and HTML files
- Angular Specific: Enforces Angular best practices and naming conventions
- TypeScript Rules: Type safety and code quality rules
- Formatting Rules: Consistent code style across the project
- Accessibility Rules: HTML template accessibility checks
- Consistent Formatting: 2-space indentation, single quotes, trailing commas
- File-specific Rules: Different settings for JSON, Markdown, and YAML files
- Project-level Configs: Each project can have its own Prettier settings
- Cross-editor Consistency: Ensures consistent coding style regardless of editor
- File-type Specific: Different rules for TypeScript, HTML, CSS, JSON, etc.
- Line Ending Management: Consistent line endings across platforms
- core, ng-components, ng-customer, ng-notifications:
acpprefix - demo-app:
appprefix
- Components: kebab-case (e.g.,
dynamic-card) - Directives: camelCase (e.g.,
toUpperCase) - Services: camelCase (e.g.,
correlationService) - Models: camelCase (e.g.,
apiResponseModel)
- Angular imports first
- Third-party libraries
- Internal library imports
- Relative imports last
acontplus-libs/
βββ apps/
β βββ demo-app/ # Demo application
β β βββ src/
β β β βββ app/ # Application code
β β β βββ assets/ # Static assets
β β β βββ environments/ # Environment configurations
β β β βββ index.html
β β βββ project.json # Nx project configuration
β β βββ tsconfig.json
β βββ demo-app-e2e/ # E2E tests
β βββ src/
β βββ project.json
βββ packages/
β βββ core/ # Core utilities library
β β βββ src/lib/
β β β βββ environments/ # Environment configuration
β β β βββ interceptors/ # HTTP interceptors
β β β βββ models/ # Data models and interfaces
β β β βββ repositories/ # BaseRepository pattern implementation
β β β βββ services/ # Core services
β β β βββ use-cases/ # Use case pattern implementation
β β β βββ utils/ # Utility functions
β β βββ project.json # Nx project configuration
β β βββ README.md # Core library documentation
β βββ ng-components/ # UI components library
β β βββ src/lib/
β β β βββ components/ # UI components
β β β βββ services/ # UI-related services
β β β βββ models/ # UI component models
β β β βββ styles/ # Component styles and themes
β β βββ project.json
β β βββ README.md # UI components documentation
β βββ ng-config/ # Core Angular services
β βββ ng-auth/ # Authentication services
β βββ ng-infrastructure/ # Infrastructure services
β βββ ng-customer/ # Customer management
β βββ ng-notifications/ # Notifications system
β βββ ui-kit/ # Additional UI components
β βββ utils/ # Shared utilities
βββ docs/ # Comprehensive documentation
β βββ api-response-handling.md
β βββ frontend-architecture-guide.md
β βββ linting-and-formatting-setup.md
β βββ style-guide.md
βββ nx.json # Nx workspace configuration
βββ package.json # Root dependencies and scripts
βββ tsconfig.base.json # Base TypeScript configuration
βββ jest.config.js # Jest testing configuration
- Target Defaults: Shared configuration for build, test, and lint targets
- Named Inputs: Defines what files affect different operations
- Cache Settings: Optimizes build performance
- Release Configuration: Automated publishing setup
- Angular testing with jest-preset-angular
- JSDOM environment for component testing
- Module name mapping for library imports
- Coverage reporting configuration
- TypeScript support via ts-jest
- Enforces Angular best practices
- TypeScript-specific rules
- Template accessibility checks
- Consistent code formatting
- 2-space indentation
- Single quotes preferred
- 100 character line length
- Trailing commas on multiline
- UTF-8 encoding
- LF line endings
- 2-space indentation
- File-type specific rules
This project uses Jest as the test runner for fast, reliable testing with excellent Angular support.
# Run all tests
pnpm run test
# Run tests in watch mode (automatically re-runs on file changes)
pnpm run test:watch
# Run tests with coverage report
pnpm run test:coverage
# Run tests for specific project
pnpm exec nx test core
pnpm exec nx test ng-components- Configuration:
jest.config.js- Main Jest configuration - Setup:
setup-jest.ts- Jest setup and mocks - TypeScript:
tsconfig.spec.json- TypeScript configuration for tests - Environment: Uses
jsdomenvironment for Angular component testing - Module Resolution: Configured to resolve library imports
Jest automatically discovers test files matching these patterns:
**/__tests__/**/*.ts**/?(*.)+(spec|test).ts
Coverage reports are generated in the coverage/ directory with:
- Text summary in terminal
- HTML report for detailed coverage analysis
- LCOV format for CI/CD integration
# Build all libraries
pnpm run build:libs
# Build specific library
pnpm exec nx build core
pnpm exec nx build ng-components
# Build demo app
pnpm run build
# Start local registry for development
pnpm run local-registry
# Publish libraries (handled by Nx release)
pnpm exec nx releaseComprehensive documentation is available across the project:
- API Response Handling - DDD patterns for API handling
- Frontend Architecture Guide - Architecture patterns and guidelines
- Style Guide - Design system guidelines
- Development Setup - Code quality tools
- Core Library Guide - Complete core library documentation
- UI Components Guide - Complete UI components documentation
- Fork the repository
- Create a feature branch
- Make your changes
- Run linting and formatting:
pnpm run lint:all - Fix any issues:
pnpm run lint:fixandpnpm run format - Run tests:
pnpm run test - Submit a pull request
# 1. Make code changes
# 2. Check formatting
pnpm run format:check
# 3. Format code if needed
pnpm run format
# 4. Check linting
pnpm run lint
# 5. Fix auto-fixable issues
pnpm run lint:fix
# 6. Run tests
pnpm run test
# 7. Build affected projects
pnpm exec nx affected:build
# 8. Run affected tests
pnpm exec nx affected:testThis project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Documentation: See links in the Documentation section above
- Contact: Ivan Paz
See CHANGELOG.md for a detailed history of changes and improvements.
Current Status: Enterprise-grade Nx monorepo solution
The library now represents a state-of-the-art, enterprise-ready foundation that follows modern Angular development patterns with Nx monorepo management. It's perfectly suited for multiple Angular applications and provides an excellent base for building scalable, maintainable applications with efficient build caching and code sharing.
This is exactly the kind of foundation you want for a multi-application Angular ecosystem. π
- Multi-Application Support: Designed for sharing across multiple Angular apps
- Modern Angular Practices: Latest Angular patterns and best practices
- Consistent Architecture: Same patterns across all applications
- Easy Configuration: Environment-specific settings and runtime updates
- Scalable BaseRepository Management: Centralized registration and dynamic creation
- Better Testing: Dependency injection for mocking and isolated components
- Developer Experience: Clear patterns, consistent API design, better error messages
pnpm run build- Build all projectspnpm run build-library- Build core and UI component librariespnpm run test- Run Jest tests for all projectspnpm run test:watch- Run Jest tests in watch modepnpm run test:coverage- Run Jest tests with coverage reportpnpm run lint- Lint all projectspnpm run lint:fix- Lint and auto-fix issuespnpm run format- Format all code with Prettierpnpm run format:check- Check code formattingpnpm run format:fix- Format code (alias for format)pnpm run lint:all- Run both linting and format checking
Each project has its own format scripts:
pnpm run format- Format project codepnpm run format:check- Check project formattingpnpm run format:fix- Format project code (alias)
- Global Rules: Applied to all TypeScript and HTML files
- Angular Specific: Enforces Angular best practices and naming conventions
- TypeScript Rules: Type safety and code quality rules
- Formatting Rules: Consistent code style across the project
- Accessibility Rules: HTML template accessibility checks
- Consistent Formatting: 2-space indentation, single quotes, trailing commas
- File-specific Rules: Different settings for JSON, Markdown, and YAML files
- Project-level Configs: Each project can have its own Prettier settings
- Cross-editor Consistency: Ensures consistent coding style regardless of editor
- File-type Specific: Different rules for TypeScript, HTML, CSS, JSON, etc.
- Line Ending Management: Consistent line endings across platforms
- acontplus-core:
acpprefix - acontplus-ui-components:
acpprefix - test-app:
appprefix
- Components: kebab-case (e.g.,
dynamic-card) - Directives: camelCase (e.g.,
toUpperCase) - Services: camelCase (e.g.,
correlationService) - Models: camelCase (e.g.,
apiResponseModel)
- Angular imports first
- Third-party libraries
- Internal library imports
- Relative imports last
acontplus-libs/
βββ apps/
β βββ demo-app/ # Demo application
β β βββ src/
β β β βββ app/ # Application code
β β β βββ assets/ # Static assets
β β β βββ environments/ # Environment configurations
β β β βββ index.html
β β βββ project.json # Nx project configuration
β β βββ tsconfig.json
β βββ demo-app-e2e/ # E2E tests
β βββ src/
β βββ project.json
βββ packages/
β βββ core/ # Core utilities library
β β βββ src/lib/
β β β βββ environments/ # Environment configuration
β β β βββ interceptors/ # HTTP interceptors
β β β βββ models/ # Data models and interfaces
β β β βββ repositories/ # BaseRepository pattern implementation
β β β βββ services/ # Core services
β β β βββ use-cases/ # Use case pattern implementation
β β β βββ utils/ # Utility functions
β β βββ project.json # Nx project configuration
β β βββ README.md # Core library documentation
β βββ ng-components/ # UI components library
β β βββ src/lib/
β β β βββ components/ # UI components
β β β βββ services/ # UI-related services
β β β βββ models/ # UI component models
β β β βββ styles/ # Component styles and themes
β β βββ project.json
β β βββ README.md # UI components documentation
β βββ ng-config/ # Configuration services
β βββ ng-auth/ # Authentication services
β βββ ng-infrastructure/ # Infrastructure services
β βββ ng-customer/ # Customer management
β βββ ng-notifications/ # Notifications system
β βββ ui-kit/ # Additional UI components
β βββ utils/ # Shared utilities
βββ docs/ # Comprehensive documentation
β βββ api-response-handling.md
β βββ frontend-architecture-guide.md
β βββ linting-and-formatting-setup.md
β βββ style-guide.md
βββ nx.json # Nx workspace configuration
βββ package.json # Root dependencies and scripts
βββ tsconfig.base.json # Base TypeScript configuration
βββ jest.config.js # Jest testing configuration
- Target Defaults: Shared configuration for build, test, and lint targets
- Named Inputs: Defines what files affect different operations
- Cache Settings: Optimizes build performance
- Release Configuration: Automated publishing setup
- Angular testing with jest-preset-angular
- JSDOM environment for component testing
- Module name mapping for library imports
- Coverage reporting configuration
- TypeScript support via ts-jest
- Enforces Angular best practices
- TypeScript-specific rules
- Template accessibility checks
- Consistent code formatting
- 2-space indentation
- Single quotes preferred
- 100 character line length
- Trailing commas on multiline
- UTF-8 encoding
- LF line endings
- 2-space indentation
- File-type specific rules
This project uses Jest as the test runner for fast, reliable testing with excellent Angular support.
# Run all tests
pnpm run test
# Run tests in watch mode (automatically re-runs on file changes)
pnpm run test:watch
# Run tests with coverage report
pnpm run test:coverage
# Run tests for specific project
pnpm exec nx test core
pnpm exec nx test ng-components- Configuration:
jest.config.js- Main Jest configuration - Setup:
setup-jest.ts- Jest setup and mocks - TypeScript:
tsconfig.spec.json- TypeScript configuration for tests - Environment: Uses
jsdomenvironment for Angular component testing - Module Resolution: Configured to resolve library imports
Jest automatically discovers test files matching these patterns:
**/__tests__/**/*.ts**/?(*.)+(spec|test).ts
Coverage reports are generated in the coverage/ directory with:
- Text summary in terminal
- HTML report for detailed coverage analysis
- LCOV format for CI/CD integration
# Build all libraries
pnpm run build:libs
# Build specific library
pnpm exec nx build core
pnpm exec nx build ng-components
# Build demo app
pnpm run build
# Start local registry for development
pnpm run local-registry
# Publish libraries (handled by Nx release)
pnpm exec nx releaseComprehensive documentation is available across the project:
- API Response Handling - DDD patterns for API handling
- Frontend Architecture Guide - Architecture patterns and guidelines
- Style Guide - Design system guidelines
- Development Setup - Code quality tools
- Core Library Guide - Complete core library documentation
- UI Components Guide - Complete UI components documentation
- Fork the repository
- Create a feature branch
- Make your changes
- Run linting and formatting:
pnpm run lint:all - Fix any issues:
pnpm run lint:fixandpnpm run format - Run tests:
pnpm run test - Submit a pull request
# 1. Make code changes
# 2. Check formatting
pnpm run format:check
# 3. Format code if needed
pnpm run format
# 4. Check linting
pnpm run lint
# 5. Fix auto-fixable issues
pnpm run lint:fix
# 6. Run tests
pnpm run test
# 7. Build affected projects
pnpm exec nx affected:build
# 8. Run affected tests
pnpm exec nx affected:testThis project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Documentation: See links in the Documentation section above
- Contact: Ivan Paz
See CHANGELOG.md for a detailed history of changes and improvements.
Current Status: Enterprise-grade Nx monorepo solution
The library now represents a state-of-the-art, enterprise-ready foundation that follows modern Angular development patterns with Nx monorepo management. It's perfectly suited for multiple Angular applications and provides an excellent base for building scalable, maintainable applications with efficient build caching and code sharing.
This is exactly the kind of foundation you want for a multi-application Angular ecosystem. π