| Criteria | Where to Find It (File Paths, Links, or Explanations) |
|---|---|
| Team Standards: Cohesion | Extra Documentation file, GitHub issues and GitHub Actions |
| Team Standards: Documentation | Extra Documentation file and throughout the project |
| Team Standards: Version Control Workflow | .git folder, GitHub branches and GitHub commits |
| Design & Structure | Extra Documentation file and throughout the project |
| GUI: Clever and Interesting Design | Main directory: CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/ui. Screens stored in screens subdirectory UI-level theme setup in themes subdirectory, theme configuration files. Custom UI components used in screens stored in components subdirectory. Custom Map UI utilities stored in CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/utils/MapUtils.kt |
| Testing Documentation | Test reports directory, test/java/com/team45/mysustainablecity/tests and androidTest/java/com/team45/mysustainablecity folders |
| Functionality and Features | Android apps use the Model View ViewModel Architecture (MVVM). Model refers to the data. The repositories that interact with the database are stored in the CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\reps\directory.View refers to the UI , all UI components can be found in CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\ui\with the exception of a few UI utilities specific to the map, stored in the CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\utils\MapUtils.kt file.The ViewModels serve as the bridge to the View and the Model. This is where the data is used and the logic is carried out, so the View can remain 'dumb' and be reactive. The ViewModels are stored in the CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\viewmodel\ directory.Database Integration 1. Supabase Client Setup, enables the client side app to interact with the database: CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/data/remote/SupabaseClient.kt2. a) Supabase Realtime Channel Manager, provides functionality to establish open lines with the database to listen for updates instead of periodically polling the database: CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/data/remote/SupabaseChannelManager.ktb) Channel class definition. A channel represents a subscription to a real-time Postgres change channel for a specific table: CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/data/classes/Channel.kt3. Repositories, where the functions are defined that actually interact with the database, where data is gotten from the database and where data is sent to the database. Repositories are stored in the CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\reps\ directory.a) User Repository, handles database interaction relating to the user, including alerts: UserRep.ktb) Post Repository, handles database interaction relating to posts: PostRep.ktc) Moderator Repository, handles database interaction as needed for moderator functionality: ModRep.ktAccess Control Certain functionality and UI components are only available to moderator role users. For example: 1. The dropdown menu for a post, available through the "More" button, contains moderator-specific options for a moderator, as can be found in CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\ui\screens\PostScreen.kt2. In CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\reps\PostRep.kt, posts fetched/updated by the realtime functionality correctly remained/switched to being hidden for non-moderators.3. In the database edge function for fetching all posts, return_post_details2, roles are accounted for, not fetching certain posts for regular users. The edge function is part of the database, there is information on finding those in the database readme. 4. On the map, filter pills referring to the status of a post are only visible and usable for moderators. This is done in the CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\ui\components\DiscoverMap.kt file.User Interaction This requirement overlaps with what was explained in the Architecture section. File paths for what is referenced here can be found there. There are elements of both passive and active interaction between the app and the user. The user sees and interacts with the UI screens. If the user presses a button, that View (for example, the 'Clear all' button in AlertScreen.kt) will call a function in that screen's ViewModel (AlertsViewModel.kt). That ViewModel will run the relevant logic and through Kotlin flows, the UI updates, reflecting the effect of the user's actions.Through the realtime channels, if an post (for example) is posted separately from the user, and the screen is already loaded, it will update dynamically, containing the relevant post. Alerts There is an alerts screen, at CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\ui\screens\AlertScreen.kt.The related alerts ViewModel is at CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\viewmodel\AlertsViewModel.ktThe alerts fetching/sending is handled in the user repository, including the realtime functionality: CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\reps\UserRep.ktDashboard The app does not have a central 'Dashboard', though statistics such as like counts, comment counts and post dates can be found on each post card in DiscoverScreen.kt.The map screen CSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\ui\screens\HomeScreen.ktCSC2033-team45-Project\app\src\main\java\com\team45\mysustainablecity\ui\components\DiscoverMap.ktmay also be considered the dashboard, since that is what the app initially loads into upon launching, and is the way to view posts with regard to their geographical locations. Docker A docker container is used to run a Postgres database based on a Supabase database and can be found in the my_sustainable_city_db directory, where information on how to setup the dataabase can also be found Location Services Location services are used to geotag posts when creating or editing them, and to render posts at their geographical locations on the map. Location picking UI — dedicated component for the user to pick a location on a map: CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/ui/components/LocationPickerScreen.ktPost creation with location geotagging — navigates to LocationPickerScreen and receives the result back via SavedStateHandle; renders an inline static map preview (LocationPreviewCard) of the selected coordinates:CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/ui/screens/CreatePostScreen.ktPost editing with location geotagging: CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/ui/screens/EditPostScreen.ktMap display and location-aware UI: CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/ui/components/DiscoverMap.kt — the map composable that renders posts at their geographical locationsViewModel logic for location and map state management: CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/viewmodel/MapViewModel.ktMap utilities (marker clustering, location calculations, etc.): CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/utils/MapUtils.ktGoogle Maps is used as the maps provider via the Google Maps Compose library (v8.2.0), with the API key configured through MAPS_API_KEY in local.properties. External APIs The only external API used is the Google Maps API, used to render interactive maps throughout the app. The API key is obtained through the Google Cloud Console under the Google Maps SDK for Android. The key is restricted to SHA-1 signing certificate fingerprints and package names for security, limiting its use to authorised builds of the app only. The API key is configured in local.properties under MAPS_API_KEY and exposed at compile time via BuildConfig. The key is also restricted to specific Google Maps API call functions, further limiting its scope. Data Science and Complex Data Handling 1. Geospatial Clustering — posts on the map are grouped into clusters using a greedy single-linkage clustering algorithm implemented in MapUtils.kt. The algorithm computes pairwise distances between post locations using the Haversine formula, which calculates the great-circle distance between two points on Earth's surface accounting for the planet's curvature. Posts within a configurable distance threshold are grouped into a LocationCluster, with the cluster's centroid computed as the arithmetic mean of all member coordinates. The clustering threshold scales dynamically with the map's zoom level across 17 discrete zoom bands in MapViewModel.kt (ranging from 10 metres at zoom ≥ 19 to 3000 metres at low zoom), so pins naturally merge and split as the user zooms in and out: CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/utils/MapUtils.kt and CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/viewmodel/MapViewModel.kt2. Proximity-Based Post Filtering — the return_post_details2 edge function filters posts by the user's location, only returning posts whose coordinates fall within a defined latitude and longitude range of the user. The user's coordinates are passed from MapViewModel.kt to the edge function, which defaults to Newcastle city centre coordinates if none are provided or if invalid coordinates are supplied: CSC2033-team45-Project/app/src/main/java/com/team45/mysustainablecity/viewmodel/MapViewModel.kt and the return_post_details2 edge function in the database directory. |
Built with Kotlin + Jetpack Compose on the frontend and Supabase (PostgreSQL, Auth, Realtime, Storage, Edge Functions) on the backend, deployed via Docker.
| Tool | Version | Notes |
|---|---|---|
| Android Studio | Ladybug (Panda 1) or later | Required IDE |
| JDK | 17+ | Bundled with Android Studio |
| Android SDK | API 36 (min 24) | Install via SDK Manager |
| Docker & Docker Compose | Latest | Docker Desktop on Windows/macOS; CLI on Linux |
| Supabase CLI | Latest | Installation guide |
-
Clone the repository:
git clone https://github.com/Shawarm0/CSC2033-team45-Project.git cd CSC2033-team45-Project -
Open in Android Studio: Open the project root folder in Android Studio. Gradle will sync automatically and install all dependencies.
-
Configure local properties: Create or edit
local.propertiesin the project root:sdk.dir=/path/to/your/android/sdk API_KEY=<supabase_anon_key> # for docker container: sb_publishable_ACJWlzQHlZjBrEguHvfOxg_3BJgxAaHw SUPABASE_URL=<supabase_project_url> # for docker container: http://10.0.2.2:54321/ MAPS_API_KEY=<google_maps_api_key>
These values are exposed at compile time via
BuildConfig. -
Sync Gradle: If the project does not sync automatically, go to File > Sync Project with Gradle Files.
The backend is a Postgres database managed through Supabase, containerised with Docker.
-
Install Docker and Docker Compose:
- Windows / macOS: Install Docker Desktop.
- Linux: Install
dockeranddocker-composevia your package manager.
-
Install the Supabase CLI by following the guide for your OS:
- Navigate to the migration folder inside the database directory.
- Run the migration script (designed for Git Bash on Windows; may need adaptation on other OSes):
./migrate.sh
- Start the database (see below).
From the database directory, run:
# Start the database
supabase start
# Stop the database
supabase stopOnce running, open the Supabase Studio dashboard in your browser:
http://127.0.0.1:54323/
| Section | Details |
|---|---|
| Tables | Indexing, Row-Level Security (RLS) policies |
| Storage | post_image bucket for uploaded images |
| Database > Functions | Server-side functions |
| Database > Triggers | Automated event triggers |
| Database > Enumerated Types | Custom enum types |
| Edge Functions | return_post_details2, get_post_engagement, update_post_status |
Note: There is a known Supabase bug where images in the storage bucket may not render as previews. If posts with images don't display correctly in the app, manually upload the images from
migration/storage/post_image/postsinto the bucket.
- Ensure the database is running (
supabase start). - In Android Studio, select an Android emulator (any standard phone profile).
- The Docker container database is configured to communicate with the emulator.
- Click Run or press
Shift + F10.
# Run all unit tests
./gradlew test
# Run a specific test class
./gradlew test --tests "com.team45.mysustainablecity.tests.viewmodel.AuthViewModelTest"./gradlew connectedAndroidTest# Debug APK
./gradlew build
# Release APK
./gradlew assembleRelease
# Install on connected device
./gradlew installDebugMySustainableCity/
├── app/src/main/java/com/team45/mysustainablecity/
│ ├── MainActivity.kt # Entry point, root navigation graph
│ ├── viewmodel/ # ViewModels (Auth, Map, Discover, Alerts, Mod, Theme)
│ ├── ui/
│ │ ├── screens/ # Full-screen composables (12 screens)
│ │ ├── components/ # Reusable UI (BottomBar, FilterPill, DiscoverMap, etc.)
│ │ └── theme/ # Material 3 colour schemes and typography
│ ├── data/
│ │ ├── classes/ # @Serializable data models (Post, Alert, User, etc.)
│ │ └── remote/ # Supabase client singleton and channel manager
│ ├── reps/ # Repository layer (PostRep, UserRep, ModRep)
│ └── utils/ # DI container, map utilities, clustering
├── app/src/test/ # Unit tests (JUnit4 + MockK + Turbine)
├── app/src/androidTest/ # Instrumented UI tests (Compose Test + Espresso)
├── my_sustainble_city_db/ # Database directory (Supabase + Docker)
│ ├── migration/ # Migration scripts and seed data
│ └── supabase/ # Supabase project config and edge functions
├── gradle/libs.versions.toml # Centralised dependency versions
└── README.md # This file
| Component | Technology | Version |
|---|---|---|
| Language | Kotlin | 2.0.21 |
| UI Framework | Jetpack Compose (Material 3) | BOM 2024.09.00 |
| Backend | Supabase (Auth, Postgrest, Realtime, Storage, Functions) | 3.0.0 |
| HTTP Client | Ktor (OkHttp engine) | 3.0.0-rc-1 |
| Maps | Google Maps Compose | 8.2.0 |
| Serialization | Kotlinx Serialization | 2.2.0 |
| Image Loading | Coil | 2.6.0 |
| Testing | JUnit4, MockK, Turbine, Espresso | -- |
| Database | PostgreSQL (via Supabase + Docker) | -- |
| Build System | Gradle (Kotlin DSL) | 9.0.1 |
| Min SDK | Android 7.0 (API 24) | -- |
| Target SDK | Android 16 (API 36) | -- |