stack/apps/backend/src/lib
Zai Shi 202f54d787
Add S3 bucket (#816)
Note for deployment: This PR needs to add some env vars
<!-- ELLIPSIS_HIDDEN -->


----

> [!IMPORTANT]
> Adds S3-compatible storage for profile images with S3Mock for local
development, updating environment variables, Docker configurations, and
tests.
> 
>   - **Behavior**:
> - Adds S3-compatible storage for user, team, and team member profile
images using `uploadAndGetUrl()` in `s3.tsx`.
> - Integrates S3Mock for local development in `docker.compose.yaml` and
`emulator/docker.compose.yaml`.
> - Updates `crud.tsx` files for `users`, `teams`, and
`team-member-profiles` to use S3 for profile images.
>   - **Environment**:
>     - Adds S3-related environment variables to `.env.development`.
>     - Updates `package.json` to include `@aws-sdk/client-s3`.
>   - **Testing**:
> - Modifies test cases in `teams.test.ts` and `users.test.ts` to
validate S3 URL behavior.
> - Updates `auto-migration.tests.ts` for concurrent migration handling.
>   - **Documentation**:
>     - Updates `self-host.mdx` to include S3 storage requirements.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for 901f0b56cd. You can
[customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>

----


<!-- ELLIPSIS_HIDDEN -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added support for uploading and storing user, team, and team member
profile images using S3-compatible storage.
* Integrated S3Mock for local development and testing of storage
features.
* Added new services to Docker Compose configurations for S3Mock and
related dependencies.
* Introduced image validation and processing for base64-encoded images
before upload.

* **Bug Fixes**
* Profile image upload now returns a storage URL instead of echoing back
the base64 data.

* **Documentation**
* Updated self-hosting documentation to include S3 storage requirements
and usage.

* **Chores**
* Added and updated environment variables for S3 storage configuration.
  * Updated backend dependencies to include the AWS S3 SDK.
  * Enhanced test cases to validate new image upload and URL behaviors.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
2025-08-01 20:30:44 +02:00
..
ai-chat Remove legacy tenancy config (#802) 2025-07-31 20:06:33 +02:00
config.tsx Update Featurebase redirect 2025-07-30 12:00:09 -07:00
contact-channel.tsx Tenancies (#418) 2025-02-07 22:54:04 -08:00
email-rendering.tsx Add tracing to ESBuild 2025-07-31 16:22:55 -07:00
emails.tsx Add tracing to ESBuild 2025-07-31 16:22:55 -07:00
end-users.tsx Upgrade backend to Next.js 15 (#360) 2024-12-10 00:11:13 -08:00
events.tsx Source of Truth (#660) 2025-07-11 17:59:03 -07:00
freestyle.tsx Add tracing to ESBuild 2025-07-31 16:22:55 -07:00
images.tsx Add S3 bucket (#816) 2025-08-01 20:30:44 +02:00
internal-api-keys.tsx Source of Truth (#660) 2025-07-11 17:59:03 -07:00
notification-categories.ts Auto migration (#526) 2025-07-24 02:38:37 +02:00
openapi.tsx Update OpenAPI schema generator to support multiple status codes (#527) 2025-03-10 14:50:11 -07:00
permissions.tsx Remove legacy tenancy config (#802) 2025-07-31 20:06:33 +02:00
projects.tsx Config override CRUD (#803) 2025-08-01 18:28:27 +02:00
redirect-urls.tsx Remove legacy tenancy config (#802) 2025-07-31 20:06:33 +02:00
request-checks.tsx Source of Truth (#660) 2025-07-11 17:59:03 -07:00
tenancies.tsx Remove legacy tenancy config (#802) 2025-07-31 20:06:33 +02:00
tokens.tsx Add tracing to ESBuild 2025-07-31 16:22:55 -07:00
types.tsx Added custom SMTP email server testing on the dashboard (#376) 2024-12-20 19:04:05 +01:00
webhooks.tsx Rename USER to PROJECT in permissions (#576) 2025-03-27 09:39:48 -07:00