Learn Node UI ๐Ÿš€

October 21, 2025 ยท View on GitHub

A modern, interactive web UI to explore and test all endpoints from the learn-node backend API. Built with vanilla HTML, CSS, and JavaScript with a focus on accessibility, performance, and developer experience.

CI/CD Pipeline License

โœจ Features

User Features

  • ๐ŸŽจ Modern Interface: Responsive design with gradient backgrounds and smooth animations
  • ๐Ÿ”„ Interactive Testing: Test all API endpoints with a single click
  • ๐Ÿ“Š Real-time Responses: View formatted JSON and text responses with syntax highlighting
  • ๐Ÿ”Œ Connection Testing: Verify API connectivity before making requests
  • โš™๏ธ Configurable: Easy to point to different backend instances with persistent storage
  • ๐Ÿ“‹ Copy to Clipboard: Quick copy functionality for API responses
  • โŒจ๏ธ Keyboard Shortcuts: Ctrl+Enter to test connection, Ctrl+R to fetch all endpoints
  • ๐Ÿ“ฑ Fully Responsive: Works seamlessly on mobile, tablet, and desktop

Technical Features

  • โ™ฟ Accessible: WCAG 2.1 compliant with ARIA labels and keyboard navigation
  • ๐ŸŒ“ Dark Mode: Automatic dark mode support based on system preferences
  • ๐Ÿ”’ Secure: Security headers, CORS handling, and CSP policies
  • โšก Performance: Optimized with caching, compression, and minimal dependencies
  • ๐Ÿณ Docker Ready: Production-ready Docker image with health checks
  • ๐Ÿ”„ Auto-retry: Automatic retry logic for failed requests
  • ๐Ÿ’พ Persistent State: API URL saved to localStorage
  • ๐ŸŽฏ Error Handling: Comprehensive error handling and user feedback

๐Ÿ“‹ Endpoints Supported

  • GET / - Welcome message and API information
  • GET /ping - Simple ping-pong connectivity test
  • GET /healthz - Health check with system metrics
  • GET /info - Detailed application and system information

๐Ÿš€ Quick Start

Prerequisites

Option 1: Simple File Access

Simply open src/index.html in your web browser - no server required!

# Clone the repository
git clone https://github.com/dxas90/learn-node-ui.git
cd learn-node-ui

# Install dependencies
npm install

# Start development server
npm start

The application will open automatically at http://localhost:8080.

Option 3: Using Make

# Install dependencies and start server
make install
make start

Option 4: Using Docker

Option 4: Using Docker

# Build the image
docker build -t learn-node-ui:latest .

# Run the container
docker run -d \
  --name learn-node-ui \
  -p 8080:80 \
  -e API_URL=http://localhost:3000 \
  -e ENVIRONMENT=production \
  learn-node-ui:latest

# Or using make
make docker-build
make docker-run

Visit http://localhost:8080 in your browser.

