# Project export: WabiSabi

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: TreeHacks 2025
- Tagline: Combining mediation and matcha, this app works to inform people and create calming environments.
- Devpost: https://devpost.com/software/wabisabi-iqc3m5
- GitHub: https://github.com/AshleyJoyE/WabiSabi-Swift
- Demo: https://app.flutterflow.io/share/tree-hacks-g6j8b4
- Video: https://www.youtube.com/embed/BlRDWiOhYp0?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 0 GitHub contributor(s) — 

## Devpost submission (written by the team)

### Inspiration

We were inspired by Otsuka Valuenex and FlutterFlow to create a mindful mediation app utilizing wearable technology. Nowadays in a world filled with technology, many struggle to find moments of peace along with relaxation. We saw this problem in todays society and wanted to create an app to combat this issue. Teaching its users about meditation techniques and its importance along with monitoring their own health.

### What it does

This app has a multitude of features working together such as education modules, mediation timers, and chatbot features. Our first feature of our app is its ability to read user heart data from an Apple watch and play calming audios dependent on this data. It holds a timer page, recording user data and displaying their heart rate during this period. This allows users to find better solutions to relax as well as monitor their heart health. The next feature of our app is the wide range of education modules. Our app teaches users more about mediation using matcha analogies and fun lessons. Within these lessons we also hold techniques for mediations along with helpful guides and videos. Another feature of our app is its Gemini chatbot ability. This allows users to talk to an AI model and gain valuable insight as well as daily quotes.

### How we built it

We built this app utilizing FlutterFlow, Firebase, Swift, and Gemini. This app is fully present on FlutterFlow and implements features from Firebase along with Swift to store and report data. Gemini is also utilizing for the chatbot features. All art features on the app was also created by us. Additionally, we used Terra API to implement our apple watch features.

### Challenges we ran into

We ran into many challenges while coding this app. Not only was this our first time utilizing FlutterFlow, but for many of us it was also our first Hackathon event. One of the most prominent challenges we ran into was gathering data and connecting the watch to the app. This was very hard to combat as Firebase blocked us from the platform due to too many requests. However based on the data gathered before, we created a simulated heart rate feature. Another challenge for our team was that three out of four members were beginners, this was a very hard learning curve and made it difficult to take on more complex parts.

### Accomplishments we're proud of

We are proud of connecting the watch data and health information with the app. Although we got blocked from Firebase, we were able to gather lots of data from the Apple watch and create a simulated version of our features. This was very impressive and a great accomplishment for us as we had never worked with different technologies such as a watch.

### What we learned

We have learned a lot from this experience and truly grown as coders. Not only did we learn how to utilize FlutterFlow with backend features of Firebase, but we also gained grew as designers, creating each component of our app. We also learned more about coding as a team and time management skills from this experience.

### What's next

In the future we hope to complete all of our education modules along with add more interactive features through our chatbot. Along with this we hope to fully display the live data and change the speed of the audio to better connect with users.

## README (from the GitHub repository)

No README available.

## Detected evidence (automated analysis)

