Sign inSign up

sushantjadhav/frontend

By sushantjadhav

•Updated about 1 year ago

Image
0

338

sushantjadhav/frontend repository overview

⁠Frontend Service - API Testing Dashboard

A modern, responsive frontend application built with TypeScript and Express.js for testing backend API endpoints. This service provides an intuitive web interface to interact with backend services and monitor their health status.

ā šŸš€ Features

  • Modern UI Design: Clean, responsive interface with professional blue color scheme
  • API Testing Dashboard: Test multiple backend endpoints with dedicated buttons
  • Real-time Health Monitoring: Monitor backend service health and status
  • Comprehensive Debug Logging: Detailed console logging for troubleshooting
  • TypeScript: Type-safe development with modern JavaScript features
  • Docker Optimized: Multi-stage build for minimal container size

ā šŸŽÆ What This Service Does

This frontend service serves as a centralized API testing dashboard that allows you to:

  1. Test Backend APIs: Interact with backend services through a web interface
  2. Monitor Service Health: Check health and status of backend services
  3. Debug API Calls: View detailed request/response information in console logs
  4. Visual Feedback: Get immediate visual feedback on API call success/failure
⁠Available API Tests:
  • šŸ“” Backend API Endpoint: Tests the main backend service (/)
  • šŸ„ Backend Health Check: Monitors backend health status (/api/healthcheck)
  • šŸ“Š Backend Status Check: Checks backend running status (/api/status)

ā šŸ› ļø Technology Stack

  • Runtime: Node.js 18
  • Framework: Express.js
  • Language: TypeScript
  • Styling: CSS3 with modern gradients and animations
  • Package Manager: npm
  • Containerization: Docker

ā šŸš€ Quick Start

  1. Build the image:

    docker build -t frontend-service .
    
  2. Run the container:

    docker run -p 80:80 -e BACKEND_URL=http://backend-service:8080 frontend-service
    
  3. Access the application:

⁠Development Mode
  1. Install dependencies:

    npm install
    
  2. Start development server:

    npm run dev
    
  3. Build for production:

    npm run build
    npm start
    

ā šŸ“ Project Structure

frontend/
ā”œā”€ā”€ src/
│   └── app.ts              # Main TypeScript application
ā”œā”€ā”€ dist/                   # Compiled JavaScript (generated)
ā”œā”€ā”€ package.json            # Dependencies and scripts
ā”œā”€ā”€ tsconfig.json          # TypeScript configuration
ā”œā”€ā”€ Dockerfile             # Container definition
└── README.md              # This file

ā šŸ”§ Configuration

⁠Environment Variables
  • BACKEND_URL: Backend service URL (default: http://localhost:8080)
  • NODE_ENV: Node.js environment (default: production)
  • PORT: Server port (default: 80)
⁠Available Scripts
  • npm run dev: Start development server with hot reload
  • npm run build: Compile TypeScript to JavaScript
  • npm start: Start production server
  • npm run watch: Watch mode for TypeScript compilation

ā šŸŽØ UI Features

  • Responsive Design: Works on desktop and mobile devices
  • Loading States: Visual feedback during API calls with disabled buttons
  • Error Handling: Clear error messages and status indicators
  • Modern Styling: Professional blue color scheme with gradients
  • Compact Layout: Optimized for efficient space usage
  • Status Indicators: Visual dots showing service status

ā šŸ” API Endpoints

⁠Frontend Endpoints
  • GET / - Main dashboard interface
  • GET /call-backend - Proxy to backend API
  • GET /call-backend-healthcheck - Proxy to backend health check
  • GET /call-backend-status - Proxy to backend status check
  • GET /healthcheck - Frontend health check

⁠🐳 Docker Details

⁠Image Specifications
  • Base Image: Node.js 18 Alpine (lightweight)
  • Port: 80 (configurable)
  • Size: Optimized with multi-stage build
  • Dependencies: Production-only packages
⁠Build Process
  1. Build Stage: Install all dependencies and compile TypeScript
  2. Production Stage: Copy only compiled code and production dependencies
  3. Result: Minimal production image with only necessary files

ā šŸ” Debugging

The application provides comprehensive logging:

  • Request Logging: All incoming requests with timestamps
  • API Call Details: Detailed backend API call information
  • Error Tracking: Complete error information for troubleshooting
  • Response Monitoring: Full response data and status codes
⁠Console Logs Include:
  • Request timestamps and headers
  • Backend URL configuration
  • Response status and data
  • Detailed error information
  • Network connectivity issues

ā šŸš€ Deployment

⁠Production Deployment
  1. Build the Docker image
  2. Configure environment variables
  3. Deploy using container orchestration
  4. Set up reverse proxy if needed
⁠Scaling
  • Can be scaled horizontally
  • Stateless design allows multiple instances
  • Load balancer can distribute traffic

ā šŸ“Š Performance

  • Fast Startup: Optimized Docker image for quick container startup
  • Low Memory: Minimal memory footprint
  • Efficient Builds: Multi-stage Docker build reduces image size
  • TypeScript: Compile-time error checking for reliability

ā šŸ¤ Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

ā šŸ“ License

This project is open source and available under the MIT License⁠.

ā šŸ†˜ Support

For issues and questions:

  1. Check the console logs for detailed error information
  2. Verify the backend service is running and accessible
  3. Check environment variable configuration
  4. Review network connectivity between services

Built with ā¤ļø using TypeScript, Express.js, and Docker

Tag summary

Content type

Image

Digest

sha256:5b610ed64…

Size

49.7 MB

Last updated

about 1 year ago

docker pull sushantjadhav/frontend