Skip to content

001 multi tenant ecommerce#64

Merged
rezwana-karim merged 369 commits intomainfrom
001-multi-tenant-ecommerce
Nov 11, 2025
Merged

001 multi tenant ecommerce#64
rezwana-karim merged 369 commits intomainfrom
001-multi-tenant-ecommerce

Conversation

@rezwana-karim
Copy link
Copy Markdown
Collaborator

This pull request introduces several foundational improvements and best practices to the project, focusing on environment configuration, code quality, repository hygiene, and process documentation. The changes help standardize development workflows, improve maintainability, and set up the project for scalable development and collaboration.

Configuration & Environment Setup

  • Added a comprehensive .env.example file with placeholder values for all required environment variables, including database, authentication, integrations (Stripe, Shopify, Mailchimp), email, analytics, and more, to guide developers in local setup and deployment.

Repository Hygiene & Ignore Rules

  • Added and updated ignore files (.dockerignore, .eslintignore) to prevent dependencies, build artifacts, logs, test outputs, and sensitive files from being committed or included in builds, improving security and reducing repository clutter. [1] [2]

Code Quality & Linting

  • Introduced a new ESLint configuration in .eslintrc.json extending Next.js core web vitals and warning on console usage (except for warn and error), promoting code quality and consistency.

Process & Documentation Templates

  • Added a test suite improvement issue template to .github/ISSUE_TEMPLATE/test-suite-improvement.md to systematically track and resolve failing tests, document root causes, proposed solutions, and expected outcomes.

Agent & Automation Documentation

  • Added two detailed agent definition files for UI/UX auditing and refactoring with Next.js and Radix UI: .github/agents/ui-ux-nextjs-pro.md and .github/agents/nextjs-ui-ux-expert.agent.md, outlining responsibilities, tools, workflow, and coding conventions for automated design and accessibility improvements. [1] [2]

Description

Why

Fixes #
Related to #

What

Type of Change

Please check the relevant option(s):

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 Style/UI change
  • ♻️ Code refactoring (no functional changes)
  • ⚡ Performance improvement
  • ✅ Test addition or update
  • 🔧 Configuration change
  • 🏗️ Infrastructure change

Checklist

Please ensure your PR meets the following requirements:

Code Quality

  • Code follows the project's TypeScript and code style guidelines
  • Code is properly formatted (ran npm run format)
  • Code passes linting (ran npm run lint)
  • TypeScript compiles without errors (ran npm run type-check)
  • No any types used (except for documented third-party library interfaces)
  • File size limits respected (max 300 lines per file, 50 lines per function)

Testing

  • All existing tests pass (ran npm run test)
  • New tests have been added for new features or bug fixes
  • Test coverage meets requirements:
    • Business logic: minimum 80% coverage
    • Utility functions: 100% coverage
    • API routes: integration tests added
    • Critical paths: E2E tests added (if applicable)
  • Tests follow AAA pattern (Arrange, Act, Assert)

Security & Best Practices

  • Authentication checks are in place for protected routes
  • Multi-tenant isolation is enforced (storeId filtering)
  • Input validation is implemented using Zod schemas
  • No secrets or sensitive data in code (using environment variables)
  • SQL injection prevention (using Prisma, no raw SQL)
  • XSS prevention (proper input sanitization)

Documentation

  • Documentation has been updated (if applicable)
  • JSDoc comments added for complex functions
  • API documentation updated (if API changes were made)
  • README.md updated (if needed)
  • Specification documents updated (if architectural changes were made)

Database (if applicable)

  • Database migration created (if schema changes were made)
  • Migration tested on local database
  • Seed data updated (if needed)
  • Indexes added for new query patterns
  • Soft delete pattern followed for user-facing data

Accessibility (if UI changes were made)

  • Meets WCAG 2.1 Level AA standards
  • Keyboard navigation works properly
  • ARIA labels added where necessary
  • Color contrast ratios meet requirements (≥ 4.5:1)
  • Focus indicators are visible
  • Alt text provided for images
  • Tested with screen reader (if major UI changes)

Performance (if applicable)

  • Page load time within budget (< 2.0s LCP desktop, < 2.5s mobile)
  • API response time within budget (< 500ms p95)
  • Database queries optimized (no N+1 queries)
  • Images optimized (using Next.js Image component)
  • Bundle size within limits (< 200KB initial load)

Build & Deployment

  • Build succeeds locally (ran npm run build)
  • No console errors or warnings
  • Environment variables documented (if new ones added)
  • Works in both development and production modes

Screenshots (if applicable)

Before

After

Additional Context

Reviewer Notes


By submitting this pull request, I confirm that:

  • I have read and agree to follow the Code of Conduct
  • I have read the Contributing Guidelines
  • My contribution is original work or properly attributed
  • I agree to license my contribution under the project's MIT License

rezwana-karim and others added 30 commits October 28, 2025 03:24
Added comprehensive unit tests for InventoryService covering status determination, inventory queries, history, and stock adjustment logic. Fixed Prisma search filter by removing unsupported 'mode: insensitive' and exported determineInventoryStatus for testing.
Enhanced cart validation error messages for unavailable products and insufficient stock, and ensured stock checks only occur when inventory tracking is enabled. Refactored payment-service tests to use shared mock objects for Stripe, improving test clarity and maintainability. Updated checkout-service tests to mock product and address creation more accurately.
Added a comprehensive guide for a professional UI/UX designer focused on Next.js 16, detailing responsibilities, design system, tools, and coding conventions.
Co-authored-by: rezwana-karim <126201034+rezwana-karim@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

❌ E2E Test Results

Some E2E tests failed.

Test Configuration
  • Browsers: Chromium, Firefox, WebKit
  • Node Version: 18
  • Playwright Version: 1.56.0

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces a comprehensive foundation for the StormCom multi-tenant e-commerce platform, establishing critical development infrastructure, configuration standards, and documentation frameworks to support scalable SaaS development.

Key Changes:

  • Configuration & Environment Setup: Added .env.example with comprehensive environment variables (database, authentication, payment gateways, email, analytics) to guide local and production setup
  • Repository Hygiene & Automation: Introduced .dockerignore, .eslintignore, .prettierrc, .prettierignore, updated .github/dependabot.yml with daily security updates and grouped dependencies
  • Process Documentation & Testing: Added GitHub issue templates, E2E workflow (.github/workflows/e2e.yml), Copilot validation workflow, and comprehensive test suite summary (TEST_SUMMARY.md)

Reviewed Changes

