Deployment & Hosting
Summary: connect your Git repo, configure env vars, and let the platform build & atomically release.
- Connect repository: push your code to GitHub/GitLab, then import the repo in Vercel / Cloudflare Pages.
- Framework preset: choose Next.js. The default build command is
next build. - Environment variables: add keys under Project → Settings → Environment Variables (e.g.
NEXT_PUBLIC_API_URL,STRIPE_SECRET_KEY). - Images & domains: in
next.config.jssetimages.domainsfor external images. - Custom domain: add your domain in Domains, then update DNS (CNAME/A/AAAA) at your registrar.
- Preview & production: every pull request gets a preview URL; merge to
mainpublishes production instantly (atomic deploy).
# Example: next.config.js (images)
module.exports = {
images: { domains: ["cdn.yoursite.com","images.unsplash.com"] }
};
- Create a feature branch → open a Pull Request.
- Preview deploy is generated automatically; QA on the preview URL.
- After review, merge to
main— the platform promotes the build atomically. - Previous version remains available for instant rollback if needed.
- We monitor Core Web Vitals and error logs post-release for 24–48h.
Billing & Payments (Stripe)
Use Stripe’s test cards and Webhook endpoints to simulate the full payment lifecycle.
- Enable Test mode in the Stripe Dashboard.
- Use card
4242 4242 4242 4242, any future expiry, any CVC. - Create a Webhook endpoint (e.g.
/api/stripe/webhook) and subscribe to events:payment_intent.succeeded,payment_intent.payment_failed,checkout.session.completed. - Copy the Signing secret into your environment variable (e.g.
STRIPE_WEBHOOK_SECRET). - Verify signature on your server using Stripe SDK before processing the event.
// Example (Node/Express)
app.post("/api/stripe/webhook", express.raw({type:"application/json"}), (req,res)=>{
const sig = req.headers["stripe-signature"];
const event = stripe.webhooks.constructEvent(req.body, sig, process.env.STRIPE_WEBHOOK_SECRET);
if(event.type==="checkout.session.completed"){ /* fulfill order */ }
res.json({received:true});
});
- Issue a full or partial refund in Dashboard or via API (store the reason).
- Listen to
charge.refunded/refund.updatedto sync your order status. - Notify the customer by email; funds may take 5–10 business days to appear.
- For subscriptions, consider proration or credit balance instead of immediate refunds.
SEO & Performance
- Hero media: serve optimized images/video; use
priorityon the hero image. - Fonts: self-host with
font-display: swap; preconnect & preload critical fonts. - Layout shifts: reserve width/height for images, ads, embeds; avoid late DOM injection.
- JS budget: lazy-load non-critical scripts; remove unused libraries; prefer native features.
- CDN cache: cache HTML for anonymous traffic; enable HTTP/3 and brotli; set proper cache keys.
- Generate
sitemap.xmlon build (e.g. next-sitemap) and submit it in Google Search Console. - Add
robots.txtto allow crawling of production and disallow staging environments. - For each canonical page, include
<link rel="canonical" href="https://example.com/page"/>. - For multilingual sites, include
hreflanglinks pointing to language/region variants.
Security
- Enable 2FA, strong password policy, session timeouts, and IP allow-listing for staff.
- Run the CMS on a separate subdomain with HTTPS only; set strict
SameSiteandHttpOnlycookies. - Apply rate limiting and login attempt throttling; log all admin actions centrally.
- Automated nightly backups; secrets only in managed ENV (no secrets in git).
Use a strict CSP with a controlled allow-list for scripts/styles/fonts/images. Prefer nonces or hashes for inline code.
Content-Security-Policy:
default-src 'self';
script-src 'self' 'nonce-<GENERATED_NONCE>' https://www.googletagmanager.com;
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
img-src 'self' data: https://images.unsplash.com;
font-src 'self' https://fonts.gstatic.com;
frame-ancestors 'none';
Didn’t find what you need?
Send us your question and we’ll reply within 24 hours.
Contact support.png)