Skip to content

Repository files navigation

PackagePro

PackagePro β€” Custom Packaging Marketplace.

A full-stack packaging marketplace: a custom packaging marketplace that connects factories with traders β€” catalog + search, custom design editor, dynamic quoting, Stripe payments, vendor routing, production & QA workflow, DHL fulfilment, settlements and analytics β€” implemented as a monorepo with a Fastify + PostgreSQL backend and a Next.js frontend.

CI TypeScript Next.js Fastify

Screenshots

Home Catalog Design editor
Home Catalog Design editor

Screenshots show the frontend run locally against its seed data.

πŸš€ Quick Start

This is the fastest way to get started:

# 1. Clone the project
git clone https://github.com/Ma7moudll/packagepro.git
cd packagepro

# 2. Run the setup script
chmod +x scripts/setup.sh
./scripts/setup.sh

# 3. Run the project
# Terminal 1: Backend
cd backend && npm run dev

# Terminal 2: Frontend
cd frontend && npm run dev

App access:

πŸ“š Documentation

Project Structure

packagepro/
β”œβ”€β”€ backend/          # Fastify + TypeScript Backend
β”œβ”€β”€ frontend/         # Next.js 15 Frontend
β”œβ”€β”€ shared/           # Shared types and utilities
β”œβ”€β”€ docs/             # Documentation
β”œβ”€β”€ .github/          # GitHub Actions & Workflows
└── *.md              # Documentation files

Prerequisites

  • Node.js 20+
  • PostgreSQL 15+
  • Redis 7+
  • Docker & Docker Compose (optional)
  • npm or pnpm

Backend Setup

  1. Navigate to backend directory:
cd backend
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp env.example .env
# Edit .env with your configuration
  1. Set up database:
npm run prisma:generate
npm run prisma:migrate
npm run prisma:seed
  1. Start development server:
npm run dev

Backend will run on http://localhost:3000

Frontend Setup

  1. Navigate to frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Set up environment variables: Create .env.local:
NEXT_PUBLIC_API_URL=http://localhost:3000
  1. Start development server:
npm run dev

Frontend will run on http://localhost:3001

API Overview

API endpoints are available at /api. Main endpoints:

Authentication

  • POST /api/auth/register - Register new user Β· POST /api/auth/login - Login Β· POST /api/auth/refresh - Refresh token

Pricing

  • POST /api/pricing/calculate - Calculate price Β· GET /api/pricing/materials - Get materials

Orders

  • POST /api/orders - Create order Β· GET /api/orders/:id - Get order Β· GET /api/orders - List orders Β· PATCH /api/orders/:id/status - Update status

Designs

  • POST /api/designs/session - Create design session Β· POST /api/designs/save - Save design Β· GET /api/designs/:id - Get design

Payments

  • POST /api/payments/create-intent Β· POST /api/payments/confirm Β· POST /api/webhooks/stripe

Pre-Press & Approval

  • POST /api/orders/:id/prepress-check Β· GET /api/orders/:id/prepress-results Β· POST /api/orders/:id/request-approval Β· POST /api/orders/:id/approve

Purchase Orders

  • POST /api/orders/:id/create-po Β· GET /api/purchase-orders/:id Β· POST /api/purchase-orders/:id/confirm

Production

  • POST /api/production/start/:poId Β· POST /api/production/:id/progress Β· GET /api/production/:id

Samples & QA

  • POST /api/production/:productionId/samples Β· POST /api/samples/:id/approve Β· POST /api/samples/:id/reject

Shipping

  • POST /api/shipments/create/:id Β· GET /api/shipments/:id/tracking Β· POST /api/webhooks/dhl

Reviews

  • POST /api/reviews Β· GET /api/reviews/order/:orderId Β· GET /api/vendors/:id/reviews

Settlements & Finance

  • POST /api/settlements/process/:id Β· GET /api/vendors/:id/payments Β· GET /api/finance/reports

Key Features

  • Marketplace catalog β€” search, categories, verified factories, featured products, sample requests.
  • Dynamic Pricing Engine β€” real-time quoting over materials and specs (/api/pricing/calculate).
  • Custom Design Editor β€” design sessions, save/session API, 200+ templates.
  • Order lifecycle β€” orders β†’ pre-press quality check β†’ soft-proof approval β†’ vendor router (multi-criteria scoring + 4h handshake) β†’ PO (PDF) β†’ production/QA β†’ DHL shipment β†’ settlement (72h) β†’ reviews.
  • Payments β€” Stripe payment intents + webhooks (also PayPal/COD scaffolding).
  • Security baseline β€” JWT (15 min access + 7d refresh), bcrypt cost 12, Redis rate limiting with exponential backoff + reCAPTCHA v3, persistent AuditLog.
  • Jobs & integrations β€” BullMQ workers (email, settlement, reminders, marketing, export), SendGrid/SES email service, S3/R2 file storage + image optimization, DHL tracking.

Technology Stack

Backend

  • Fastify 4 (web framework) Β· Prisma 5 ORM Β· PostgreSQL Β· Redis
  • BullMQ (job queues) Β· Stripe (payments) Β· AWS S3 / CloudFlare R2 (files)
  • JWT auth Β· bcrypt (cost 12) Β· reCAPTCHA v3 Β· nodemailer (SendGrid/SES)
  • pdfkit / pdf-lib (PO & reports)

Frontend

  • Next.js 15 (App Router) Β· React 19 Β· TypeScript 5.3
  • Tailwind CSS Β· 3D package preview Β· design editor

CI/CD

  • .github/workflows/ci.yml β€” lint, type-check, tests and build on push/PR.
  • .github/workflows/deploy.yml β€” deployment pipeline stub.
  • .github/dependabot.yml β€” dependency updates.

Environment Variables

See backend/env.example for all required environment variables (database, Redis, JWT, S3/R2, Stripe, DHL, email providers, analytics).

Status & Known Limitations

  • Backend is the most complete part β€” 17 modules, 11 services, 18 Prisma tables, 5 BullMQ workers, Stripe/DHL/SES wired (per docs/guides/COMPLETION_SUMMARY.md). The frontend marketplace is the active focus (connecting real APIs per SPEC-029); several pages currently render seed/fixture data.
  • Third-party credentials are required, not bundled β€” Stripe, DHL, SendGrid/SES, S3/R2, reCAPTCHA and analytics keys come from backend/.env (cp env.example .env). None are committed (.env is gitignored).
  • Not deployed β€” deploy.yml is a pipeline stub; production hosting and environment provisioning are the operator's responsibility.
  • Backend tests run with Vitest; both packages expose npm run lint.
  • The FAQ/statistics on the landing page show seed figures until wired to the live API.

About

Custom packaging marketplace - Fastify+Prisma+PostgreSQL backend (Stripe, DHL, BullMQ, vendor routing) with a Next.js 15 storefront and design editor.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages