JacobMGEvans
JacobMGEvans
TTCTheo's Typesafe Cult
Created by filyys on 4/22/2025 in #questions
Keys
No, generally you want something stable and related to the item it is referencing. Especially when its React because it allows for render optimizations for the lists. https://react.dev/learn/rendering-lists
9 replies
CDCloudflare Developers
Created by ac on 4/18/2025 in #wrangler
Ah, got it. That sounds kind of painful
Probably needs to be modified for a repo or monorepo with multiple preexisting Workers
5 replies
CDCloudflare Developers
Created by ac on 4/18/2025 in #wrangler
Ah, got it. That sounds kind of painful
Tried to make sure it wasnt too painful
5 replies
CDCloudflare Developers
Created by ac on 4/18/2025 in #wrangler
Ah, got it. That sounds kind of painful
const contentWorker = await Worker('content-worker', {
name: 'content-worker',
entrypoint: './src/content/index.ts',
bindings: {
USERS_KV: sharedBindings.USERS_KV,
ASSETS_BUCKET: sharedBindings.ASSETS_BUCKET,
API_KEY: sharedBindings.API_KEY,
},
});

const analyticsWorker = await Worker('analytics-worker', {
name: 'analytics-worker',
entrypoint: './src/analytics/index.ts',
bindings: {
SETTINGS_KV: sharedBindings.SETTINGS_KV,
LOG_QUEUE: sharedBindings.LOG_QUEUE,
},
});

await WranglerJson('api-config', {
worker: apiWorker,
path: './workers/api-worker/wrangler.json',
});

await WranglerJson('content-config', {
worker: contentWorker,
path: './workers/content-worker/wrangler.json',
});

await WranglerJson('analytics-config', {
worker: analyticsWorker,
path: './workers/analytics-worker/wrangler.json',
});

console.log('Generated wrangler.json files for all workers');
}
deployWorkers().catch((error) => {
console.error('Deployment failed:', error);
process.exit(1);
});
const contentWorker = await Worker('content-worker', {
name: 'content-worker',
entrypoint: './src/content/index.ts',
bindings: {
USERS_KV: sharedBindings.USERS_KV,
ASSETS_BUCKET: sharedBindings.ASSETS_BUCKET,
API_KEY: sharedBindings.API_KEY,
},
});

const analyticsWorker = await Worker('analytics-worker', {
name: 'analytics-worker',
entrypoint: './src/analytics/index.ts',
bindings: {
SETTINGS_KV: sharedBindings.SETTINGS_KV,
LOG_QUEUE: sharedBindings.LOG_QUEUE,
},
});

await WranglerJson('api-config', {
worker: apiWorker,
path: './workers/api-worker/wrangler.json',
});

await WranglerJson('content-config', {
worker: contentWorker,
path: './workers/content-worker/wrangler.json',
});

await WranglerJson('analytics-config', {
worker: analyticsWorker,
path: './workers/analytics-worker/wrangler.json',
});

console.log('Generated wrangler.json files for all workers');
}
deployWorkers().catch((error) => {
console.error('Deployment failed:', error);
process.exit(1);
});
5 replies
CDCloudflare Developers
Created by ac on 4/18/2025 in #wrangler
Ah, got it. That sounds kind of painful
Maybe something like this?
import {
Worker,
WranglerJson,
KVNamespace,
R2Bucket,
DurableObjectNamespace,
Queue,
Secret,
Service,
} from 'alchemy/cloudflare';

async function deployWorkers() {
const sharedBindings = {
USERS_KV: await KVNamespace('users-kv', {
title: 'User Data Store',
}),

SETTINGS_KV: await KVNamespace('settings-kv', {
title: 'App Settings Store',
}),

ASSETS_BUCKET: await R2Bucket('assets-bucket', {
name: 'assets-storage',
}),

USER_DO: await DurableObjectNamespace('user-do', {
className: 'UserDO',
scriptName: 'user-service',
}),

SESSION_DO: await DurableObjectNamespace('session-do', {
className: 'SessionDO',
scriptName: 'session-manager',
}),

LOG_QUEUE: await Queue('log-queue', {
name: 'log-events',
}),

API_KEY: await Secret('api-key', {
name: 'external-api-key',
}),

AUTH_SERVICE: await Service('auth-service', {
service: 'auth-worker',
environment: 'production',
}),
};

const apiWorker = await Worker('api-worker', {
name: 'api-worker',
entrypoint: './src/api/index.ts',
bindings: {
USERS_KV: sharedBindings.USERS_KV,
SETTINGS_KV: sharedBindings.SETTINGS_KV,
USER_DO: sharedBindings.USER_DO,
SESSION_DO: sharedBindings.SESSION_DO,
LOG_QUEUE: sharedBindings.LOG_QUEUE,
API_KEY: sharedBindings.API_KEY,
AUTH_SERVICE: sharedBindings.AUTH_SERVICE,
},
});
import {
Worker,
WranglerJson,
KVNamespace,
R2Bucket,
DurableObjectNamespace,
Queue,
Secret,
Service,
} from 'alchemy/cloudflare';

async function deployWorkers() {
const sharedBindings = {
USERS_KV: await KVNamespace('users-kv', {
title: 'User Data Store',
}),

SETTINGS_KV: await KVNamespace('settings-kv', {
title: 'App Settings Store',
}),

ASSETS_BUCKET: await R2Bucket('assets-bucket', {
name: 'assets-storage',
}),

USER_DO: await DurableObjectNamespace('user-do', {
className: 'UserDO',
scriptName: 'user-service',
}),

SESSION_DO: await DurableObjectNamespace('session-do', {
className: 'SessionDO',
scriptName: 'session-manager',
}),

LOG_QUEUE: await Queue('log-queue', {
name: 'log-events',
}),

API_KEY: await Secret('api-key', {
name: 'external-api-key',
}),

AUTH_SERVICE: await Service('auth-service', {
service: 'auth-worker',
environment: 'production',
}),
};

const apiWorker = await Worker('api-worker', {
name: 'api-worker',
entrypoint: './src/api/index.ts',
bindings: {
USERS_KV: sharedBindings.USERS_KV,
SETTINGS_KV: sharedBindings.SETTINGS_KV,
USER_DO: sharedBindings.USER_DO,
SESSION_DO: sharedBindings.SESSION_DO,
LOG_QUEUE: sharedBindings.LOG_QUEUE,
API_KEY: sharedBindings.API_KEY,
AUTH_SERVICE: sharedBindings.AUTH_SERVICE,
},
});
5 replies
CDCloudflare Developers
Created by JacobMGEvans on 4/13/2025 in #wrangler
Do you already have a Record (CNAME or A
If they utilize CNAMEs then yes likely are interferring
6 replies
CDCloudflare Developers
Created by JacobMGEvans on 4/13/2025 in #wrangler
Do you already have a Record (CNAME or A
Maybe, I dont remember how rules work under the hood and havent used them in a long time.
6 replies
CDCloudflare Developers
Created by JacobMGEvans on 4/13/2025 in #wrangler
Do you already have a Record (CNAME or A
Couldnt find the override property in the schema https://unpkg.com/[email protected]/config-schema.json or Docs https://developers.cloudflare.com/workers/wrangler/configuration/#routes That being said, it very well could be undocumented. As for trying it without the www, did you manually set up records for the subdomain? https://developers.cloudflare.com/workers/configuration/routing/custom-domains/#add-a-custom-domain If the domain has existing CNAMEs the automagic wont work, hope the docs can be of more help than me 😅
6 replies
TTCTheo's Typesafe Cult
Created by Noah on 12/11/2024 in #questions
t3 stack and nextjs app router, chat app
Don't use that tag for this. You can take specific concerns to the #ct3a-meta channel
9 replies