How colodreroalex/mundo-nomada works
Project type and purpose
• This is a single-page e-commerce frontend built with Angular. It comprises UI components, feature modules, routing, services that consume REST APIs, and model classes. The application is served as static assets (likely via Netlify) and interacts with a separate backend (not part of this repo) for data persistence, authentication, and business logic.
High-level file-structure analysis
• src/app/ contains the core Angular application.
• app.component + app.routes.ts + app.config.ts: the root component, routing definitions and global configuration.
• componentes/: all reusable UI components (product list, cart, admin panel, login, register, etc.).
• pages/footer-pages/: a feature module for legal/info pages.
• services/: Angular services (AuthService, ProductosService, CarritoService, OrdersService, UsuariosService, etc.) that perform HTTP calls.
• models/: TypeScript interfaces/classes representing domain entities (Producto, Categoria, Pedido, Users, etc.).
• public/ & src/index.html: static assets and HTML entrypoint.
• angular.json, tsconfig.json: build and TypeScript configurations.
a. Frontend (Angular SPA)
• UI Layer: Components & Pages that render views and capture user interactions.
• Routing Layer: app.routes.ts + feature-module routing to navigate between screens.
• Service Layer: injectable services that handle business rules and perform HTTP requests to backend REST endpoints.
• Domain Models: TypeScript classes/interfaces to type API payloads.
• Guards & Interceptors (e.g., AuthGuard): protect routes and inject authentication tokens.
• Build/Deploy: Angular CLI → static bundle → CDN/Netlify.
b. Backend (External REST API)
• Authentication API: login, register, token refresh.
• Product API: CRUD operations for products/categories.
• Cart & Order API: endpoints for shopping cart, checkout, order history.
• User API: user profile, admin user management.
c. Persistence & External Services
• Database: relational or NoSQL DB storing products, users, orders, etc.
• External Payment Gateway: invoked during checkout (not shown in code but implied).
• PDF Generation: pdf.service.ts for client-side invoice/receipt generation.
Relationships and data flow
• User Browser → loads Angular SPA (index.html + JS bundle).
• Angular Components ←→ Angular Services: components call service methods to fetch/update data.
• Angular Services → Backend REST API: HTTP GET/POST/PUT/DELETE calls.
• Backend API → Database: CRUD operations.
• AuthGuard inspects the JWT (or session token) stored in LocalStorage/Session and blocks/permits route activation.
• PDF Service consumes Order data to render/download receipts client-side.
Important architectural patterns
• Component-based UI (Angular).
• Module decomposition (root AppModule + feature FooterPagesModule).
• Service-oriented interaction with backend (separation of concerns).
• Route guarding for authentication/authorization.
• Client-side state via services (singleton services hold cart state).
• Model classes for type safety and mapping API payloads.