Skip to content

About

Art and news, travel

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

OfRoot E-Commerce Platform

A production-ready, multi-tenant e-commerce platform with admin dashboard built with Next.js, TypeScript, and PostgreSQL.

Overview

This is a comprehensive SaaS e-commerce platform designed for scalability, multi-tenancy, and long-term maintainability. It includes:

  • Storefront: Public-facing e-commerce site (SEO-friendly, SSR)
  • Dashboard: Admin/seller dashboard for managing products, orders, and customers
  • Multi-tenancy: Complete tenant isolation at the database and application level
  • RBAC: Role-based access control with data-driven permissions
  • Billing: Stripe integration with subscription plans and usage limits

Architecture

This is a monorepo managed with Turborepo:

/apps
  /storefront      → Public e-commerce site
  /dashboard       → Admin / seller dashboard
/packages
  /ui              → Radix-wrapped UI components
  /auth            → Auth + tenant resolution
  /billing         → Stripe logic
  /core            → Domain models & utilities

Tech Stack

  • Frontend: Next.js 14 (App Router), React 18, TypeScript
  • UI: Radix UI (wrapped), Tailwind CSS
  • State: Zustand
  • Backend: REST/Server Actions, PostgreSQL
  • Payments: Stripe
  • Monorepo: Turborepo

Getting Started

Prerequisites

  • Node.js >= 18.0.0
  • npm >= 9.0.0
  • PostgreSQL >= 14

Installation

npm install

Development

Run all apps in development mode:

npm run dev

Or run individual apps:

# Storefront (port 3000)
cd apps/storefront && npm run dev

# Dashboard (port 3001)
cd apps/dashboard && npm run dev

Build

Build all apps:

npm run build

Type Checking

npm run type-check

Linting

npm run lint

Documentation

Key Features

Multi-Tenancy

  • Complete tenant isolation at database level
  • Server-side tenant resolution (never trust client)
  • Subdomain-based tenant routing

E-Commerce Domain

  • Product catalog with variants
  • Inventory management
  • Order processing and fulfillment
  • Customer management
  • Discount/coupon system
  • Payment processing

Dashboard Capabilities

  • Product CRUD
  • Inventory management
  • Order management
  • Payment tracking
  • Fulfillment tracking
  • Discount management
  • User & role management

Billing & Plans

  • Free, Starter, Professional, Enterprise tiers
  • Usage-based limits (products, orders, users)
  • Feature gates
  • Stripe integration

Design System

  • CSS variable-based theming
  • Radix UI components (wrapped for consistency)
  • Accessible by default
  • Mobile-responsive

Development Guidelines

Code Quality

  • TypeScript strict mode (no any)
  • Composition over inheritance
  • Small, focused functions
  • JSDoc for public APIs

Architecture Rules

  1. Never place business logic in UI components
  2. Never use Radix components directly (use wrappers from @ofroot/ui)
  3. Every database operation must be tenant-scoped
  4. All mutations return typed results
  5. Errors must be structured

Security

  • Tenant isolation enforced server-side
  • Row-level security on database
  • Input validation (client + server)
  • SQL injection prevention
  • XSS protection

License

Proprietary - All rights reserved

About

Art and news, travel

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages