Loading repository dataβ¦
Loading repository dataβ¦
ashish7802 / repository
πͺ A production-grade 3D e-commerce platform built with Next.js, Three.js, Stripe, MongoDB, and TypeScript. Features interactive 3D product visualization, secure payments, admin dashboard, inventory management, analytics, and modern full-stack architecture.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Gravity Shop is a production-grade e-commerce storefront that combines WebGL-powered 3D product visualization with a complete checkout and admin management system. Customers browse products rendered in interactive 3D scenes, add items to a cart, and complete purchases through Stripe Checkout. Administrators manage products, users, orders, inventory, and store settings through a protected dashboard.
The application is server-rendered with Next.js 14 App Router, backed by MongoDB Atlas, and secured with JWT authentication verified cryptographically at the Edge middleware layer.
Ctrl+K)jose on all /admin routesconstructEvent()| Layer | Technology | Purpose |
|---|---|---|
| Framework | Next.js 14 (App Router) | Server/client rendering, API routes, middleware |
| Language | TypeScript 5 | Type safety across the stack |
| UI Library | React 18 | Component architecture |
| 3D Engine | Three.js + React Three Fiber + Drei | WebGL product visualization |
| Animation | Framer Motion + GSAP | Page transitions and micro-animations |
| Styling | Tailwind CSS 3 | Utility-first CSS |
| State | Zustand | Client-side cart and auth state |
| Database | MongoDB Atlas + Mongoose 9 | Document storage and ODM |
| Payments | Stripe SDK | Checkout sessions and webhook processing |
| Media | Cloudinary | Image and 3D model (GLB) hosting |
| Cache | Upstash Redis | Rate limiting |
| Auth | jsonwebtoken + jose + bcryptjs | Token signing, edge verification, password hashing |
| Charts | Recharts | Admin analytics visualization |
| Icons | Lucide React | UI iconography |
graph TB
subgraph Client
Browser["Browser"]
R3F["React Three Fiber"]
Zustand["Zustand Store"]
end
subgraph Edge
MW["Middleware (jose JWT)"]
end
subgraph "Next.js Server"
Pages["App Router Pages"]
API["API Routes"]
Auth["Auth API"]
Checkout["Checkout API"]
Webhook["Stripe Webhook"]
AdminAPI["Admin API"]
end
subgraph "External Services"
MongoDB["MongoDB Atlas"]
Stripe["Stripe"]
Cloudinary["Cloudinary"]
Redis["Upstash Redis"]
end
Browser --> MW
MW --> Pages
MW --> API
Browser --> R3F
Browser --> Zustand
Auth --> MongoDB
AdminAPI --> MongoDB
AdminAPI --> Cloudinary
Checkout --> Stripe
Checkout --> MongoDB
Webhook --> MongoDB
API --> Redis
gravity-shop/
βββ app/
β βββ (admin)/ # Admin route group
β β βββ analytics/page.tsx # Revenue & sales dashboard
β β βββ inventory/page.tsx # Stock management
β β βββ orders/page.tsx # Order management
β β βββ products/page.tsx # Product CRUD
β β βββ settings/page.tsx # Store configuration
β β βββ users/page.tsx # User management
β β βββ layout.tsx # Admin sidebar layout
β β βββ page.tsx # Admin dashboard home
β βββ (user)/
β β βββ account/page.tsx # User profile & orders
β β βββ layout.tsx
β βββ api/
β β βββ admin/
β β β βββ analytics/ # GET aggregated stats
β β β βββ inventory/ # GET/PATCH stock levels
β β β βββ orders/ # GET/PATCH orders
β β β βββ products/ # GET/POST products
β β β βββ settings/ # GET/PUT store settings
β β β βββ upload/ # POST file uploads
β β β βββ users/ # GET users, PATCH user by ID
β β βββ auth/
β β β βββ login/ # POST credentials
β β β βββ register/ # POST new account
β β βββ checkout/ # POST Stripe session
β β βββ health/ # GET service status
β β βββ products/ # GET public products
β β βββ search/ # GET search results
β β βββ webhooks/stripe/ # POST Stripe events
β βββ product/[id]/page.tsx # Product detail page
β βββ layout.tsx # Root layout
β βββ page.tsx # Homepage
β βββ robots.ts # SEO robots
β βββ sitemap.ts # SEO sitemap
βββ components/
β βββ admin/ # AdminSidebar, ProductDataGrid, ProductUploadModal, GlowingChart
β βββ animations/ # CartFlyAnimation
β βββ auth/ # AuthModal
β βββ canvas/ # Scene, FloatingProduct, Environment
β βββ cart/ # CartDrawer, CartItemCard, CartScene, CartSummary
β βββ product/ # ProductCard3D, ProductGrid, ProductDetails, ProductViewer, etc.
β βββ ui/ # Navbar, Hero, SearchPalette, GlassPanel, MagneticCursor, FloatingGradientBackground
βββ lib/
β βββ db/connect.ts # MongoDB connection singleton
β βββ models/
β β βββ User.ts # User schema (name, email, password, role, isActive)
β β βββ Product.ts # Product schema (name, slug, price, stock, images, model3d)
β β βββ Order.ts # Order schema (items, status, stripeSessionId)
β β βββ Setting.ts # Settings schema (key-value store by category)
β βββ api-error.ts # Structured error handling
β βββ cloudinary.ts # Upload helper
β βββ env.ts # Environment validation
β βββ logger.ts # Server-side logger
β βββ rate-limit.ts # Upstash rate limiter
βββ store/
β βββ useAppStore.ts # Zustand store (cart, auth, UI state)
βββ middleware.ts # Edge JWT verification for /admin routes
βββ next.config.mjs
βββ tailwind.config.ts
βββ tsconfig.json
βββ package.json
# Clone the repository
git clone https://github.com/ashish7802/Gravity-Shop.git
cd Gravity-Shop
# Install dependencies
npm install --legacy-peer-deps
Note: The
--legacy-peer-depsflag is required due to peer dependency conflicts between React 18 and@react-three/drei.
Create a .env.local file in the project root with the following variables:
# MongoDB
MONGODB_URI=
# Authentication
JWT_SECRET=
# Stripe
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
# Cloudinary
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
# Upstash Redis
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=
β οΈ Important: Never commit
.env.localto version control. The.gitignorealready excludes it.
# Start the development server
npm run dev
Open http://localhost:3000 in your browser.
# Build for production
npm run build
# Start the production server
npm start
https://your-domain.com/api/webhooks/stripe.checkout.session.completed event.STRIPE_WEBHOOK_SECRET.# For local testing with Stripe CLI
stripe listen --forward-to localhost:3000/api/webhooks/stripe
Cloud Name, API Key, and API Secret into your environment variables.gravity-shop/images/.gravity-shop/models/.0.0.0.0/0 for development).MONGODB_URI.usersproductsorderssettingsAccess the admin dashboard at /admin after logging in with an admin account.
To create the first admin user, register a normal account and then update the role directly in MongoDB:
db.users.updateOne(
{ email: "your-email@example.com" },
{ $set: { role: "admin" } }
)
| Page | Route | Functionality |
|---|---|---|
| Dashboard | /admin | Overview with quick stats |
| Products | /admin/products | CRUD with image/model uploads |
| Inventory | /admin/inventory | Stock levels and low-stock alerts |
| Orders | /admin/orders | Status management and filtering |
| Users | /admin/users | Search, pagination, role toggle, activation |
| Analytics | /admin/analytics | Revenue charts, top products, trends |
| Settings | /admin/settings | Store, payment, media, email config |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST | /api/auth/register | Pu |