Copilot reviewed 102 out of 867 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
TEST_SUMMARY.md Documents test suite improvement (78% → 93% pass rate), 161 tests fixed across 7 files, roadmap for remaining 54 failures
README.md Expanded from 247 to 633 lines with Next.js 16 details, MCP server integration, comprehensive tech stack, performance budgets, accessibility standards
.vscode/tasks.json, .vscode/settings.json, .vscode/mcp.json, .vscode/.mcp.json VS Code workspace configuration for Next.js dev server, Copilot agent settings, MCP server integration
.specify/memory/constitution.md Updated version 1.1.0 → 1.2.0 with NextAuth.js v4.24.13 pinned, enhanced testing requirements (visual regression, accessibility, performance, cross-browser)
.prettierrc, .prettierignore Prettier configuration with Tailwind plugin, ignore patterns for build artifacts and dependencies
.github/workflows/e2e.yml Playwright E2E test workflow with cross-browser matrix, test artifacts, Slack notifications, PR comments
.github/prompts/*.prompt.md (10 files) Agent definition files for README generation, PRD creation, architecture blueprints, Playwright automation, Docker multi-stage builds, Jest testing, documentation writing, specifications, ADRs, epic/feature breakdowns
.github/instructions/*.instructions.md (5 files) Updated testing, Next.js (1560 lines), documentation, database, components, API routes instructions with constitution references, Next.js 16 migration guide, MCP server integration
.github/instructions/nextjs.instructions.CHANGELOG.md Detailed changelog documenting Next.js instructions updates (1195 → 1560 lines) with MCP server integration section added
.github/dependabot.yml Enhanced with daily schedule, grouped dependencies (Next.js, Prisma, testing, code quality, UI libraries, dev deps), major version ignores, automated reviewer assignment
.github/copilot/validate-copilot-customizations.yml, .github/copilot/tests/*.{js,md} (3 files) Validation workflow and comprehensive test suite (validate.js, VALIDATION_REPORT.md, TESTING_GUIDE.md) for GitHub Copilot customizations

# StormCom - Multi-Tenant E-commerce SaaS Platform

**A modern, full-stack e-commerce management system built with Next.js 15, TypeScript, and Prisma ORM**
**A comprehensive full-stack e-commerce management system built with Next.js 16 (Including Next.js MCP Server), TypeScript, Prisma ORM, and Spec-Driven Development**
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phrase '(Including Next.js MCP Server)' is unclear. Suggest changing to '(with built-in MCP Server)' for clarity.

Suggested change
**A comprehensive full-stack e-commerce management system built with Next.js 16 (Including Next.js MCP Server), TypeScript, Prisma ORM, and Spec-Driven Development**
**A comprehensive full-stack e-commerce management system built with Next.js 16 (with built-in MCP Server), TypeScript, Prisma ORM, and Spec-Driven Development**

Copilot uses AI. Check for mistakes.

---

**Built with ❤️ using Next.js 16 (Including), TypeScript 5.9, Prisma, and Spec-Driven Development**
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phrase 'Next.js 16 (Including)' is incomplete. Suggest 'Next.js 16 (with MCP Server)' or remove the parenthetical if it's unclear.

Suggested change
**Built with ❤️ using Next.js 16 (Including), TypeScript 5.9, Prisma, and Spec-Driven Development**
**Built with ❤️ using Next.js 16 (Including Next.js MCP Server), TypeScript 5.9, Prisma, and Spec-Driven Development**

Copilot uses AI. Check for mistakes.
Comment on lines +1209 to +1228
export default function proxy(request: NextRequest) {
return NextResponse.next();
}
```

**Migration**:
```bash
# Use automated codemod
npx @next/codemod@canary middleware-to-proxy .

# Or manually:
# 1. Rename middleware.ts → proxy.ts
# 2. Rename function: middleware → proxy
# 3. Update all references in codebase
```

**Why**: Clarifies network boundary and aligns with proxy pattern. Only ONE proxy file per project allowed.

**Documentation**: https://nextjs.org/docs/app/api-reference/file-conventions/proxy

Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation link references a 'proxy' file convention that does not exist in Next.js 15.x. Verify this feature exists before documenting it, as middleware.ts is the correct convention in Next.js 15.

Suggested change
export default function proxy(request: NextRequest) {
return NextResponse.next();
}
```
**Migration**:
```bash
# Use automated codemod
npx @next/codemod@canary middleware-to-proxy .
# Or manually:
# 1. Rename middleware.ts → proxy.ts
# 2. Rename function: middleware → proxy
# 3. Update all references in codebase
```
**Why**: Clarifies network boundary and aligns with proxy pattern. Only ONE proxy file per project allowed.
**Documentation**: https://nextjs.org/docs/app/api-reference/file-conventions/proxy
export function middleware(request: NextRequest) {
return NextResponse.next();
}

Migration:
No migration required for Next.js 15.x. Continue using middleware.ts and the middleware function as per official documentation.

Why: middleware.ts is the correct convention for request interception in Next.js 15.x. Only ONE middleware file per project allowed.

Documentation: https://nextjs.org/docs/app/building-your-application/routing/middleware

Copilot uses AI. Check for mistakes.
# Test Suite Improvement - Final Summary

**PR**: fix: resolve TypeScript issues and improve test suite reliability (78% → 93%) + roadmap
**Date**: 2025-11-09
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The date '2025-11-09' is in the future relative to the knowledge cutoff of January 2025. This appears to be a typo. Verify and correct to the intended date (likely 2024-11-09).

Suggested change
**Date**: 2025-11-09
**Date**: 2024-11-09

Copilot uses AI. Check for mistakes.
@rezwana-karim rezwana-karim marked this pull request as ready for review November 11, 2025 13:22
@rezwana-karim rezwana-karim merged commit 6b033f3 into main Nov 11, 2025
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants