Skip to content

alobuuls/angular-harry-potter-api

Repository files navigation

πŸ§™ Angular Harry Potter API

Angular TypeScript Modular Architecture Completed

Repository GitHub Stars Last Commit


πŸ“‘ Table of Contents


🌐 Live Demo

πŸ”— https://alobuuls.github.io/angular-harry-potter-api/


πŸ“– Description

Note

Angular 12 application that consumes the Harry Potter API to display character information through a modular architecture following Angular best practices.

The project demonstrates API consumption, route guards, HTTP interceptors, reactive forms, RxJS operators, custom pipes, centralized error handling, and scalable application structure.


βš™οΈ System Requirements

Before running the project, make sure you have installed:

  • πŸ“¦ Node.js: v12.14.x – v14.x (recommended: v14.21.3 LTS)
  • πŸ“¦ npm: v6+
  • πŸ…°οΈ Angular CLI: v12.x

πŸ” Verify Installed Versions

Run the following commands in your terminal:

node -v
npm -v
ng version

πŸš€ Project Installation

1️⃣ Clone the repository

git clone git@github.com:alobuuls/angular-harry-potter-api.git

cd angular-harry-potter-api

2️⃣ Install dependencies

npm install

▢️ Run the Project

Start the development server:

ng serve

Then open:

http://localhost:4200

🧠 Project Architecture

The application follows a modular Angular architecture focused on scalability, maintainability, and separation of concerns.

πŸ“¦ Core Module

Responsible for:

  • Application-wide functionality
  • Navigation menu
  • Shared core features

πŸ“¦ Characters Module

Responsible for:

  • Harry Potter character listing
  • Search functionality
  • API data presentation

πŸ“¦ Protected Module

Responsible for:

  • Protected routes
  • Route guard implementation
  • Navigation control

πŸ“¦ Services

Responsible for:

  • Harry Potter API communication
  • Data transformation
  • Centralized error handling

πŸ“¦ Interceptors

Responsible for:

  • Global HTTP request modification
  • API request configuration
  • Cross-cutting concerns

πŸ“¦ Shared Module

Responsible for:

  • Custom pipes
  • Shared resources
  • Reusable functionality

πŸ“¦ Guards

Responsible for:

  • Route protection
  • Unsaved changes prevention
  • Navigation validation

✨ Features

  • πŸ§™ Harry Potter character listing
  • πŸ” Character search
  • πŸ“‘ REST API consumption
  • ⚑ Reactive programming with RxJS
  • πŸ›‘οΈ Route Guards
  • 🚫 Unsaved Changes Guard
  • πŸ”„ HTTP Interceptors
  • 🧩 Custom Pipes
  • πŸ“‹ Reactive Forms
  • ❌ Centralized Error Handling
  • 🎯 Strong typing with TypeScript
  • πŸ“¦ Modular Angular architecture

πŸ›  Technologies Used

Technology Purpose
Angular 12 Framework
TypeScript Application Logic
RxJS Reactive Programming
Angular Router Navigation
Angular HttpClient API Communication
Reactive Forms Form Management
Route Guards Route Protection
HTTP Interceptors Request Handling
HTML5 Structure
CSS3 Styling

πŸ“ Project Structure

angular-harry-potter-api/

β”œβ”€β”€ src/
β”‚
β”œβ”€β”€ app/
β”‚   β”‚
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ menu/
β”‚   β”‚   └── core.module.ts
β”‚   β”‚
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ characters/
β”‚   β”‚   └── protected/
β”‚   β”‚
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ hp.service.ts
β”‚   β”‚   └── error-handler.service.ts
β”‚   β”‚
β”‚   β”œβ”€β”€ interceptors/
β”‚   β”‚   β”œβ”€β”€ api-hp.interceptor.ts
β”‚   β”‚   └── global-headers.interceptor.ts
β”‚   β”‚
β”‚   β”œβ”€β”€ guard/
β”‚   β”‚   β”œβ”€β”€ auth.guard.ts
β”‚   β”‚   └── form-unsaved.guard.ts
β”‚   β”‚
β”‚   β”œβ”€β”€ shared/
β”‚   β”‚   β”œβ”€β”€ pipes/
β”‚   β”‚   └── shared.module.ts
β”‚   β”‚
β”‚   β”œβ”€β”€ interfaces/
β”‚   β”‚   β”œβ”€β”€ hp.api.interface.ts
β”‚   β”‚   └── stucture-data-api.interface.ts
β”‚   β”‚
β”‚   β”œβ”€β”€ helpers/
β”‚   β”‚   └── init-with-status.helper.ts
β”‚   β”‚
β”‚   β”œβ”€β”€ app.module.ts
β”‚   β”œβ”€β”€ app.routes.ts
β”‚   └── app.routing.module.ts
β”‚
β”œβ”€β”€ environments/
β”‚   β”œβ”€β”€ environment.ts
β”‚   └── environment.prod.ts
β”‚
β”œβ”€β”€ angular.json
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── README.md

πŸ”₯ Best Practices Implemented

  • Modular Angular architecture
  • Separation of concerns
  • Strong typing with TypeScript interfaces
  • Reactive programming with RxJS
  • Route Guards implementation
  • Unsaved Changes Guard pattern
  • HTTP Interceptors
  • Reusable custom pipes
  • Centralized error handling
  • Shared module architecture
  • Service abstraction
  • Scalable project structure

🎯 Project Goal

Practice and strengthen Angular development concepts through the implementation of a real-world API-driven application:

  • REST API Consumption
  • Angular Modules
  • Route Guards
  • HTTP Interceptors
  • Reactive Forms
  • RxJS Operators
  • Custom Pipes
  • Error Handling
  • TypeScript Interfaces
  • Front-End Architecture

πŸ“„ License

This project is intended for educational and portfolio purposes.

Created by Alondra Francisco.

About

Angular 12 application consuming the Harry Potter API and Unsplash API, featuring RxJS search, route guards, HTTP interceptors, custom pipes, and reactive forms.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors