AutoTechJobs is deployed on Cloudflare Pages, leveraging Cloudflare's global edge network for optimal performance and reliability. This document outlines the deployment configuration and infrastructure setup.
The application is configured in wrangler.toml:
# wrangler.toml name = "autotechjobs" compatibility_date = "2025-01-09" pages_build_output_dir = "./build/client" [placement] mode = "smart" [[kv_namespaces]] binding = "KV" id = "27646024ef8843a3a80e65c844ca8e27" [[d1_databases]] binding = "DB" database_name = "autotechjobs_preview" database_id = "f87561e1-64d7-4651-bc6c-9eb363bb1581"
The application requires several environment variables to be configured in the Cloudflare Pages dashboard:
| Variable | Description | Required |
|---|---|---|
SESSION_SECRET | Secret key used for session encryption | Yes |
RESEND_API_KEY | API key for Resend email service | Yes |
GEOCODING_API_KEY | API key for geocoding service | Yes |
CLOUDFLARE_ANALYTICS_TOKEN | Token for Cloudflare Analytics | No |
STRIPE_SECRET_KEY | Secret key for Stripe payment processing | Yes (for premium features) |
STRIPE_WEBHOOK_SECRET | Secret for Stripe webhook verification | Yes (for premium features) |
The application is built and deployed automatically when changes are pushed to the main branch:
The build configuration in the Cloudflare Pages dashboard:
| Build command | npm run build |
| Build output directory | build/client |
| Root directory | / |
| Node.js version | 18.x |
Database migrations are managed using Wrangler CLI:
# Create a new D1 database npx wrangler d1 create autotechjobs # Apply migrations from schema.sql npx wrangler d1 execute autotechjobs --file=./db/schema.sql # Run SQL commands directly npx wrangler d1 execute autotechjobs --command="SELECT * FROM users LIMIT 10"
AutoTechJobs maintains three distinct deployment environments to ensure smooth development and testing:
mainautotechjobs.pages.devautotechjobs_proddeveloppreview.autotechjobs.pages.devautotechjobs_preview[branch-name].autotechjobs.pages.devautotechjobs_feature_[branch]NODE_ENV - Environment identifierENVIRONMENT - Environment nameDB_NAME - Database nameBASE_URL - Base URL for API callsFor more information about deployment best practices, see theDevelopmentdocumentation.