๐ŸŽฏ Usage

  1. Configure API URL: Enter your backend API URL (default: http://localhost:3000)
  2. Test Connection: Click "Test Connection" to verify the backend is accessible
  3. Fetch Endpoints: Click "Fetch" on individual endpoints or use "Fetch All Endpoints"
  4. View Responses: Responses appear below each endpoint with:
    • Formatted JSON or text
    • Response time
    • Content type
    • Copy to clipboard button

Keyboard Shortcuts

  • Ctrl/Cmd + Enter - Test connection
  • Ctrl/Cmd + R - Fetch all endpoints
  • Tab - Navigate between interactive elements

๐Ÿ”ง Configuration

Environment Variables (Docker)

  • API_URL - Backend API URL (default: http://localhost:3000)
  • ENVIRONMENT - Environment name: localdev or production (default: production)
  • MY_DEBUG - Debug mode: false, true, or verbose (default: false)
  • SHOW_END_RESULT - Show configuration results (default: false)

Browser Configuration

The API URL is saved to localStorage and persists across sessions.

๐Ÿ› ๏ธ Development

Project Structure

learn-node-ui/
โ”œโ”€โ”€ src/                    # Source files
โ”‚   โ”œโ”€โ”€ index.html         # Main HTML with semantic structure
โ”‚   โ”œโ”€โ”€ script.js          # JavaScript with ES6+ features
โ”‚   โ””โ”€โ”€ styles.css         # Modern CSS with custom properties
โ”œโ”€โ”€ deploy/                # Deployment configurations
โ”‚   โ”œโ”€โ”€ 99-fix-access.sh  # Environment setup script
โ”‚   โ””โ”€โ”€ default.conf      # Nginx configuration
โ”œโ”€โ”€ .github/               # GitHub Actions workflows
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ ci-cd.yml     # CI/CD pipeline
โ”œโ”€โ”€ Dockerfile            # Multi-stage Docker build
โ”œโ”€โ”€ Makefile              # Development tasks
โ”œโ”€โ”€ package.json          # Dependencies and scripts
โ””โ”€โ”€ README.md             # This file

Available Scripts

# Development
npm start              # Start dev server (opens browser)
npm run dev            # Start dev server (no browser)

# Code Quality
npm run lint           # Run all linters
npm run format         # Format all code
npm run validate       # Lint and format

# Docker
npm run docker:build  # Build Docker image
npm run docker:run    # Run Docker container
npm run docker:stop   # Stop and remove container

# Testing
npm run test:accessibility  # Run accessibility tests
npm run test:lighthouse    # Run Lighthouse audit

Using Make

make help              # Show all available commands
make install           # Install dependencies
make dev               # Start development server
make lint              # Run linters
make format            # Format code
make validate          # Validate and format
make test              # Run tests
make docker-build      # Build Docker image
make docker-run        # Run Docker container
make ci                # Run CI pipeline locally

Code Quality Tools

  • ESLint - JavaScript linting
  • Stylelint - CSS linting
  • HTMLHint - HTML validation
  • Prettier - Code formatting
  • Pa11y - Accessibility testing
  • Lighthouse - Performance auditing

๐Ÿงช Testing

Automated Tests

# Run all tests
make test

# Individual tests
make test-accessibility
make test-lighthouse

Manual Testing

  1. Start the development server: npm start
  2. Start the backend API: learn-node
  3. Test all endpoints and verify responses
  4. Test responsive design at different viewport sizes
  5. Test keyboard navigation and screen reader compatibility
  6. Test error scenarios (API down, network errors, etc.)

๐Ÿณ Docker Deployment

Build and Run

# Build production image
docker build -t learn-node-ui:latest .

# Run with custom API URL
docker run -d \
  --name learn-node-ui \
  -p 8080:80 \
  -e API_URL=https://your-api.com \
  -e ENVIRONMENT=production \
  learn-node-ui:latest

# View logs
docker logs -f learn-node-ui

# Health check
curl http://localhost:8080/health

Docker Compose

version: '3.8'
services:
  ui:
    build: .
    ports:
      - "8080:80"
    environment:
      - API_URL=http://localhost:3000
      - ENVIRONMENT=production
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost/health"]
      interval: 30s
      timeout: 10s
      retries: 3

๐Ÿ”’ Security

  • Security Headers: X-Frame-Options, CSP, X-Content-Type-Options
  • CORS Configuration: Properly configured for API communication
  • Input Validation: URL validation and sanitization
  • No Secrets: No hardcoded secrets or API keys
  • Non-root User: Docker container runs as non-root user
  • Health Checks: Built-in health check endpoint

โ™ฟ Accessibility

  • WCAG 2.1 Level AA compliant
  • Semantic HTML5 structure
  • ARIA labels and live regions
  • Keyboard navigation support
  • Screen reader compatible
  • Focus management
  • High contrast mode support
  • Reduced motion support

๐ŸŒ Browser Support

  • Chrome/Edge (latest)
  • Firefox (latest)
  • Safari (latest)
  • Opera (latest)
  • Mobile browsers (iOS Safari, Chrome Mobile)

๐Ÿ“ˆ Performance

  • Lighthouse Score: 95+
  • Gzip compression enabled
  • Optimized caching strategy
  • Minimal JavaScript footprint
  • No external dependencies
  • Fast initial load time

๐Ÿค Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

๐Ÿ“ž Support

๐Ÿ™ Acknowledgments

  • Built with modern web standards
  • Inspired by API testing tools like Postman and Insomnia
  • Thanks to all contributors

Made with โค๏ธ for learning Node.js | Report Bug | Request Feature