From Staging to Production in One Week
Launching a production site involves far more than clicking 'Deploy'. DNS propagation, D1 database seeding, CDN cache warming, SSL configuration, and SEO groundwork all need to happen in the right order. This blueprint compresses that process into a repeatable seven-day timeline, purpose-built for EmDash sites on Cloudflare Pages.
Day 1: DNS and Domain Configuration
Start by configuring your domain in Cloudflare. EmDash sites are deployed on Cloudflare Pages, which means your DNS should be managed by Cloudflare for optimal performance:
```bash
Add your domain to Cloudflare
Then configure these DNS records:
Type Name Content Proxy
A @ 192.0.2.1 (placeholder) Proxied (orange cloud)
CNAME www your-site.pages.dev Proxied
TXT @ v=spf1 include:_spf.mx.cloudflare.com ~all
```
Key DNS checklist:
- Enable orange-cloud proxy for all web-facing records (DDoS protection, SSL, CDN)
- Set TTL to 'Auto' for proxied records (Cloudflare handles caching)
- Configure a catch-all CNAME for custom subdomains you may add later
- Add SPF, DKIM, and DMARC records if you plan to send transactional email via the site
Day 2: D1 Database Schema and Migration
EmDash stores all content in Cloudflare D1. Before deploying, seed the production database with your schema migrations:
```bash
Install the EmDash CLI and run migrations
npx emdash db:migrate --env production
Seed the database with initial content
npx emdash db:seed --env production --file ./seed.sql
```
Critical database operations during launch:
- **Run all pending migrations** in order (EmDash tracks migration versions in `_ec_migrations`)
- **Seed primary content**: landing pages, about page, privacy policy, and at least 5 blog posts
- **Create admin user** with a strong password (use a passphrase of at least 6 random words)
- **Set site configuration** in `ec_settings`: site name, description, logo URL, social links
- **Verify indexes** on commonly queried columns: `ec_posts(slug)`, `ec_posts(status, published_at)`
```sql
-- Verify indexes exist
SELECT name FROM sqlite_master WHERE type = 'index' AND tbl_name = 'ec_posts';
-- Create missing indexes
CREATE INDEX IF NOT EXISTS idx_posts_slug_status ON ec_posts(slug, status);
```
Day 3: Deploy to Cloudflare Pages
With DNS and database ready, deploy the EmDash site:
```bash
Build the production bundle
npx emdash build --env production
Deploy to Cloudflare Pages
npx wrangler pages deploy ./dist --project-name my-site
```
After deployment:
1. **Verify the Pages project** in the Cloudflare Dashboard under Workers & Pages
2. **Set environment variables**: `D1_DATABASE_ID`, `SITE_URL`, `ADMIN_EMAIL`
3. **Bind the D1 database** to the Pages function (Settings > Functions > D1 Database Bindings)
4. **Configure custom domain** in Pages project Settings > Custom Domains
Day 4: CDN Cache Warming and SSL
With the site live on the Pages staging domain, warm the CDN cache and verify SSL:
```bash
Warm critical paths
for path in / /about /blog /privacy /sitemap.xml /robots.txt; do
curl -s -o /dev/null -w "%{http_code} %{url_effective}\n" "https://your-site.pages.dev$path"
done
```
After cache warming, configure Cloudflare's SSL/TLS settings:
- **SSL/TLS encryption mode**: Full (strict) - requires a valid SSL certificate on the origin
- **Always Use HTTPS**: On
- **Minimum TLS Version**: 1.2
- **Automatic HTTPS Rewrites**: On
- **Certificate transparency monitoring**: Enabled
Cloudflare Pages automatically provisions an SSL certificate for your custom domain. Propagation can take up to 15 minutes for new domains.
Day 5: SEO and Analytics Foundation
Before publicly announcing the launch, establish your SEO baseline:
**Sitemap and robots.txt**:
```xml
<!-- sitemap.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>https://yoursite.com/</loc><priority>1.0</priority></url>
<url><loc>https://yoursite.com/blog</loc><priority>0.9</priority></url>
<url><loc>https://yoursite.com/about</loc><priority>0.7</priority></url>
</urlset>
```
```txt
robots.txt
User-agent: *
Allow: /
Sitemap: https://yoursite.com/sitemap.xml
```
**Analytics integration**:
Install the EmDash Analytics plugin or configure Cloudflare Web Analytics by adding the JS snippet to your site layout template. Cloudflare Web Analytics is free, privacy-first (no cookies), and requires no consent banner.
**Performance baseline**: Run Lighthouse from Chrome DevTools and Pagespeed Insights. Target scores:
| Metric | Target |
|--------|--------|
| First Contentful Paint | < 1.0s |
| Largest Contentful Paint | < 1.5s |
| Time to Interactive | < 2.0s |
| Cumulative Layout Shift | < 0.1 |
Day 6: Social Preview Cards and OG Tags
Social sharing is often neglected until someone notices broken previews. Ensure every page renders proper Open Graph metadata:
```html
<meta property="og:title" content="Your Page Title" />
<meta property="og:description" content="Compelling description under 160 characters" />
<meta property="og:image" content="https://yoursite.com/og-image.png" />
<meta property="og:url" content="https://yoursite.com/page-slug" />
<meta name="twitter:card" content="summary_large_image" />
```
Test URLs with the [Facebook Sharing Debugger](https://developers.facebook.com/tools/debug/) and [Card Preview Tool](https://cards-dev.twitter.com/validator). Generate OG images at 1200x630px for consistent rendering across platforms.
Day 7: Launch Day
The final day is about verification and go-time:
1. **End-to-end smoke test**: Navigate every major section of the site
2. **Form submission test**: Contact forms, newsletter signups, and any user input flows
3. **Mobile responsiveness check**: Test at 375px, 768px, and 1440px viewport widths
4. **404 and 500 error pages**: Verify they render properly (not the default Cloudflare error page)
5. **RSS/Atom feed validation**: If your site publishes a feed, validate with the W3C Feed Validator
6. **Monitor the first 24 hours**: Set up uptime monitoring (Better Uptime, Checkly, or Cloudflare's Health Checks)
Once everything passes, switch your DNS records to point the apex domain to Cloudflare Pages and flip the orange cloud on. Your EmDash site is live.
Post-Launch Checklist
- Configure automated daily D1 backups (Cloudflare D1 export to R2)
- Set up email notifications for form submissions via EmDash's Email plugin
- Enable Cloudflare Bot Management to filter spam traffic
- Submit sitemap to Google Search Console and Bing Webmaster Tools
- Create your first three content pieces using the EmDash scheduled publishing feature