A comprehensive iOS application designed to enhance the safety and travel experience of Trenord rail service passengers. TrenordLink integrates real-time train information, location sharing, emergency reporting, and trip planning into a single, user-friendly interface. For context, Trenord operates the regional rail service across the entire Lombardy region in Northern Italy, serving nearly 800,000 passengers every day.
All proprietary assets rights belong to the Trenord Company. This project is developed for educational and research purposes as part of the Design and Implementation of Mobile Applications (DIMA) course at Politecnico di Milano, held by Prof. Luciano Baresi, for the AY 2024/25.
TrenordLink addresses the challenges faced by public transit users by providing:
- Real-time train tracking and station information
- Integrated safety features including location sharing with trusted contacts
- Emergency reporting system with direct communication to train conductors
- Comprehensive trip planning with route search and bookmarking
- Cross-platform support for iPhone and iPad with optimized interfaces
- Route Search & Trip Planning: Search for train routes between stations with detailed information including departure/arrival times, duration, and intermediate stops
- Real-time Map Integration: Interactive map displaying user location, Trenord stations, and real-time friend locations
- Saved Trips: Bookmark frequently used routes for quick access
- Recent Searches: Automatically saved search history for convenience
- Friend Location Sharing: Share live location with trusted contacts for defined periods (2, 8, or 24 hours)
- Emergency Reporting: Report emergencies directly from the app with automatic location and train information
- Conductor Panel: Dedicated interface for train conductors to manage and respond to emergencies
- Background Location Services: Continue location sharing even when app is in background
- Cross-platform UI: Responsive design optimized for both iPhone and iPad
- User Authentication: Secure registration and login system
- Profile Management: Comprehensive user profile with friend management capabilities
- Real-time Updates: Live updates every 15 seconds for location and train information
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β iOS App ββββββΆβ Firebase βββββββ Admin Scripts β
β (SwiftUI) β β Backend β β (Node.js) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Frontend: Swift, SwiftUI, iOS SDK
- Backend: Firebase (Firestore, Authentication, Admin SDK)
- Admin Tools: Node.js scripts for database management
- External APIs: Custom Trenord API for real-time train data
dima-polimi-trenord/
βββ trenordsafe/ # iOS Application
β βββ Models/ # Data models
β βββ Views/ # SwiftUI views
β βββ ViewModels/ # MVVM view models
β βββ Providers/ # Data providers
β βββ Services/ # Core services
β βββ Networking/ # API clients
βββ trenordsafeTests/ # Unit tests
βββ trenordsafeUITests/ # UI tests
βββ scripts/ # Node.js admin scripts
βββ docs/ # Documentation
βββ dimatex/ # LaTeX documentation
βββ firestore.rules # Firebase security rules
βββ package.json # Node.js dependencies
- Xcode 14.0 or later
- iOS 16.0 or later
- Node.js 18.0 or later
- Firebase account with active project
-
Clone the repository
git clone https://github.com/AlessandroVacca/dima-polimi-trenord.git cd dima-polimi-trenord -
Open the iOS project
open trenordsafe.xcodeproj
-
Configure Firebase
- Add your
GoogleService-Info.plistto thetrenordsafe/directory - Ensure Firebase Authentication and Firestore are enabled
- Add your
-
Build and run
- Select your target device/simulator
- Build and run the project (β+R)
-
Install Node.js dependencies
npm install
-
Configure Firebase Admin SDK
- Place your Firebase Admin SDK key file in the root directory
- Update the path in scripts if necessary
-
Run admin scripts
node scripts/setup-users-db.js node scripts/upload-stations.js
# Run from Xcode
β+U# Run specific UI test schemes
xcodebuild test -scheme trenordsafe-iPhone -destination 'platform=iOS Simulator,name=iPhone 14'- Unit Tests: Comprehensive coverage of ViewModels, Models, and Services
- UI Tests: End-to-end testing of user workflows
- Integration Tests: Authentication, emergency reporting, and location services
The application uses Firestore with the following main collections:
users: User profiles and authentication datatrips: Saved trip informationemergencies: Emergency reports and statusfriends: Friend relationships and location sharing permissionsstations: Trenord station data with coordinates
Available in the scripts/ directory:
setup-users-db.js: Initialize user databaseupload-stations.js: Upload station dataclear-friendships.js: Reset friendship dataupgrade-user-to-conductor.js: Grant conductor privileges
- Firebase Security Rules: Comprehensive rules defined in
firestore.rules - User Authentication: Secure Firebase Authentication integration
- Location Privacy: Granular control over location sharing duration and recipients
- Emergency Data: Secure handling of sensitive emergency information
- Selective Sharing: Users control who can see their location and for how long
- Emergency Context: Location and train information automatically included in emergency reports
- Data Retention: Configurable data retention policies
see [Insert repo link]
- api-trenitalia: Italian train data integration
- Firebase Admin SDK: Backend administrative operations
- Core Location: iOS location services
This project is developed for educational purposes as part of the DIMA course at Politecnico di Milano. All proprietary assets and rights belong to Trenord Company.
For detailed technical documentation, see the docs/ directory:
- Architecture Overview
- iOS App Architecture
- Backend Architecture
- Features Documentation
- System Deep Dive
This project is developed for educational purposes. All Trenord trademarks, logos, and proprietary information belong to Trenord Company.