@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
mdx 109 lines 2.62 KB
Raw
1 ---
2 title: Tigris
3 description: S3-compatible object storage billed through Fly. Bind Fly.PutObject / Fly.GetObject.
4 ---
5
6 A [`Fly.Bucket`](/providers/fly/bucket) is Tigris S3-compatible
7 object storage, billed through Fly. It is org-scoped. There is no
8 parent [App](/fly/compute/apps).
9
10 Tigris speaks the S3 API. Bind [`PutObject`](/providers/fly/putobject)
11 / [`GetObject`](/providers/fly/getobject) in a
12 [Service](/fly/compute/services). Alchemy injects the Tigris
13 endpoint and credentials. You never read `AWS_*` yourself.
14
15 ## Create a Bucket
16
17 Alchemy generates a unique name unless you pass one.
18
19 ```typescript
20 const data = yield* Fly.Bucket("Data");
21 ```
22
23 ## A stable name
24
25 Pass `name` when you need a stable Tigris bucket name.
26
27 ```typescript
28 const data = yield* Fly.Bucket("Data", {
29 name: "my-bucket",
30 });
31 ```
32
33 :::caution[Changing `name` replaces the Bucket]
34 Tigris cannot rename a bucket. Alchemy creates the new name, then
35 deletes the old one.
36 :::
37
38 ## Put and get objects
39
40 Bind `PutObject` / `GetObject` in the Service's constructor. Provide the matching
41 `*Http` layers.
42
43 ```typescript
44 import * as HttpServerResponse from "effect/http/HttpServerResponse";
45
46 export default class Api extends Fly.Service<Api>()(
47 "Api",
48 { main: import.meta.url, port: 3000 },
49 Effect.gen(function* () {
50 const putObject = yield* Fly.PutObject(Data);
51 const getObject = yield* Fly.GetObject(Data);
52
53 return {
54 fetch: Effect.gen(function* () {
55 yield* putObject({
56 Key: "hello.txt",
57 Body: "hello",
58 ContentType: "text/plain",
59 });
60 const obj = yield* getObject({ Key: "hello.txt" });
61 return HttpServerResponse.json({ ok: obj.ETag !== undefined });
62 }),
63 };
64 }).pipe(Effect.provide([Fly.PutObjectHttp, Fly.GetObjectHttp])),
65 ) {}
66 ```
67
68 ## Public access
69
70 Buckets are private by default. `public: true` serves objects
71 without credentials.
72
73 ```typescript
74 const assets = yield* Fly.Bucket("Assets", {
75 public: true,
76 });
77 ```
78
79 ## Custom domain
80
81 `domainName` sets `website.domain_name` on the add-on. Point a
82 CNAME at `{name}.t3.tigrisbucket.io`.
83
84 ```typescript
85 const assets = yield* Fly.Bucket("Assets", {
86 public: true,
87 domainName: "assets.example.com",
88 });
89 ```
90
91 ## Organization
92
93 Org defaults to the current token. Pass `orgSlug` to pin it.
94
95 ```typescript
96 const data = yield* Fly.Bucket("Data", {
97 orgSlug: "my-org",
98 });
99 ```
100
101 :::caution[Changing `orgSlug` replaces the Bucket]
102 The bucket is created in the new org. The old bucket is deleted.
103 :::
104
105 ## Where next
106
107 [Services](/fly/compute/services) is the Machine that binds
108 `PutObject` / `GetObject`.
109 The [`Bucket` reference](/providers/fly/bucket) lists every prop.