Indexed codebase: 4 recognized source files, 5 KB.
- Swift (language) — detected in the code
- Firebase (technology) — claimed on Devpost, not found in the code
- Google Gemini (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (9 of 9)

```
matcha/AppDelegate.swift
matcha/Assets.xcassets/AccentColor.colorset/Contents.json
matcha/Assets.xcassets/AppIcon.appiconset/Contents.json
matcha/Assets.xcassets/Contents.json
matcha/ContentView.swift
matcha/matcha.entitlements
matcha/matchaApp.swift
matcha/Preview Content/Preview Assets.xcassets/Contents.json
matcha/ViewController.swift
```

### Dependencies

No dependency index available.

### Recent commits (newest first)

- uploaded files

## Key source files (fetched from GitHub, selected and truncated for size)

### matcha/matchaApp.swift

```swift
import SwiftUI

@main
struct matchaApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

```

### matcha/ContentView.swift

```swift
//
//  ContentView.swift
//  matcha
//
//  Created by Ashley Etheridge on 2/15/25.
//

import SwiftUI
import TerraiOS

var terra: TerraManager
Terra.instance(devId: "4actk-matcha-testing-TnjiAw0odY", referenceId: "01"){manager, error in
    terra = manager
}

struct ContentView: View {
    var body: some View {
        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundStyle(.tint)
            Text("Hello, world!")
        }
        .padding()
    }
}

#Preview {
    ContentView()
}

```

### matcha/AppDelegate.swift

```swift
import UIKit
import TerraiOS  // Import Terra SDK

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    var window: UIWindow?
    var terra: TerraManager?

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        
        // Initialize Terra correctly
        Terra.instance(devId: "1oAmr6wcQOsJaI1JevF87YPyzxU7nVcA", referenceId: "USER_REFERENCE_ID") { manager, error in
            if let manager = manager {
                self.terra = manager
                print("Terra initialized successfully")
            } else if let error = error {
                print("Terra initialization failed: \(error.localizedDescription)")
            }
        }

        return true
    }
}

```

### matcha/ViewController.swift

```swift
import UIKit
import TerraiOS
import HealthKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate, TerraDelegate {
    var window: UIWindow?
    var terra: TerraManager?
    let healthStore = HKHealthStore()

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        // Initialize Terra SDK
        Terra.instance(devId: "YOUR_DEV_ID", referenceId: "USER_REFERENCE_ID") { manager, error in
            if let manager = manager {
                self.terra = manager
                self.terra?.delegate = self
                print("Terra initialized successfully")
                
                // Request HealthKit permissions
                self.requestHealthKitPermissions()
            } else if let error = error {
                print("Terra initialization failed: \(error.localizedDescription)")
            }
        }

        // Enable background data delivery
        Terra.setUpBackgroundDelivery()
        return true
    }

    func requestHealthKitPermissions() {
        let heartRateType = HKQuantityType.quantityType(forIdentifier: .heartRate)!
        let typesToRead: Set = [heartRateType]

        healthStore.requestAuthorization(toShare: [], read: typesToRead) { success, error in
            if success {
                print("HealthKit authorization granted")
                self.connectToAppleHealth()
            } else {
                print("HealthKit authorization failed: \(String(describing: error?.localizedDescription))")
            }
        }
    }

    func connectToAppleHealth() {
        guard let terra = terra else { return }
        let token = "YOUR_AUTHENTICATION_TOKEN"
        let customPermissions: Set<CustomPermissions> = [.heartRate]
        let schedulerOn = true // Enables background updates

        terra.initConnection(
            type: .APPLE_HEALTH,
            token: token,
            customReadTypes: customPermissions,
            schedulerOn: schedulerOn
        ) { success, error in
            if success {
                print("Connected to Apple Health successfully.")
                self.startHeartRateMonitoring()
            } else if let error = error {
                print("Connection failed: \(error.message)")
            }
        }
    }

    func startHeartRateMonitoring() {
        guard let terra = terra else { return }
        terra.startRealtime(type: .APPLE_HEALTH, dataTypes: [.heartRate]) { success, error in
            if success {
                print("Real-time heart rate monitoring started.")
            } else if let error = error {
                print("Failed to start real-time monitoring: \(error.message)")
            }
        }
    }

    // Handle real-time heart rate updates
    func didReceiveRealtimeData(type: DataType, data: RealtimeData) {
        switch type {
        case .heartRate:
            if let heartRate = data.heartRate {
                print("Heart Rate: \(heartRate) BPM at \(data.timestamp)")
                // Update UI or handle heart rate data
            }
        default:
            break
        }
    }

    // Handle background execution
    func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        completionHandler(.newData)
    }

    func disconnectFromAppleHealth() {
        guard let terra = terra else { return }
        terra.disconnect { success, error in
            if success {
                print("Disconnected from Apple Health.")
            } else if let error = error {
                print("Disconnection failed: \(error.message)")
            }
        }
    }
}

```