Overview
Biblioteca Virtual Frontend is built with Angular 19 using modern standalone components architecture. The application follows a feature-based folder structure with clear separation of concerns between authentication, core services, and feature modules.Technology Stack
Angular 19
Standalone components with functional guards and interceptors
TypeScript
Strongly-typed application logic and interfaces
JWT Authentication
Token-based authentication with HTTP interceptors
Role-Based Access
Admin and User role management with route guards
Folder Structure
The application follows a clear, feature-based architecture that promotes maintainability and scalability:Standalone Components Architecture
The application leverages Angular’s modern standalone components pattern, eliminating the need for NgModules:src/app/app.ts
All components in this application are standalone, directly importing their dependencies without NgModules. This simplifies the architecture and improves tree-shaking.
Application Configuration
The application is bootstrapped using functional configuration providers:src/app/app.config.ts
Key Configuration Features
1
Router Configuration
Routes are provided using
provideRouter(routes) with all route definitions from app.routes.ts2
HTTP Client Setup
provideHttpClient is configured with:withFetch()- Uses the modern Fetch APIwithInterceptors([authInterceptor])- Automatically adds JWT tokens to requests
3
Zone Change Detection
Optimized with event coalescing for better performance
4
Global Error Listeners
Centralized error handling across the application
Design Patterns
1. Service-Based Architecture
All business logic is encapsulated in injectable services:- AuthService - Handles login, registration, and session management
- TokenStorageService - Manages JWT token storage in localStorage
- Domain services for Books, Authors, Genres, and Loans
2. Functional Guards
Modern functional route guards replace class-based guards:3. HTTP Interceptors
Functional interceptors automatically attach JWT tokens to outgoing requests:src/app/core/interceptors/auth-interceptor.ts
4. TypeScript Interfaces
Strong typing ensures type safety across the application:src/app/core/models/auth.interface.ts
Feature Modules Organization
Each feature follows a consistent structure:- List Components
- Form Components
- Services
Display data in tables with CRUD operations
- libro-list
- autor-list
- genero-list
- prestamo-list
Core Principles
Separation of Concerns
Authentication, core services, and features are clearly separated
Single Responsibility
Each service, guard, and component has a focused purpose
Dependency Injection
All services use Angular’s DI system for loose coupling
Type Safety
TypeScript interfaces ensure compile-time type checking
Next Steps
Routing
Learn about route configuration and navigation
Authentication
Understand the JWT authentication flow
Authorization
Explore role-based access control with guards
Services
See how to integrate with backend services