Skip to content

Conversation

@khawarizmus
Copy link
Contributor

@khawarizmus khawarizmus commented Nov 19, 2025

Context

This PR revamps the PowerSync attachments documentation to provide clearer, more structured and consistent guidance for developers implementing file handling across all supported platforms.

Notable Changes

  • Added architecture workflow (11-step process from upload to cross-device sync)
  • Added attachment state reference table
  • Documented core concepts: Attachment Table, Storage Adapters, Attachment Queue
  • Reorganized implementation guide with multi-platform examples
  • Added advanced topics: error handling, custom adapters, cache management
  • Consolidated SDK/demo links into single reference table

TODOs

Code Examples:

  • Update JavaScript example code to use built-in package
  • Add a depraction note js and dart previous packages
  • Update Dart example code
  • Update Swift example code
  • Update Kotlin example code

Content Review:

  • Include the diagram
  • Revise the need for AWS S3 storage and PDF tutorials
  • Revise the need for Supabase handling attachment integration guide

Related PR implementation: powersync-ja/powersync-js#735

---
title: "Attachments / Files"
description: Syncing large attachments/files directly using PowerSync is not recommended.
description: Keep files out of your database and handle attachments in an entirely storage-agnostic way. PowerSync syncs minimal metadata while an offline-first queue automatically handles uploads, downloads, and retries.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should say "offline-first". Perhaps just "offline"?

Copy link
Contributor Author

@khawarizmus khawarizmus Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would make the Queue offline which is not the case. "Offline-first" here means that it's still going to behave fine offline and would automatically sync when back online just like how the rest of PowerSync does.

Copy link
Contributor

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some minor comments, overall this doc is looks very well written and is a good guide for Attachments.

@khawarizmus khawarizmus marked this pull request as ready for review November 28, 2025 14:14

### Custom Storage Adapters

Create adapters for other storage systems:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful if we can define "other" here - is it other to any of the examples we mention in the relevant sections above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I have updated that section.

…tion instructions and version requirements
@khawarizmus
Copy link
Contributor Author

These Docs are ready as per the PR powersync-ja/powersync-js#735 and should reflect the latest changes.

A final review is welcome.

1- Local files exist at expected paths
2- Repairs broken localUri references
3- Archives attachments with missing files
3- Requeues downloads for synced files with missing local copies

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate "3-" labels, and maybe a conventional list using a number period format (like 1.) would read better here.

```

```dart Flutter
WIP need to expose the function publicly

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Maybe add a more official "Coming soon" notice, instead of the "WIP".

<CodeGroup>

```bash JavaScript/TypeScript
Included with web and node and react-native packages, for react-native adapters install @powersync/attachments-storage-react-native.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think moving these installation requirements into a list would be more conventional, since they aren't actual commands and maybe even including links to the SDK installations.


- **[Supabase Storage Integration](/integration-guides/supabase-+-powersync/handling-attachments)** - Detailed guide for using Supabase Storage
- **[AWS S3 Storage Adapter Tutorial](/tutorials/client/attachments-and-files/aws-s3-storage-adapter)** - How to implement an S3 adapter
- **[PDF Attachments](tutorials/client/attachments-and-files/pdf-attachment)** - Complete API reference

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: matching the absolute links for consistency: /tutorials/client/attachments-and-files/pdf-attachment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants