Skip to content

Nbat-Project-Final/Nbat-project-frontend

Repository files navigation

NBAT Frontend - Setup & Quick Start

Frontend for NBAT rental platform built with Angular 17 and TypeScript.

Prerequisites

  • Node.js 18+
  • npm 9+ or yarn
  • Angular CLI 17+ (optional but recommended)

Quick Setup

1. Install Dependencies

npm install

2. Configure Environment

Edit src/environments/environment.development.ts:

export const environment = {
  API_URL: "http://localhost:8080/api",
};

Edit src/environments/environment.ts for production:

export const environment = {
  API_URL: "https://your-backend-api.com/api",
};

3. Start Development Server

npm start

Application runs on http://localhost:4200

Development Proxy

The development server uses proxy.conf.mjs to forward API requests to the backend:

  • Frontend URL: http://localhost:4200
  • Proxy forwards:
    • /api/*http://localhost:8080/api/*
    • /oauth2/*http://localhost:8080/oauth2/*
    • /loginhttp://localhost:8080/login
    • /assets/*http://localhost:8080/assets/*

This allows you to develop without CORS issues. In production, the frontend and backend are served from the same origin.

Verify Setup

Visit: http://localhost:4200

  • You should see the NBAT home page
  • Click "Login" to verify Auth0 integration
  • Look for tenant and landlord features

Building

Development Build

ng build

Production Build

ng build --configuration production

Output: dist/nbat-clone-front/

Testing

Frontend tests are configured and mostly passing:

# Run unit tests
npm test -- --watch=false

# Run with coverage
npm test -- --code-coverage

# Run e2e tests (if available)
ng e2e

Test Results:

  • ✅ TenantListingService: PASS
  • ✅ BookingService: PASS
  • ✅ AppComponent: PASS
  • ✅ NavbarComponent: PASS
  • ✅ SearchComponent: PASS
  • ✅ SearchDateComponent: PASS
  • ✅ DisplayListingComponent: PASS
  • ✅ FooterStepComponent: PASS
  • ⚠️ FooterComponent: Icon library (non-blocking)

Total: 8/9 tests passing (89% success rate)

Note: All components are fully functional. The FooterComponent test has a FontAwesome icon library issue that doesn't affect the application's runtime behavior.

Project Structure

src/
├── app/
│   ├── core/                    # Core services and interceptors
│   │   ├── auth/
│   │   │   ├── auth.service.ts
│   │   │   ├── csrf.interceptor.ts
│   │   │   └── auth.interceptor.ts
│   │   ├── user.service.ts
│   │   ├── validation.service.ts
│   │   └── error-handler.service.ts
│   ├── layout/                  # Layout components
│   │   ├── navbar/
│   │   └── footer/
│   ├── shared/                  # Shared components
│   │   ├── property-card/
│   │   ├── search-filter/
│   │   └── book-date/
│   ├── tenant/                  # Tenant features
│   ├── landlord/                # Landlord features
│   ├── email-verified/          # Email verification
│   ├── app.config.ts
│   ├── app.routes.ts
│   └── app.component.ts
├── environments/
├── assets/
├── styles.scss
├── main.ts
└── index.html

Docker Deployment

Build Image

docker build -t nbat-frontend:1.0 .

Run Container

docker run -d \
  -p 4200:80 \
  -e API_URL=http://localhost:8080/api \
  nbat-frontend:1.0

Docker Compose

docker-compose up -d frontend

Features

Tenant Features

  • Browse rental properties
  • Search with filters
  • View property details
  • Create bookings
  • Manage bookings
  • Become a landlord

Landlord Features

  • Create property listings
  • Manage listings
  • View bookings
  • Track revenue

Security

  • OAuth2 authentication (Auth0)
  • CSRF token protection
  • Session management
  • Role-based access control
  • Automatic token refresh

Troubleshooting

Port 4200 in use

ng serve --port 4300

CORS Error

  • Verify API URL in environment
  • Check backend CORS configuration

Auth0 Login Fails

  • Verify Auth0 credentials in environment
  • Check callback URL matches Auth0 settings

Components Not Found

# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install

Full Documentation

For complete architecture details, component reference, service documentation, and development guide, see FRONTEND_DOCUMENTATION.md

Status

✅ Production Ready - January 30, 2026

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors