This is a multi-tenant Angular application built with Angular Material 16 and Tailwind CSS 2.2.19. The application shows different content, branding, and styling for different tenants based on JSON configuration files.
- Dynamic Tenant Loading: Content and styling are loaded dynamically based on tenant configuration
- Angular Material 16: Modern UI components and Material Design icons
- Tailwind CSS 2.2.19: Utility-first CSS framework for responsive design
- JSON Configuration: Easy tenant setup through JSON files
- Responsive Design: Mobile-friendly layout that works on all screen sizes
- Theme Customization: Each tenant can have custom colors, logos, and content
-
Install dependencies:
npm install
-
Start the development server:
npm start
-
Open your browser and navigate to:
- Default tenant:
http://localhost:4200 - Specific tenant:
http://localhost:4200?tenant=tenant1 - Alternative tenants:
http://localhost:4200?tenant=tenant2orhttp://localhost:4200?tenant=tenant3
- Default tenant:
- tenant1 - Acme Corporation (Blue theme)
- tenant2 - TechVision Solutions (Green theme)
- tenant3 - Global Finance Group (Purple theme)
Each tenant is configured through a JSON file in src/assets/tenants/:
{
"id": "tenant1",
"name": "Company Name",
"theme": {
"primaryColor": "#1976d2",
"secondaryColor": "#dc004e",
"backgroundColor": "#ffffff",
"textColor": "#333333"
},
"branding": {
"logo": "data:image/svg+xml;base64,...",
"favicon": "favicon.ico",
"companyName": "Company Name"
},
"content": {
"title": "Welcome Title",
"subtitle": "Subtitle text",
"heroImage": "data:image/svg+xml;base64,...",
"description": "Company description",
"features": [
{
"title": "Feature Name",
"description": "Feature description",
"icon": "material_icon_name"
}
]
},
"contact": {
"phone": "+1-555-0000",
"email": "contact@company.com",
"address": "123 Main St, City, State 12345"
}
}The application determines which tenant to load using:
- Query Parameter:
?tenant=tenant1in the URL - Subdomain: In production, tenants can be detected from subdomain (e.g.,
tenant1.yourapp.com) - Default: Falls back to
tenant1for development
- CSS custom properties are updated dynamically based on tenant theme colors
- Page title and favicon are updated per tenant
- All styling adapts to tenant-specific color schemes
- TenantService: Handles loading and caching tenant configurations
- AppComponent: Main component that renders tenant-specific content
- Dynamic Templates: Template uses Angular data binding to show tenant content
- Create a new JSON file in
src/assets/tenants/(e.g.,tenant4.json) - Follow the configuration structure above
- Use data URLs for logos and hero images, or add actual image files to assets
- The tenant will be automatically available at
?tenant=tenant4
You can extend the tenant configuration by:
- Adding new properties to the JSON structure
- Updating the TypeScript interfaces in
src/app/models/tenant.interface.ts - Modifying the template in
src/app/app.component.html
- Global styles are in
src/styles.scss - Tailwind configuration is in
tailwind.config.js - Component-specific styles use Tailwind utility classes
# Development build
npm run build
# Production build
npm run build --prod- Angular 16: Frontend framework
- Angular Material 16: UI component library
- Tailwind CSS 2.2.19: Utility-first CSS framework
- TypeScript: Type-safe JavaScript
- RxJS: Reactive programming library
This project was generated with Angular CLI version 16.2.16.