Skip to content

Overview

The examples use Authentication from Getting Started: the application’s request middleware.

Start from the graph the tutorial built and change the lines your requirements touch:

const GitLive = Git.ApiLive.pipe(
Layer.provide(Git.ApiHandlersLive),
Layer.provide(Authentication.layer),
Layer.provide(Git.ReposDurableObject),
Layer.provide(Git.RegistryDurableObject),
Layer.provide(Git.HasherInline),
Layer.provide(Git.BlobStoreR2(GitObjects)),
);
You need Change Where
Everything on one Cloudflare account nothing All on Cloudflare
Large pushes verified fast, still on one cloud HasherWorkerLoader() Scaling
Bytes stored in AWS BlobStoreS3(bucket) Bytes in S3, hashing on Lambda
The widest push parallelism HasherLambda(HasherFunction) Bytes in S3, hashing on Lambda
Bytes somewhere that is neither R2 nor S3 your own BlobStore Bring your own store
Registry reads near users everywhere, SQL over the index RegistryD1(RepoIndex) Registry
Your own users and credentials your HttpRouter middleware Tutorial Part 4
Branch rules application handlers + Git.Engine Tutorial Part 6
Your web app and git on one domain a front-door Worker Application example

Every row is independent. Bytes in S3 with the loader hasher and a D1 registry is three changed lines, and the type checker confirms the graph is whole. Scaling is the why behind the first four rows.

A graph that only touches Cloudflare deploys with Cloudflare’s providers:

export default Alchemy.Stack(
"GitService",
{ providers: Cloudflare.providers(), state: Cloudflare.state() },
Effect.gen(function* () {
const git = yield* GitHost;
return { url: git.url.as<string>() };
}),
);

A graph that declares a Lambda or reads S3 carries both provider sets. The stack is otherwise identical, and Alchemy creates what each cloud needs:

export default Alchemy.Stack(
"GitService",
{ providers: Cloudflare.providers(), state: Cloudflare.state() },
{
providers: Layer.mergeAll(Cloudflare.providers(), AWS.providers()),
state: Cloudflare.state(),
},
Effect.gen(function* () {
const git = yield* GitHost;
return { url: git.url.as<string>() };
}),
);