A comprehensive tram information system for Manchester, built with .NET and Aspire. This solution provides web and API services for accessing tram schedules, service updates, and stop information with caching, search indexing, and database management capabilities.
- Overview
- Projects
- Prerequisites
- Getting Started (Local)
- Getting Started (Remote)
- Technology Stack
- Project Structure
- License
This repository contains a distributed application architecture for managing and serving tram information:
- π Website and API for accessing tram schedules and stop information
- π Background jobs for data caching, database updates, and search indexing
- π Aspire orchestration for cloud-native deployment
- π Elasticsearch powered search functionality
- πΎ PostgreSQL database with Redis caching layer
- βοΈ Azure Storage integration for blob and table data
The Aspire orchestration host that configures and manages all services, infrastructure dependencies, and distributed application architecture.
Key Features:
- π Aspire orchestration and service discovery
- π§ Infrastructure resource management (PostgreSQL, Redis, Elasticsearch, Azure Storage)
- βοΈ Development, Testing and Production environment configurations
Shared service definitions and extensions for Aspire integration across all projects.
Key Features:
- π Common service configurations
- π‘ Service defaults and telemetry
- π Reusable extensions
Background worker service that manages data caching operations using Quartz.NET schedulers. Ensures real-time tram service and trip data is cached efficiently.
Key Features:
- β° Scheduled cache refresh jobs
- π Real-time data synchronization
- π Stop-specific caching strategies
Background worker service for database management tasks. Handles scheduled updates, data imports, and database maintenance operations.
Key Features:
- ποΈ Database update scheduling
- π GTFS data creation and processing
- π Schedule synchronization
Background worker service that manages Elasticsearch indexing operations. Keeps search indices up-to-date with the latest stop and service information.
Key Features:
- π Search index management
- π Stop and service indexing
- π Real-time index updates
RESTful API service providing programmatic access to tram schedules and stop data.
Key Features:
- π RESTful endpoints for tram data
- π Health checks and monitoring
- π Fast API responses with caching
Production monitoring service that continuously validates the web application advertisements using Playwright automated testing.
Key Features:
- π― Banner advertisement validation
- π Production website validation
- β Playwright automation
Blazor web application providing an interactive user interface for accessing tram schedules and stop information. Offers scheduled and stop updates with responsive design for an optimal user experience across devices.
Key Features:
- π¨ Modern Blazor UI
- π± Responsive design
- πΎ Local storage cache
Comprehensive Playwright test suite for website pages including validation of API endpoints and core functionality. Screenshots uploaded to blob storage for review.
Key Features:
- β Unit and integration tests
- π§ͺ API endpoint testing
- πΈ Screenshot capture and storage
Shared utilities, extensions, and helper classes used across web projects.
Key Features:
- π Common utility functions
- π Extension methods
- π§ Reusable tools
- Git
- GitHub CLI
- Docker Desktop
- .NET SDK
- Aspire CLI
- PowerShell
- AutoMapper
- Telerik UI for Blazor
- Traveline Data Set
- Adsterra Banners
git clone https://github.com/philvessey/TramTimes.Manchester.git
cd TramTimes.Manchestercp ./nuget.tmp ./nuget.config # Replace {{ TELERIK_KEY }} with your Telerik API keycp /path/to/your/telerik-license.txt ./TramTimes.Manchester/telerik-license.txtaspire runssh -i <public-key> root@<server-address>nano setup.sh # Copy file contents from setup.sh
sudo bash setup.sh # Follow prompts when script completesssh -i <public-key> admin@<server-address>nano cache.yml # Copy file contents from .docker/cache.yml
nano cache.sh # Copy file contents from .scripts/cache.sh
sudo bash cache.sh # Follow prompts when script completesnano search.yml # Copy file contents from .docker/search.yml
nano search.sh # Copy file contents from .scripts/search.sh
sudo bash search.sh # Follow prompts when script completesnano server.yml # Copy file contents from .docker/server.yml
nano server.sh # Copy file contents from .scripts/server.sh
sudo bash server.sh # Follow prompts when script completesaspire deploy- .NET 10.0 - Core framework
- C# 13 - Programming language
- Aspire 13 - Cloud-native orchestration
- ASP.NET Core - Web API and hosting
- Blazor - Interactive web UI
- SignalR - Real-time communication
- PostgreSQL - Primary database
- Redis - Caching layer
- Elasticsearch - Search indexing
- Quartz.NET - Job scheduling and execution
- Hosted Services - Background workers
- Azure Containers - Cloud deployment
- Polly - Resilience and transient-fault-handling
- Health Checks - Service monitoring
- Telemetry - OpenTelemetry integration
- Telerik UI for Blazor - UI components
- Playwright - Website end-to-end testing
- Adsterra - Banner advertising integration
TramTimes.Manchester/
βββ TramTimes.Aspire.Host/ # Aspire host application
βββ TramTimes.Aspire.Services/ # Aspire service defaults
βββ TramTimes.Cache.Jobs/ # Redis cache jobs
βββ TramTimes.Database.Jobs/ # PostgreSQL database jobs
βββ TramTimes.Search.Jobs/ # Elasticsearch index jobs
βββ TramTimes.Web.Api/ # Web backend application
βββ TramTimes.Web.Jobs/ # Web frontend jobs
βββ TramTimes.Web.Site/ # Web frontend application
βββ TramTimes.Web.Tests/ # Web frontend tests
βββ TramTimes.Web.Utilities/ # Web utilities library
βββ Directory.Build.props # Shared build configuration
βββ Directory.Packages.props # Centralized package management
βββ TramTimes.slnx # Solution file
Each project follows a consistent structure:
Program.cs- Application entry pointBuilders/- Service and resource buildersData/- Data models and repositoriesServices/- Business logic servicesExtensions/- Extension methods and helpersModels/- Domain models and DTOsProperties/- Assembly information and settings
.docker/- Contains Docker Compose files for infrastructure services.scripts/- Helper scripts for starting services and deployment tasks
This project is licensed under the MIT License - see the LICENSE file for details.