Skip to main content

Overview

This guide will help you run the Odontología Frontend application on your local machine for development purposes. After completing the installation, you’ll be able to start the development server and access the application in your browser.
Make sure you’ve completed the Installation steps before proceeding with this guide.

Starting the Development Server

1

Navigate to Project Directory

Open your terminal and navigate to the project directory:
cd odontologia-frontend
2

Start the Development Server

Run the development server using npm:
npm start
All three commands above are equivalent. npm start is an alias for ng serve as defined in package.json.
3

Wait for Compilation

The Angular CLI will compile your application. This may take 30-60 seconds on the first run.Expected Output:
Initial chunk files | Names         |  Raw size
polyfills.js        | polyfills     |  90.20 kB | 
main.js             | main          | 245.32 kB | 
styles.css          | styles        |  15.48 kB | 

                    | Initial total | 351.00 kB

Application bundle generation complete. [2.145 seconds]

Watch mode enabled. Watching for file changes...

  Local:   http://localhost:4200/
  press h + enter to show help
4

Open in Browser

Open your web browser and navigate to:
http://localhost:4200/
The application will automatically open on the login page.

Logging In

The application includes test user credentials for development:

Dentist Access

Email: [email protected]Password: 123Full access to patient records, treatments, and appointments

Receptionist Access

Email: [email protected]Password: 123Access to scheduling and basic patient information
These credentials are for development/testing only. Implement proper authentication with secure password hashing before deploying to production.

Login Flow

  1. Enter email and password on the login page
  2. Click “Iniciar Sesión” (Login)
  3. On successful authentication, you’ll be redirected to the home dashboard
  4. The user role is stored in localStorage for session management
// Login component handles authentication
handleLogin() {
  const { email, password } = this.loginForm.value;
  const user = this.users.find(u => 
    u.email === email && u.password === password
  );
  
  if (user) {
    localStorage.setItem('userRole', user.role);
    this.router.navigate(['/home']);
  }
}

Exploring the Application

Once logged in, you can explore the main features:
1

Dashboard (Home)

The home page provides an overview of clinic operations and quick access to key functions.Route: /home
2

Patient Management

View, search, and manage patient records.Routes:
  • /patient - Patient list with search functionality
  • /patient/new - Add new patient
  • /patient/:id - View patient details
Features:
  • Search patients by name, email, or phone
  • View complete medical history
  • Track allergies and family history
  • Access billing information
3

Appointments

Manage patient appointments and schedule new consultations.Routes:
  • /citas - Appointment list
  • /calendar - Calendar view
Features:
  • Schedule new appointments
  • View appointment status (confirmed, pending, urgent)
  • Track doctor assignments
4

Treatments

Access and manage treatment records.Route: /tratamientosFeatures:
  • View treatment history
  • Track treatment costs
  • Associate treatments with patients

Sample Data

The application comes with pre-populated sample data for testing:

Sample Patients

{
  id: 1,
  nombre: 'Juan Pérez',
  edad: 45,
  phone: '600 123 456',
  email: '[email protected]',
  address: 'Calle Mayor 123, Madrid',
  medication_allergies: 'Penicilina',
  health_status: 'Estable. Requiere limpieza profunda.',
  estado: 'activo'
}
The application includes 4 sample patients with varying statuses:
  • activo - Active patients with scheduled appointments
  • pendiente - Patients pending follow-up
  • urgente - Patients requiring urgent care

Development Features

Hot Module Replacement

The development server supports automatic reloading. Any changes to source files will trigger:
  1. Incremental Compilation - Only changed files are recompiled
  2. Automatic Browser Refresh - The browser automatically reloads
  3. Fast Rebuild - Subsequent builds complete in 1-3 seconds
# Edit any file in src/
# Save the file
# Watch the terminal output:

Files changed: src/app/patient/patient.ts
Rebuilding...

 Browser application bundle generation complete.

[0.856 seconds]

Development Commands

Here are the available npm scripts for development:
npm start
# Starts development server on http://localhost:4200/

Project Structure Overview

Understanding the key directories:
src/
├── app/
│   ├── app.ts              # Root component
│   ├── app.routes.ts       # Route configuration
│   ├── app.config.ts       # Application config
│   │
│   ├── login/              # Authentication module
│   │   ├── login.ts        # Login component
│   │   ├── login.html      # Login template
│   │   └── login.css       # Login styles
│   │
│   ├── patient/            # Patient management
│   │   ├── patient.ts      # Patient list component
│   │   ├── patient.html
│   │   └── patient.css
│   │
│   └── services/           # Shared services
│       ├── patient.service.ts
│       ├── appointment.service.ts
│       └── treatment.service.ts

├── main.ts                 # Application bootstrap
├── styles.css              # Global styles
└── index.html              # HTML entry point

Component Architecture

The application uses Angular 21’s standalone components:
import { Component, inject } from '@angular/core';
import { Router } from '@angular/router';
import { PatientService } from '../services/patient.service';

@Component({
  selector: 'app-patient',
  standalone: true,
  imports: [CommonModule, FormsModule, RouterModule],
  templateUrl: './patient.html',
  styleUrl: './patient.css'
})
export class Patient implements OnInit {
  patients: PatientData[] = [];
  
  constructor(private patientService: PatientService) { }
  
  ngOnInit(): void {
    this.patients = this.patientService.getPatients();
  }
}
Standalone components don’t require NgModule declarations, simplifying the application architecture.

Service Pattern

Services provide shared data and business logic:
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class PatientService {
  private patients: PatientData[] = [/* sample data */];
  
  getPatients(): PatientData[] {
    return this.patients;
  }
  
  getPatientById(id: number): PatientData | undefined {
    return this.patients.find(p => p.id === id);
  }
  
  addPatient(patient: any): void {
    this.patients.push({
      ...patient,
      id: this.patients.length + 1
    });
  }
}

Troubleshooting

If port 4200 is already in use, you can specify a different port:
ng serve --port 4300
Or stop the existing process:
# macOS/Linux
lsof -ti:4200 | xargs kill -9

# Windows
netstat -ano | findstr :4200
taskkill /PID <PID> /F
Sometimes the Angular CLI may encounter issues with incremental compilation:
  1. Stop the development server (Ctrl+C)
  2. Delete the Angular cache:
    rm -rf .angular/cache
    
  3. Restart the server:
    npm start
    
This usually means the dev server isn’t running or failed to start:
  1. Check the terminal for error messages
  2. Ensure all dependencies are installed: npm install
  3. Try clearing node_modules and reinstalling:
    rm -rf node_modules package-lock.json
    npm install
    
Check the browser console for errors. Common issues:
  • LocalStorage disabled: Enable localStorage in browser settings
  • JavaScript errors: Check console for TypeScript compilation errors
  • Router issues: Verify provideRouter(routes) is in app.config.ts
The application uses Boxicons and custom CSS:
  1. Verify Boxicons is in node_modules: ls node_modules/boxicons
  2. Check angular.json includes Boxicons CSS:
    "styles": [
      "node_modules/boxicons/css/boxicons.min.css",
      "src/styles.css"
    ]
    
  3. Clear browser cache and hard reload (Ctrl+Shift+R)

Development Tips

Fast Feedback Loop: Keep the dev server running while you code. Changes are reflected almost instantly.
Browser DevTools: Use Angular DevTools extension for Chrome/Edge to inspect components and debug state.
TypeScript Strict Mode: The project uses strict TypeScript settings. Pay attention to type errors - they prevent runtime bugs.

Next Steps

Architecture

Learn about the Angular standalone component architecture

Components

Explore the available components and how to use them

Services

Understand the service layer and data management

Building & Deployment

Build and deploy the application to production

Additional Resources

  • Angular DevTools: Chrome Extension
  • Angular CLI: Press h + Enter in the terminal for dev server help
  • Keyboard Shortcuts:
    • r + Enter - Reload browser
    • o + Enter - Open in default browser
    • h + Enter - Show help

Build docs developers (and LLMs) love