Skip to content

topshopifydev/Shopify-Survey-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ Shop-Sense β€” Shopify Survey App

Know exactly how your customers found you. Shop-Sense drops a lightweight "How did you hear about us?" survey into your Shopify storefront and turns the answers into a clean, Polaris-powered analytics dashboard.

Node.js Next.js React Express MongoDB Polaris Docker License


✨ Why Shop-Sense?

Attribution is one of the hardest things for a store owner to measure. Ad platforms take credit, referrals go untracked, and "word of mouth" is invisible. Shop-Sense asks the customer directly β€” right at checkout β€” and stores every answer so you can see which channels actually drive sales.

  • πŸ“‹ One-tap survey injected into your storefront cart/checkout β€” no theme rebuild required.
  • 🎯 Source attribution (Social Media Β· Search Engine Β· Friend Β· Other) captured per response.
  • πŸ“Š Merchant dashboard built with Shopify Polaris for a native admin look and feel.
  • 🧱 Clean REST API you can extend with new questions, product data, or exports.
  • 🐳 Dockerized backend for one-command deployment anywhere.

πŸ—οΈ Architecture

Shopify Storefront                Frontend (Next.js)            Backend (Express + MongoDB)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ inject-survey.js   β”‚           β”‚  /            Home β”‚        β”‚  GET  /api/products      β”‚
β”‚  "How did you hear │──POST────▢│  /dashboard  Admin │──────▢ β”‚  POST /api/survey/submit β”‚
β”‚   about us?"       β”‚           β”‚  Polaris UI + proxyβ”‚        β”‚  GET  /api/survey/...    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚        ⇩ Mongoose        β”‚
                                                                β”‚      MongoDB Atlas       β”‚
                                                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Layer Stack Location
Storefront widget Vanilla JS injected into the cart backend/scripts/inject-survey.js
Backend API Node.js Β· Express (ESM) Β· Mongoose backend/
Frontend Next.js 15 Β· React 18 Β· Shopify Polaris Β· Tailwind CSS frontend/
Admin dashboard Polaris IndexTable frontend/pages/dashboard.js

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • A MongoDB connection string (local or MongoDB Atlas)

1️⃣ Clone & install

git clone https://github.com/topshopifydev/Shopify-Survey-App.git
cd Shopify-Survey-App

# Backend
cd backend && npm install

# Frontend
cd ../frontend && npm install

2️⃣ Configure environment

Create backend/.env:

MONGO_URI=mongodb+srv://<user>:<password>@<cluster>/shop-sense
PORT=5000

3️⃣ Run in development

# Terminal 1 β€” API on http://localhost:5000
cd backend && npm run dev

# Terminal 2 β€” Web app on http://localhost:3000
cd frontend && npm run dev

The frontend proxies /api/* to the backend automatically (see frontend/next.config.js), so no CORS wrangling in dev.


πŸ”Œ API Reference

Method Endpoint Description
GET /api/products Returns the demo product catalog
POST /api/survey/submit Saves a survey response β€” body: { "source": "social_media" }
GET /api/survey/responses Returns all collected survey responses
GET / Health check

Example β€” submit a response:

curl -X POST http://localhost:5000/api/survey/submit \
  -H "Content-Type: application/json" \
  -d '{"source":"search_engine"}'

🧩 Embedding the survey in your Shopify theme

Include inject-survey.js in your theme (or via a script tag / theme app extension). It looks for a .cart element, appends the survey form, and posts answers to /api/survey/submit β€” no duplicate forms, with inline success/error messaging.


🐳 Docker

cd backend
docker build -t shop-sense-backend .
docker run -p 5000:5000 --env-file .env shop-sense-backend

πŸ—‚οΈ Project Structure

Shopify-Survey-App/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ server.js               # Express app + products API
β”‚   β”œβ”€β”€ routes/survey.js        # Survey submit / responses endpoints
β”‚   β”œβ”€β”€ models/SurveyResponse.js# Mongoose schema
β”‚   β”œβ”€β”€ config/db.js            # MongoDB connection
β”‚   β”œβ”€β”€ scripts/inject-survey.js# Storefront survey widget
β”‚   └── Dockerfile
└── frontend/
    β”œβ”€β”€ pages/
    β”‚   β”œβ”€β”€ index.js            # Home + product list
    β”‚   └── dashboard.js        # Polaris survey dashboard
    β”œβ”€β”€ components/             # SurveyForm Β· ProductList Β· DataTable
    └── next.config.js          # API proxy config

πŸ›£οΈ Roadmap

  • Wire survey routes + MongoDB into server.js startup
  • Configurable, multi-question surveys
  • CSV / analytics export from the dashboard
  • Official Shopify theme app extension
  • Response charts & channel breakdown

🀝 Contributing

Contributions are welcome! Open an issue to discuss a feature, or fork the repo and submit a pull request. If Shop-Sense helps you, please ⭐ star the repo β€” it genuinely helps others discover it.

πŸ“„ License

Released under the MIT License.

About

πŸ›οΈ Shop-Sense β€” a Shopify post-checkout survey app that asks customers "How did you hear about us?" and turns the answers into a Polaris analytics dashboard. Node.js + Express + MongoDB backend, Next.js 15 frontend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages