DigitalSpot Deployment Guide

From zero to live on www.digitalspot.pk — PC & Termux methods, AdSense hookup, troubleshooting.

0 Requirements

ItemRecommendedWhy
Node.jsv18.18+ or v20+Next.js runtime
DatabaseNeon Postgres (free tier)Serverless Postgres — URL goes in DATABASE_URL. Any Postgres 14+ works.
HostingVercel (free Hobby)1-click deploys, edge network, automatic HTTPS
Domaindigitalspot.pk (pknic.com.pk or reseller)Point to Vercel for AdSense approval
AdSenseApproved publisher accountMonetization

A Method 1 — PC / Laptop (Vercel, 10 minutes)

  1. Push to GitHub
    git init
    git add .
    git commit -m "DigitalSpot v1"
    git branch -M main
    git remote add origin https://github.com/YOURUSER/digitalspot.git
    git push -u origin main
  2. Create the Neon database. Sign up at neon.tech → New Project → copy the connection string (postgresql://…sslmode=require).
  3. Import on Vercel. vercel.com → Add New → Project → import your repo. Framework is auto-detected (Next.js) — don't change build settings.
  4. Add environment variables (Project → Settings → Environment Variables):
    DATABASE_URL=your neon url
    AUTH_SECRET=openssl rand -base64 32
    NEXT_PUBLIC_SITE_URL=https://www.digitalspot.pk
  5. Deploy. Click Deploy — first build takes ~2 minutes.
  6. Push schema + seed data. On your PC (with the env vars set in a local .env):
    npm install
    npx drizzle-kit push
    npx tsx src/db/seed.ts
    Output confirms: settings · 10 ad slots · 5 services · 15 tools · 2 posts · 2 portfolio · admin user.
  7. Connect the domain. Vercel → Domains → add www.digitalspot.pk → create the shown CNAME/A records at your registrar. HTTPS is issued automatically.
  8. Login & secure. Visit /admin, sign in with admin@digitalspot.pk / Admin@123, then change the email/password in Users.
That's it — the store, tools, blog, cart and admin are live. Splash, theme and every ad slot are now editable from the Admin Panel.

B Method 2 — Termux (Android phone, no PC)

Everything can be done from a phone. Tested on Termux from F-Droid.

  1. Install Termux from F-Droid (the Play Store build is outdated), then:
    pkg update && pkg upgrade
    pkg install nodejs-lts git
  2. Get the code (clone, or download the ZIP from GitHub and unzip):
    git clone https://github.com/YOURUSER/digitalspot.git
    cd digitalspot
    npm install
    Tip: if npm feels slow, run pkg install tur-repo && pkg install pnpm and use pnpm instead.
  3. Create .env:
    cat > .env << 'EOF'
    DATABASE_URL="postgresql://…neon-url…"
    DATABASE_URL_UNPOOLED="…same…"
    AUTH_SECRET="run: openssl rand -base64 32"
    NEXT_PUBLIC_SITE_URL="https://www.digitalspot.pk"
    EOF
  4. Config ko Neon pe point karein (critical step!): drizzle.config.json me by-default localhost ka URL hota hai — Termux pe use Neon URL se replace karein, warna tables production me nahi banengi aur site khaali rahegi:
    cat > drizzle.config.json << 'EOF'
    {
      "dialect": "postgresql",
      "schema": "./src/db/schema.ts",
      "dbCredentials": { "url": "YAHAN-NEON-URL-PASTE-KAREIN" }
    }
    EOF
  5. Provision the PRODUCTION database:
    npx drizzle-kit push
    npx tsx src/db/seed.ts
    Output me ye dikhna chahiye: ✓ settings · ✓ adsense: 10 slots · ✓ users · ✓ services: 5 · ✓ tools: 15 · ✓ portfolio: 2 · ✓ blog: 2 — ✅ Seed complete! Iske baad hi admin login aur demo data kaam karega.
  6. Local test (optional): npm run dev → open http://localhost:3000 in Chrome. Ctrl+C to stop.
  7. Deploy — Option A (GitHub + Vercel, auto-deploys): Push the code (git push — password ki jagah GitHub Personal Access Token use karein), phir Vercel dashboard: Add New → Project → Import repo → 3 env vars add karein → Deploy. Ab har git push pe site khud ba khud update hogi.
  8. Deploy — Option B (Vercel CLI, seedha phone se, GitHub optional):
    npm i -g vercel
    vercel login        # link open hoga — browser me approve karein
    vercel              # answers: Y · name: digitalspot · dir: ./ · override: N
    Phir wohi 3 env vars add karein (Project → Settings → Environment Variables) aur final production deploy:
    vercel --prod
    Turant live URL mil jata hai — misal digitalspot.vercel.app.
  9. Production DB seed (sirf ek dafa): Agar .env me Neon ka production URL dala hai to step 4 ka drizzle-kit push + seed pehle hi production pe ho chuka hai — dobara karne ki zaroorat nahi.
Low-RAM phones pe Termux me npm run build fail ho sakta hai — build Vercel karta hai. Termux sirf editing, git, database commands aur CLI deploy ke liye use karein.

C Post-Deploy Checklist

⚡ One-Click Database Install (Sirf ek link!)

Agar aapki site deploy ho gayi lekin demo data nahi dikh raha ya admin login nahi ho raha — to seed commands ki jagah bas ye link kholein (browser ya Termux curl):

https://AAPKI-SITE.vercel.app/api/setup?key=AAPKA-AUTH_SECRET

Ye automatically: saari tables banata hai + 5 services, 15 tools, 2 blogs, 2 portfolio, 10 ad slots aur admin user seed karta hai. Response me "ok": true aur counts dikhne chahiye. Idempotent hai — jitni dafa chahein chalayein, kuch duplicate nahi hoga.

  • ✅ Change the default admin password (Admin → Users).
  • ✅ Set your real WhatsApp number, email, socials (Admin → Site Settings).
  • ✅ Upload brand colors/logo (Theme tab) — no rebuild needed, it's live instantly.
  • ✅ Configure the splash screen (logo, slogan, animation, 2–5s duration).
  • ✅ Test checkout: add a service → Cart → Place order → confirm the WhatsApp alert opens with order details.
  • ✅ Search Console: add property → submit https://www.digitalspot.pk/sitemap.xml (auto-generated).
  • ✅ PWA check: open the site in Chrome → ⋮ menu → Install app should appear.

D Connect AdSense (after domain is live)

  1. In AdSense → Sites → add digitalspot.pk and wait for Ready status (can take 1–14 days for new sites).
  2. Copy your Publisher ID ca-pub-XXXX and the Ads → By site script.
  3. Admin → AdSense Manager → Global Settings: paste both, enable Auto Ads, Save. Ads now cover the whole site automatically.
  4. For controlled placements: AdSense → Ads → By ad unit → Display ads → copy the full code → Admin → Ad Slots → Edit the matching slot → paste → ON → Save. Repeat for the slots you want filled (all 10 are pre-placed; fill any subset you like).
  5. Verify with the Live Preview Map tab — green slots are serving; dashed purple ones still show the safe "Your Ad Here" placeholder.
On preview/localhost URLs AdSense serves blanks. Only judge monetization on the approved production domain.

E Troubleshooting

❌ "DATABASE_URL is required" on build

Add the env var in Vercel → Settings → Environment Variables (Production), then redeploy. Locally, create .env from .env.example.

❌ Admin login works but pages keep logging out

AUTH_SECRET changed after sessions were issued. Have users re-login; keep the secret stable.

❌ Empty ad boxes on the live domain

Checklist: site approved in AdSense · Auto Ads ON · slot status ON with code pasted · 24–48h warmup · adblocker off. Use AdSense's own "Ads.txt" page if prompted — public/ads.txt can be added from your publisher panel.

❌ drizzle-kit push hangs

Wrong DB host or SSL flag. Neon requires ?sslmode=require. Also try npx drizzle-kit push --force.

❌ PWA "Install" button missing

Requires HTTPS + a served manifest.webmanifest (auto at /manifest.webmanifest) + user engagement. In dev/preview without HTTPS it correctly stays hidden.

❌ WhatsApp button opens but message is empty

Your orderTemplate in Admin → WhatsApp was cleared. Restore the default template from the seed or rewrite it using the listed variables.

❌ 500 on /admin after Neon free-tier sleep

Neon free databases cold-start in ~1s; refresh once. Vercel + Neon pooled connections handle this automatically afterwards.

Still stuck? Open the docs from the on-site footer or WhatsApp the team — the project README has the file map for quick orientation.