angular-boilerplate

A Flat angular latest v16 boiler plate with auth setup, utilities classes, proper docs and much more

Stars
23

Angular Boilerplate

A Fully-Configured Angular 18 Boilerplate for Enterprise-Grade Applications


"Buy Me A Coffee"

Get started fast with this Angular 18 boilerplate, crafted for enterprise-level scalability. It integrates critical features like authentication, lazy loading, real-time socket communication, service workers, shell layout (header+sidebar) making it ready to handle everything from SaaS platforms to enterprise dashboards. Built on the latest Angular 18, this template is packed with the newest capabilities and ensures that you adhere to modern development best practices.

With a solid foundation of PWA (Progressive Web App), authentication, role-based permissions, HTTP interceptors, socket integration, and more, this boilerplate takes care of the core setup so you can focus on building features.

Key Features:

  • Angular 18: Built with the latest version, utilizing improved standalone components and reactive forms.
  • PWA (Progressive Web App) support: Fully configured to enable offline capabilities, background sync, and push notifications.
  • Scalable folder structure: Optimized for enterprise-level applications with a modular design that adapts to growing project needs.
  • Separation of concerns: Adopting Domain-Driven Design (DDD) for a clear boundary between business logic and infrastructure code.
  • Modularization: Components, services, pipes, and directives are split into reusable modules for easy maintenance and scalability.
  • Hybrid architecture: Combines both standalone components and module-based structure, optimizing the initial app component as standalone and using modules for pages and shell.
  • Lazy loading: Efficiently loads only the necessary modules, improving app performance.
  • Routing with guards: Robust routing system with authentication and authorization guards for secured navigation.
  • Complete authentication system: Pre-configured JWT-based authentication, including services, guards, and interceptors for seamless integration.
  • Guards: Role-based guards to protect routes and enforce permissions.
  • Interceptors: Secure API communication with interceptors handling authentication and error management.
  • i18n Translation support: Full internationalization for multi-language apps, with seamless integration of translation services.
  • Basic error handling: Centralized error handling for smooth debugging and a better user experience.
  • Class-based entities: Utilizing Domain-Driven Design concepts for consistent and maintainable entity structures.
  • Implementation of Class Transformers: Easily transform backend data models to frontend-friendly formats (e.g., snake_case to camelCase).
  • Socket.io integration: Real-time updates with modular socket services that seamlessly integrate with the Angular ecosystem.
  • App updates in production: Automatic app updates for production environments, ensuring users always get the latest features and fixes without manual intervention.
  • Environments for development and production: Predefined configurations for different environments, ensuring smooth deployment and testing processes.
  • Utility functions: A set of reusable functions to handle common tasks like:
    • Local storage obfuscation: Getters and setters that automatically encrypt and decrypt data in production environments.
  • Helper functions: Pre-configured helper functions for common development tasks, enhancing productivity and code quality.
  • Detailed documentation: Comprehensive documentation for setup, dependencies, coding styles, utility functions, and more, to help developers get up to speed quickly.
  • Documented utility and helper functions: Clearly explained and reusable across the application, with customization options.

Development Best Practices

This boilerplate enforces strict best practices and includes a configured ESLint flat config to guide developers in writing clean, maintainable, and high-quality code:

  • Code Quality: ESLint rules enforce coding standards like naming conventions, indentation, and eliminating unused code.
  • No Direct Service Access: Encourages a clean architecture by requiring components to interact with data via UseCases, keeping the service layer isolated.
  • Modularization: Promotes single-responsibility services, with each service handling only domain-specific tasks.
  • Scoped Variables: Enforces scoped use of variables and functions, reducing the risk of global state conflicts.
  • Clean, Maintainable Code: The standalone component and module-based hybrid structure optimizes performance and keeps the codebase organized.
  • DRY Principle: Adheres to Don't Repeat Yourself (DRY) principles, reducing redundancy and improving the maintainability of code.
  • Security Awareness: Built-in ESLint rules ensure you avoid common security pitfalls, ensuring secure and performant code.

ESLint Configuration Highlights:

  • Strict Linting Rules: Custom ESLint flat config enforces coding standards, ensuring consistent formatting and type checking across the codebase.
  • Prettier Integration: Maintains consistent code styling with automatic formatting on save or commit.
  • Error Prevention: Detects common issues early on, such as missing type declarations or direct DOM manipulations.
  • Security Focused: The configuration includes security-related rules to avoid risky code patterns.

Why Choose This Boilerplate?

This Angular 18 boilerplate goes beyond just being a starting template—it's a fully equipped foundation for any enterprise-level project. From fully configured authentication and lazy loading to role-based permissions and real-time communication, it covers the most common requirements out-of-the-box.

By enforcing best coding practices and strict ESLint rules, the boilerplate guarantees that every contributor to your project adheres to high development standards. Plus, the modular, scalable architecture and cutting-edge Angular features ensure that this project grows with you.

Whether you’re developing a SaaS platform, building a dynamic web app, or designing an enterprise-level solution, this boilerplate gives you the tools you need—fast.

Continuous Updates

This project will be regularly updated with the latest Angular releases, ensuring compatibility with the latest features and security updates. Stay tuned for new enhancements and features as they are added based on evolving development needs.

Demo:

Check out working demo here

Note: You can remove this with all the above lines and use rest in your documentation.


Web Front-End

Status Badges

💻 Current Stack Version:

  • Node ^v20
  • Angular ^v18

🚀 Project setup

If you want to setup this project locally and start developing, read setup and developers guide here: Setup

😎 Coding style

We make use of Javascript Standard Style while developing.

You can integrate it with eslint linter tool in your IDE to help smoothen the process by integrating automatic linting in compile time.

We already have a eslint.config.js file in the root of the project which you can use to configure your IDE.

We also have husky hooks with prettier and eslint to make sure that the code is linted and formatted before committing.

If you want to read more about the rules, read Coding style

🧳 Dependencies

If you want to read more about dependencies in this platform, read Dependencies

🪢 Helper and Utility functions

We have several documented helper and utility functions that play a big part of the platform. They are available in @core\helpers and @core\utils folder.


📜 Change Logs:

(Latest)

[Version 0.0.0] - 2024-10-05

Added

Changed

Fixed


You can see all change logs Here.


Author:

Arslan Ameer | GitHub

Badges
Extracted from project README
Netlify Status License: MIT commitizen PRs
Related Projects