Skip to content

heyding/angular-tailwind-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

68 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Angular + Tailwind Template

πŸš€ Enterprise-ready Angular 19 template with Tailwind CSS, 25+ features, and complete dark mode support.

Angular TypeScript Tailwind CSS NgRx

✨ Features

🎨 UI Components

  • Button Component - Multiple variants (primary, secondary, danger, success, outline), sizes, and states
  • Modal Component - Confirmation, info, and delete modals with service integration
  • Toast Notifications - Success, error, warning, and info toasts with animations
  • Icon Component - 13+ Heroicons with customizable sizes and colors
  • Table Component - Sortable, paginated, filterable with sticky headers
  • Loading Spinner - Elegant spinner with fade-in animations
  • Skeleton Loader - Content placeholders for loading states
  • Theme Toggle - Sun/Moon icon with smooth transitions

πŸ”§ Directives & Pipes

  • HighlightDirective - Hover effects with customizable colors
  • TooltipDirective - Smart positioning with viewport boundary detection
  • ClickOutsideDirective - Detect clicks outside elements
  • HighlightPipe - Text highlighting with search terms
  • TimeAgoPipe - Relative time display (e.g., "2 hours ago")
  • TruncatePipe - Text truncation with ellipsis
  • FormatNumberPipe - Number formatting with localization

πŸŒ™ Dark Mode

  • Signal-based Theme Service - Reactive theme state management
  • Persistent Theme - localStorage integration
  • Full Coverage - All components support dark mode
  • Smooth Transitions - Animated theme switching

πŸ—οΈ Architecture & Infrastructure

  • Enterprise Structure - Features, core, shared, store, layouts, models, constants, utils
  • Authentication - JWT-based auth with guards and interceptors
  • API Service - Centralized HTTP client with error handling
  • State Management - NgRx store with effects and selectors
  • Error Handling - Global error handler with logging service
  • Loading State - Automatic loading indicators with interceptor
  • Feature Flags - Runtime feature toggles for A/B testing
  • Breadcrumb Service - Dynamic breadcrumb navigation
  • Retry Logic - Automatic HTTP retry with exponential backoff

πŸ§ͺ Angular CDK Integration

  • Virtual Scrolling - Efficient rendering of large lists (10,000+ items)
  • Drag & Drop - Sortable lists with visual feedback

🌐 Internationalization

  • Multi-language Support - English and German translations
  • 500+ Translation Keys - Comprehensive i18n coverage
  • Language Switcher - Runtime language switching

πŸ“± Demo Pages

  • Home - Hero section with gradient and feature cards
  • Components Demo - Interactive showcase of all components
  • Features Demo - Table with pipes, directives, and filtering
  • API Demo - CRUD operations with error handling
  • Virtual Scroll Demo - Performance demo with 10,000 items
  • Drag & Drop Demo - Interactive list sorting
  • Login - Authentication demo page
  • Admin Module - Lazy-loaded admin dashboard (users, settings)
  • 404 Page - Stylish error page

πŸš€ Getting Started

Prerequisites

  • Node.js: 20.19.4 (see .nvmrc)
  • npm: 10.x or higher

Installation

# Clone the repository
git clone https://github.com/heyding/angular-tailwind-template.git

# Navigate to project
cd angular-tailwind-template

# Install dependencies
npm install

# Copy environment file
cp .env.example .env

# Start dev server
npm start

Visit http://localhost:4200 πŸŽ‰

πŸ“¦ Available Scripts

# Development server (http://localhost:4200)
npm start

# Production build
npm run build

# Run tests
npm test

# Code formatting
npm run format

# Linting
npm run lint

πŸ—οΈ Project Structure

src/app/
β”œβ”€β”€ core/                    # Singleton services, guards, interceptors
β”‚   β”œβ”€β”€ guards/             # AuthGuard
β”‚   β”œβ”€β”€ interceptors/       # Auth, Error, Loading, Retry
β”‚   β”œβ”€β”€ services/           # API, Auth, Theme
β”‚   β”œβ”€β”€ handlers/           # Global error handler
β”‚   β”œβ”€β”€ models/             # Core interfaces
β”‚   β”œβ”€β”€ header/             # Header component
β”‚   └── footer/             # Footer component
β”œβ”€β”€ features/               # Feature modules
β”‚   β”œβ”€β”€ home/              # Home feature (pages, components, store)
β”‚   └── admin/             # Admin feature (lazy-loaded)
β”œβ”€β”€ shared/                 # Reusable components, directives, pipes
β”‚   β”œβ”€β”€ components/        # Button, Modal, Toast, Table, Icon, etc.
β”‚   β”œβ”€β”€ directives/        # Highlight, Tooltip, ClickOutside
β”‚   β”œβ”€β”€ pipes/             # TimeAgo, Truncate, FormatNumber, Highlight
β”‚   β”œβ”€β”€ services/          # Modal, Toast, Loading, Logger, FeatureFlags
β”‚   └── models/            # Shared interfaces
β”œβ”€β”€ store/                  # NgRx global state
β”œβ”€β”€ layouts/                # Layout components (future)
β”œβ”€β”€ models/                 # Global interfaces
β”œβ”€β”€ constants/              # App constants
└── utils/                  # Helper functions

🎨 Component Usage

Button Component

import { ButtonComponent } from '@shared/components/button/button.component';

// In template
<app-button [variant]="'primary'" [size]="'md'" (clicked)="handleClick()">
  Click Me
</app-button>

Toast Notifications

import { ToastService } from '@shared/services/toast.service';

constructor(private toastService: ToastService) {}

showSuccess() {
  this.toastService.success('Operation completed!');
}

Modal Service

import { ModalService } from '@shared/services/modal.service';

constructor(private modalService: ModalService) {}

async confirmDelete() {
  const result = await this.modalService.confirm({
    title: 'Delete Item',
    message: 'Are you sure?'
  });
  
  if (result) {
    // User confirmed
  }
}

Dark Mode

import { ThemeService } from '@core/services/theme.service';

constructor(private themeService: ThemeService) {}

toggleTheme() {
  this.themeService.toggleTheme();
}

getCurrentTheme() {
  return this.themeService.theme(); // Signal
}

🎯 Demo Pages

Navigate to these routes to see features in action:

  • / - Home page with hero section
  • /components - All components showcase
  • /features - Features demo with table
  • /api - API integration demo
  • /login - Authentication demo
  • /virtual-scroll - Virtual scrolling demo
  • /drag-drop - Drag & drop demo
  • /admin - Admin dashboard (lazy-loaded)

βš™οΈ Configuration

Tailwind CSS

Customize theme in tailwind.config.ts:

module.exports = {
  darkMode: 'class', // Enable dark mode
  theme: {
    extend: {
      colors: {
        // Add custom colors
      }
    }
  }
}

Environment Variables

See .env.example for available configuration options:

API_BASE_URL=http://localhost:3000
FEATURE_FLAG_DARK_MODE=true
LOG_LEVEL=debug

Translations

Add new languages in src/assets/i18n/:

  • en.json - English translations
  • de.json - German translations

πŸ§ͺ Testing

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Generate coverage report
npm run test:coverage

πŸ“ Best Practices

  • βœ… Standalone Components - All components use standalone API
  • βœ… Signals - Reactive state with Angular Signals
  • βœ… Functional Guards - Modern functional guard syntax
  • βœ… Strict TypeScript - Type safety enabled
  • βœ… Mobile-First - Responsive design approach
  • βœ… Accessibility - ARIA labels and keyboard navigation
  • βœ… Performance - Lazy loading, OnPush change detection
  • βœ… Code Style - Prettier + ESLint

πŸš€ Deployment

Production Build

npm run build

Output in dist/angular-tailwind-template/

Docker Support (Coming Soon)

# Future: Dockerfile for containerized deployment

🀝 Contributing

Contributions are welcome! Please:

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

πŸ“„ License

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

πŸ”— Resources

πŸ™ Acknowledgments

  • Angular Team - Amazing framework
  • Tailwind Labs - Beautiful utility-first CSS
  • NgRx Team - Powerful state management
  • Heroicons - Gorgeous SVG icons

Made with ❀️ by Tommy Heyding

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages