Official MSPixelPulse backend API for authentication, users, agency projects, client workspaces, messaging, billing, portfolio content, and secure file workflows.
- Google Sheets is the production application database.
- Google Drive is the production file-storage provider.
- Mongoose schemas remain as a temporary controller-compatibility façade; the Google provider is the configured production data source.
- Vercel hosts the API and frontend.
- Vercel hosts the React frontend.
- Authentication is custom JWT auth with Authorization header support and an HTTP-only cookie.
- Node.js and Express
- Google Sheets and Google Drive
- Mongoose compatibility façade
- JSON Web Tokens
- Google OAuth2 with refresh-token authentication
- Multer memory uploads
- Socket.IO
- Vercel deployment
src/app.js- Express app, middleware, health endpoints, API mountingsrc/server.js- local HTTP boot process and optional legacy Mongo compatibility connectionapi/index.js- Vercel serverless Express entrypointsrc/config/- environment, CORS, providers, and optional Mongo compatibility helperssrc/features/- feature controllers and routessrc/models/- Mongoose schemassrc/google/- OAuth, Sheets, Drive, and bounded retry utilitiessrc/repositories/- provider-neutral domain repositoriessrc/storage/- Google Drive storage provider and storage interfacesrc/middleware/- auth, roles, error handlingsrc/lib/- storage, file-policy, authorization, and health helperssrc/scripts/- seed and maintenance scripts
npm install
cp .env.example .env
npm run devLocal API default:
http://localhost:4000
Use .env.example as the source of truth. Never commit .env.
Required for normal operation:
NODE_ENV=development
PORT=4000
JWT_SECRET=replace-with-long-random-secret
JWT_EXPIRES_IN=7d
CORS_ORIGIN=http://localhost:5173,https://mspixelpulse.com,https://www.mspixelpulse.com
COOKIE_SECURE=false
Required production provider configuration:
DATA_PROVIDER=google
STORAGE_PROVIDER=google-drive
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REFRESH_TOKEN=
GOOGLE_DATABASE_SPREADSHEET_ID=
GOOGLE_DRIVE_ROOT_FOLDER_ID=
GOOGLE_DRIVE_CLIENT_FILES_FOLDER_ID=
GOOGLE_DRIVE_PROJECT_FILES_FOLDER_ID=
See docs/google-vercel-migration-2026-08-15.md
for the verified Google migration record and recovery notes.
Required for contact and blog notification email:
RESEND_API_KEY=
RESEND_FROM_EMAIL="MSPixelPulse <info@mspixelpulse.com>"
PUBLIC_SITE_URL=https://mspixelpulse.com
ANONYMOUS_ID_SALT=replace-with-long-random-secret
NOTIFICATION_RECIPIENTS=info@mspixelpulse.com,mspixelpulse@gmail.com
The backend sends through Resend over HTTPS, avoiding outbound SMTP connection delays and app-password handling. The sending domain must be verified with the provider.
info@mspixelpulse.com remains the public business and sender-facing address. Internal contact and blog notifications are delivered to both info@mspixelpulse.com and mspixelpulse@gmail.com; recipient lists are de-duplicated. Use the per-event flags in .env.example to pause a notification category without disabling the underlying database action.
Production super-admin seed:
SUPER_ADMIN_EMAIL=mahakpateluiux@gmail.com
SUPER_ADMIN_PASSWORD=replace-with-secure-secret
SUPER_ADMIN_NAME=Mahak Patel
Debug routes are disabled by default:
ENABLE_DEBUG_ROUTES=false
DEBUG_ROUTE_KEY=
Production must use DATA_PROVIDER=google and STORAGE_PROVIDER=google-drive.
Google Sheets records use stable IDs, never row numbers. Google Drive files are
private and referenced by Drive file IDs plus logical metadata in the Files
sheet. OAuth failures surface as controlled storage/configuration errors rather
than switching to another provider.
- Frontend posts to
POST /api/auth/login. - Backend normalizes the email with
trim().toLowerCase(). - The Users repository reads
passwordHashfrom the Users Sheet. - Password is verified with bcrypt.
- Active users receive a JWT.
- Frontend stores the token and redirects by role.
Demo-safe accounts should be created with environment-provided passwords only. Do not publish production or demo passwords in docs, frontend code, backend code, logs, or seed output.
GET /healthGET /api/healthPOST /api/auth/registerPOST /api/auth/loginPOST /api/auth/logoutGET /api/auth/meGET /api/admin/usersGET /api/projectsPOST /api/files/uploadPUT /api/projects/:projectId/requirementsPOST /api/users/me/avatarPOST /api/contactGET /api/blog-engagement/:slugPUT|DELETE /api/blog-engagement/:slug/reactionPOST /api/blog-engagement/:slug/commentsPOST /api/blog-engagement/:slug/sharesPOST /api/blog-engagement/subscriptionsGET /api/blog-engagement/subscriptions/confirmGET /api/blog-engagement/subscriptions/unsubscribeGET /api/admin/blog-engagement/*(admin only)
Health endpoints are public and safe:
curl https://api.mspixelpulse.com/health
curl https://api.mspixelpulse.com/api/healthThey report process status, environment, uptime, the selected providers, and Google Drive configuration without exposing hosts, keys, passwords, or tokens.
Protected production super admin:
SUPER_ADMIN_EMAIL='mahakpateluiux@gmail.com' SUPER_ADMIN_PASSWORD='set-secure-value' SUPER_ADMIN_NAME='Mahak Patel' npm run seed:super-adminPortal demo users and sample invoice:
PORTAL_DEMO_CLIENT_PASSWORD='set-secure-value' PORTAL_DEMO_DEVELOPER_PASSWORD='set-secure-value' npm run seed:portal-demo
npm run seed:demo-invoiceLegacy local demo users require explicit password environment variables:
SEED_DEMO_ADMIN_PASSWORD='set-secure-value' SEED_DEMO_CLIENT_PASSWORD='set-secure-value' SEED_DEMO_DEVELOPER_PASSWORD='set-secure-value' \
npm run seed:demoSeed commands are idempotent and do not log passwords. Use demo seeds for local/dev or controlled production preview data only.
Production Vercel variables include:
NODE_ENV=production
JWT_SECRET
JWT_EXPIRES_IN=7d
CORS_ORIGIN=https://mspixelpulse.com,https://www.mspixelpulse.com
COOKIE_SECURE=true
DATA_PROVIDER=google
STORAGE_PROVIDER=google-drive
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
GOOGLE_REFRESH_TOKEN
GOOGLE_DATABASE_SPREADSHEET_ID
GOOGLE_DRIVE_ROOT_FOLDER_ID
GOOGLE_DRIVE_CLIENT_FILES_FOLDER_ID
GOOGLE_DRIVE_PROJECT_FILES_FOLDER_ID
Do not overwrite real dashboard secrets with placeholder values.
- Login fails with network errors: check the Vercel API health endpoint and
/health. - Uploads return
503: check the server-only Google OAuth and Drive environment variables. - CORS errors: confirm
CORS_ORIGINincludes the exact frontend origin. The canonical public origin ishttps://mspixelpulse.com. - Invalid credentials: seed the expected admin/demo users or confirm the account is active.
- Never commit
.env, cookies, keys, tokens, dumps, or backups. - Rotate secrets if they were ever committed to Git history.
- Debug routes require
ENABLE_DEBUG_ROUTES=trueand, in production,x-debug-key.