Thanks to visit codestin.com
Credit goes to github.com

Skip to content

XIVASSS/shareIT

Repository files navigation

shareIT

shareIT — anonymous cross-device file sharing

shareIT is a Flutter app for anonymous, code-based file sharing across phones and tablets. There is no account sign-up: each device gets a short share code, and you send files to someone else by entering their code. Files live in Supabase Storage; metadata and live updates use Postgres and Supabase Realtime. Optional Firebase Cloud Messaging hooks help wake the app when new transfers arrive.

Repository: github.com/XIVASSS/shareIT

Highlights

  • Anonymous identity on first launch, with a persistent short code.
  • Send one or many files to a recipient using their code.
  • Incoming transfers with realtime updates, manual refresh, and FCM-oriented fallback.
  • Downloads via signed URLs with SHA-256 verification after save.
  • Sensible limits: e.g. 500MB max file size, 24h transfer visibility window.

Tech stack

Layer Choice
UI & state Flutter, Riverpod
Navigation go_router
Backend Supabase (Auth anon, Storage, Postgres, Realtime)
Networking / files Dio, file_picker, path_provider
Push (client) Firebase Cloud Messaging (see setup)

Project structure

lib/
 ├── core/
 │    ├── constants/
 │    ├── errors/
 │    ├── services/
 │    ├── utils/
 │
 ├── features/
 │    ├── auth/
 │    │    ├── data/
 │    │    ├── domain/
 │    │    ├── presentation/
 │    │
 │    ├── transfer/
 │    │    ├── data/
 │    │    │    ├── datasources/
 │    │    │    ├── models/
 │    │    │    ├── repositories/
 │    │    │
 │    │    ├── domain/
 │    │    │    ├── entities/
 │    │    │    ├── usecases/
 │    │    │
 │    │    ├── presentation/
 │    │    │    ├── providers/
 │    │    │    ├── screens/
 │    │    │    ├── widgets/
 │
 ├── main.dart
supabase/
 ├── setup.sql
test/
 ├── core/

Architecture

The app uses a compact clean-style layout:

  • core: Supabase bootstrap, local storage, file I/O, logging, constants.
  • features/auth: anonymous identity and recipient lookup.
  • features/transfer/data & domain: repositories, entities, and use cases suited for tests.
  • features/transfer/presentation: Riverpod, screens, widgets.

Setup guide

1. Prerequisites

  • Flutter (stable)
  • Xcode (iOS) and/or Android Studio / SDK (Android)
  • A Supabase project
  • A Firebase project with Cloud Messaging (for full push flow)

2. Install dependencies

flutter pub get

3. Configure Supabase

  1. Create a Supabase project.
  2. Create a public storage bucket named shared-files (see AppConstants.storageBucket).
  3. Run supabase/setup.sql in the Supabase SQL editor.
  4. Enable Realtime for the transfers table.
  5. Add storage policies so anon clients can use the bucket, for example:
create policy "anon upload shared files"
on storage.objects
for insert
to anon
with check (bucket_id = 'shared-files');

create policy "anon read shared files"
on storage.objects
for select
to anon
using (bucket_id = 'shared-files');

4. Runtime configuration (no secrets in source)

Do not commit keys. Run with --dart-define:

flutter run \
  --dart-define=SUPABASE_URL=https://YOUR_PROJECT.supabase.co \
  --dart-define=SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY

If these are missing, the app shows a shareIT setup required screen with the same instructions.

5. Firebase / FCM (optional but recommended for production)

Android

  1. Register the app in Firebase.
  2. Add google-services.json under android/app/ (not committed in this template).
  3. Ensure notification permission on Android 13+.

iOS

  1. Register the app in Firebase.
  2. Add GoogleService-Info.plist under ios/Runner/.
  3. Enable Push Notifications and Background Modes (Remote notifications).
  4. Configure APNs in the Firebase console.

6. Run

flutter run \
  --dart-define=SUPABASE_URL=https://YOUR_PROJECT.supabase.co \
  --dart-define=SUPABASE_ANON_KEY=YOUR_ANON_KEY

Supabase data model

  • users(id, code, fcm_token, created_at) — anonymous device identity and optional FCM token.
  • transfers(id, sender_code, receiver_code, file_url, file_name, file_size, file_sha256, status, error_message, created_at) — transfer pipeline and integrity fields.

See supabase/setup.sql for RLS policies and indexes.

FCM server piece

The client registers tokens into users.fcm_token. For notifications while the app is closed, add a small backend (e.g. Supabase Edge Function + database trigger) that sends an FCM data message when a new transfers row is created. Example payload shape:

{
  "transfer_id": "uuid",
  "receiver_code": "ABC234",
  "event": "new_transfer"
}

Edge cases handled

  • Invalid recipient code validated before upload.
  • Large files capped at 500MB; low storage checked before download.
  • Multi-file send, deduplication by transfer.id, failed rows marked failed.
  • Download integrity via SHA-256; network errors surfaced in the UI.

Tradeoffs & limitations

  • RLS is anon-friendly; production hardening often moves sensitive writes behind Edge Functions.
  • Fine-grained upload progress is limited by what the Storage client exposes today.
  • Full background resumable transfers would need additional native or plugin work.
  • FCM “server sender” is documented but not bundled in this repo.

Testing

  • flutter test — includes test/core/utils/code_generator_test.dart.

Prefer mocking repositories in unit tests; wire Firebase/Supabase fakes for CI as needed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors