Directory Overview
The Happy Habitat frontend follows Angular’s recommended project structure with a feature-based organization:Core Directories
/src/app/auth
Authentication feature module with its own layout and routing.
/src/app/components
Feature-based components organized by functional area.
Key Feature Modules
Admin Company (components/admincompany/)
historial-pagos-residente/- Resident payment historymorosos/- Delinquent accounts managementsaldo-banco/- Bank balance trackingtop-menu/- Admin navigation
components/amenidades/)
amenidades-grid.component.ts- Grid viewamenidades-list.component.ts- List viewamenidad-horario-modal/- Schedule modalamenidades-top-menu/- Navigationamenidades-routes.ts- Amenity routing
components/resident/)
registro-visitante/- Visitor registrationregistro-mascota/- Pet registrationregistro-auto/- Vehicle registrationregistro-preferencias/- Preferencesresident-encuestas/- Surveysresident-top-menu/- Resident navigation
components/vigilancia/)
vigilancia-incidentes/- Incident trackingvigilancia-reservaciones/- Reservation managementvigilancia-residentes/- Resident monitoringvigilancia-tickets/- Ticket handling
components/system-administation/)
comunidades/- Community managementcontratos/- Contract managementbanners/- Banner administrationstatement/- Financial statements
tickets/- Support ticket systemcomunicados/- Announcementsencuesta/- Survey systemdocumento/- Document managementpagos-residente/- Resident paymentsproveedores-residentes/- Service providers
/src/app/layouts
Layout components that define page structure for different user roles.
/src/app/pages
Top-level page components that represent full-page views.
/src/app/services
Application-wide services for business logic and API communication.
Key Services:
auth.service.ts- Authentication and authorizationlogger.service.ts- Logging functionalityerror.service.ts- Error handlingamenidades.service.ts- Amenity operationscomunicados.service.ts- Announcementscommunities.service.ts- Community managementdashboard.service.ts- Dashboard datadocuments.service.ts- Document operationsencuestas.service.ts- Survey managementfile.service.ts- File upload/download
/src/app/guards
Route protection guards.
/src/app/interceptors
HTTP interceptors for cross-cutting concerns.
/src/app/shared
Reusable components, pipes, and utilities used across the application.
/src/app/interfaces
TypeScript interfaces for type safety.
Purpose: Define data models and contracts for API responses, component inputs, etc.
/src/app/enums
TypeScript enumerations.
Example: RolesEnum - User role definitions
/src/app/constants
Application-wide constants.
/src/app/utils
Utility functions and helper classes.
Key Utilities:
error-handler.util.ts- Global error handler
File Naming Conventions
Components
kebab-case.component.ts
Services
Pattern:service-name.service.ts
Example: auth.service.ts, logger.service.ts
Guards
Pattern:guard-name.guard.ts
Example: auth.guard.ts, role.guard.ts
Interceptors
Pattern:interceptor-name.interceptor.ts
Example: auth.interceptor.ts
Routes
Pattern:feature-routes.ts
Example: auth-routes.ts, resident-routes.ts
Interfaces
Pattern:PascalCase without suffix
Example: User, Community, Amenity
Enums
Pattern:PascalCase.enum.ts
Example: RolesEnum
Module Organization
Standalone Components
Happy Habitat uses Angular’s standalone components architecture:- No NgModule boilerplate
- Explicit dependencies
- Better tree-shaking
- Easier lazy loading
Lazy Loading
Features are lazy-loaded using dynamic imports:Component Prefix
All components use theapp prefix as configured in angular.json:
Asset Management
Public Directory
Static assets are placed in thepublic/ directory and are copied as-is during build:
Code Organization Best Practices
Feature Modules
- Each feature has its own directory under
components/ - Features include:
- Components (list, detail, form)
- Routes (feature-routes.ts)
- Services (feature.service.ts)
- Top menu component (navigation)
Shared Code
- Reusable components go in
shared/components/ - Reusable pipes go in
shared/pipes/ - Common interfaces go in
shared/interfaces/
Services
- Services are application-wide and placed in
services/ - Feature-specific services can be co-located with features
- Example:
proveedores-residentes/services/
Type Safety
- Interfaces in dedicated files
- Enums for fixed sets of values
- Constants for magic numbers/strings
Next Steps
- Frontend Overview - Learn about the technology stack
- Routing Configuration - Understand navigation structure