spliit-app / spliit

Free and Open Source Alternative to Splitwise. Share expenses with your friends and family.

Home Page:https://spliit.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to add attachment (pictures, receipts, etc) to expenses

ZeWaren opened this issue · comments

As a user, I would like to be able to attach files to expenses.

Typical use cases:

  • Someone pays the bill at a restaurant, and immediately adds the picture of the receipt.
  • Someone books something online (accommodation, entertainment, etc) and adds a PDF to the expense.

On a mobile device, receipts can be added from the gallery, or from the camera directly (I believe the mobile operating systems can handle that case directly).

As I user, I want to:

  • be able to add an attachment when creating a new expense or when editing an existing one.
  • see existing attachments on an expense.
  • replace or delete existing attachments.

The first version would simply store the files directly on the same host the server is running.
On a technical level, ideally the directory/folder where the attachments are stored should be configurable (with an env variable).
Later, we could implement more storage mechanisms (FTP, SFTP, S3, etc.)

Thanks @ZeWaren for such a well-qualified issue 😊

That’d be a very cool feature. It would mean we have a choice to make about how to store the images. Here are some solutions I can think of:

Use an S3 bucket

Probably the most generic option, the cheapest one, and the one that will satisfy most users. It’s not too much work in the app, but it means dealing with the AWS console, and updating the documentation to explain how to create an S3 bucket.

Use Vercel Blob

The easiest solution to set up. It might make sense as the app is built with Next.js and so the most common use case is to deploy it on Vercel. But I’d prefer avoiding adding another dependency to Vercel. (Even though I use the Vercel’s database, it’s a plain PostgreSQL database and I can switch to another one anytime. It doesn’t work that way with Blob.)

Other hosting services

Cloudinary, Bytescale and others provided a nice solution for hosting images, including widgets for upload. They are also more expensive. I don’t know if they support uploading something else than an image (like a PDF document).

Other solutions?

Storing files on the same host as the app is not really an option as the app runs on a read-only filesystem (on Vercel, and I suspect it’s the same on many hosting services).


The ideal solution would be to offer several photo-hosting solutions, and an easy way for anyone to add their own.

For now, my preference would go to using an S3 bucket (providing the credentials as an environment variable). It would be an opt-in feature, i.e. if you deploy your own instance but don’t want to provide S3 credentials, you simply won’t have access to the uploading feature.

No issue with all the solutions you provided. However, some people who self-host the project on some simple architectures (VPS, Raspberry Pi) would be perfectly happy with using the next directory somewhere on their filesystem.
I'd say the application should support all types and allow each sysadmin to configure it according to their hardware/cloud-provider.

I just implemented image upload, storing them to S3 (#64). I think it covers most of the needs, but I created two other issues to continue on this path (not too urgent though):