Index

Naming things

Filename in storage (S3, ...)

Always have year, month, day in filename to easily sort it out.

If file is uploaded by user, add user_id in filename, or some other unique identifier depends on your business in which you require to upload.

Personally, I always add timestamp and extra data in filename to avoid duplicate.

Example filename: yyyy/mm/dd/{user_id}-{timestamp}-{extra}.ext

Be careful with /, too much nested folder is no good for backup (as they say, idk if true or not, but less folder mean less complicated to me).

Time variable

Add time postfix to make sense.

Instead of create_at, use create_at_ms.

Feel free to ask me via email or Mastodon. Source code is available on GitHub