Skip to content

Latest commit

 

History

112 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openfront-grocery

Deploy with Vercel

Deploy on Railway

Openfront Grocery is a self-hostable grocery storefront and store-operations platform. Shoppers can browse departments and products, build carts and lists, choose pickup or delivery, and manage orders and subscriptions. Store teams use the dashboard for merchandising, fresh inventory, purchasing, picking, substitutions, handoff, payments, and customer service.

Documentation: docs.openship.org/docs/openfront/grocery

Demo

Produce-market image used by the Grocery storefront

Demo name Juniper Market
Product Openfront Grocery
Storefront grocery.openship.org
Dashboard grocery.openship.org/dashboard
User [email protected]
Password 48dUYWcxNparnRLHFZKY

Learn more →

Documentation →

The Openfront Ecosystem

Every Openfront is open source and self-hostable. Try any of them on its live demo.

Product For Repository Demo Docs
Openfront E-commerce Online store: catalog, checkout, orders, fulfillment openfront e-commerce.openship.org Docs
Openfront Restaurant Online ordering, POS and kitchen display openfront-restaurant restaurant.openship.org Docs
Openfront Grocery (this repository) Grocery ordering, lots, expiry and pickup openfront-grocery grocery.openship.org Docs
Openfront Gym Memberships, classes, check-in and billing openfront-gym gym.openship.org Docs
Openfront Hotel Reservations, front desk, housekeeping, folios openfront-hotel hotel.openship.org Docs
Openfront Rental Short-term rental bookings and calendars openfront-rental rental.openship.org Docs
Openfront Salon Appointments, stylists and services openfront-salon salon.openship.org Docs
Openfront Barbershop Bookings, walk-ins and barbers openfront-barbershop barbershop.openship.org Docs
Openfront Coffee Shop Café ordering and counter POS openfront-coffeeshop coffee-shop.openship.org Docs
Openfront Real Estate Listings, showings and transactions openfront-realestate real-estate.openship.org Docs
Openfront Dealership Inventory, test drives, deals and service openfront-dealership dealership.openship.org Docs
Openfront Vape Age-gated retail with compliance controls openfront-vape vape.openship.org Docs
Openfront Convenience Convenience store POS and inventory openfront-convenience convenience.openship.org Docs
Openfront Collectibles Graded items, consignment and provenance openfront-collectibles collectibles.openship.org Docs
Openfront Cannabis Dispensary menu, packages and recalls openfront-cannabis cannabis.openship.org Docs
Openfront Pharmacy Prescriptions, inventory lots and pickup openfront-pharmacy pharmacy.openship.org Docs
Openfront Med Spa Treatments, consents and memberships openfront-medspa medspa.openship.org Docs
Openfront Construction Projects, bids, change orders and crews openfront-construction construction.openship.org Docs
Openfront Law Firm Matters, intake, time and billing openfront-law-firm law-firm.openship.org Docs
Openfront Scheduling Booking pages for appointment businesses openfront-scheduling scheduling.openship.org Docs
Openfront Social Creator community and posts openfront-social social.openship.org Docs
Openfront Rideshare Rides, drivers and dispatch openfront-rideshare rideshare.openship.org Docs
Openfront Airline Flights, booking and passenger operations openfront-airline airline.openship.org Docs
Openfront Hospital Appointments, patients and care teams openfront-hospital hospital.openship.org Docs
Openfront Sportsbook Markets, bets and results openfront-sportsbook sportsbook.openship.org Docs
Openfront Financial Accounts, portfolios and advisory openfront-financial financial.openship.org Docs
Openfront Analytics Privacy-friendly website analytics analytics analytics.openship.org Docs
Openship Order routing from sales channels to fulfillment openship os.openship.org Docs
Marketplace Shop across Openfront stores marketplace marketplace.openship.org Docs

Core Features

Admin Dashboard

Manage products, departments, orders, customers, suppliers, and purchasing. Dedicated workspaces cover inventory, fulfillment, pickup, delivery, payments, merchandising, subscriptions, communications, staff, and reports.

Storefront

Shoppers can browse products, departments, and deals, manage a cart, and check out for pickup or delivery. Account pages include orders, addresses, profile, and privacy requests. Shopping lists, favorites, and recurring subscriptions support repeat shopping.

Fresh Inventory & Purchasing

  • Lot inventory, stock movements, adjustments, counts, expiry, and recalls.
  • Case conversion and product-information version records.
  • Supplier records, purchase-order drafts, receiving, invoices, and credits.
  • Inventory allocations linked to order lines.

Pickup, Delivery & Substitutions

Pickup and delivery slots track fulfillment capacity. Staff manage picking, substitutions, packing, curbside check-in, parking, handoff, delivery routes, and returned-delivery rescheduling. Order-line fulfillment and settlement records preserve actual quantities and substitution outcomes.

Payments & Customer Retention

Stripe is the built-in public checkout adapter when enabled and configured. Payment sessions, signed webhook events, refunds, settlement matching, and financial closes support payment operations. Coupons, loyalty records, notification preferences, and subscriptions support customer retention.

Architecture

Technology Stack

  • Frontend: Next.js 16 with App Router and React 19.
  • Backend: KeystoneJS 6 with a GraphQL API.
  • Database: PostgreSQL with Prisma ORM.
  • Styling: Tailwind CSS 4 with shared shadcn/ui components.
  • Authentication: Session-based with role-based permissions.

Application Structure

openfront-grocery/
├── app/
│   ├── (storefront)/        # Shopping, checkout, account, and order pages
│   ├── dashboard/          # Store workspaces and first-admin setup
│   └── api/                # Health, payment, and optional AI/MCP endpoints
├── features/
│   ├── keystone/           # Models, access, commands, and projections
│   ├── platform/           # Store operations and onboarding
│   ├── storefront/         # Shopper components and screens
│   └── integrations/       # Payments
├── scripts/                # Operator scripts
└── components/             # Shared UI components

Data Models

The Keystone model registry and Prisma schema cover:

  • Stores, settings, users, roles, staff invitations, and access events.
  • Departments, products, suppliers, purchase orders, receipts, invoices, and credits.
  • Inventory lots, allocations, movements, adjustments, counts, recalls, and conversions.
  • Carts, cart items, checkout attempts, orders, order lines, and substitutions.
  • Pickup slots, delivery slots, parking spots, and delivery routes.
  • Payments, sessions, refunds, webhook events, settlements, and financial closes.
  • Coupons, loyalty, lists, favorites, recipes, subscriptions, customer messages, and privacy requests.

Getting Started

Prerequisites

  • Node.js 20.9 or later, compatible with Next.js 16.
  • A PostgreSQL database you can migrate.
  • npm.

Setup

  1. Clone and install dependencies:

    git clone https://github.com/openshiporg/openfront-grocery.git
    cd openfront-grocery
    npm install
  2. Configure environment variables:

    cp .env.example .env

    Update .env with your database and newly generated secrets:

    DATABASE_URL=postgresql://user:password@host/database
    SESSION_SECRET=replace-with-a-new-random-value-of-at-least-32-characters
    PUBLIC_STORE_ID=store_juniper
    PUBLIC_SIGNUPS_ALLOWED=false
    STRIPE_ENABLED=false
    MCP_ENABLED=false

    Generate each secret separately, for example with openssl rand -hex 32. Do not use the placeholder text as a secret.

    For local development, remove the template's placeholder NEXT_PUBLIC_SITE_URL and internal infrastructure placeholders unless you supply working values. Production requires NEXT_PUBLIC_SITE_URL as the deployed HTTPS origin, PUBLIC_STORE_ID=store_juniper, and the complete S3 configuration. Configure SMTP for email. Enable Stripe only after supplying its secret key, publishable key, and webhook secret. SHADOW_DATABASE_URL is for migration development, not normal application startup.

    Replace URL examples and internal routing overrides with your actual application origin, or remove optional overrides you do not need. Never commit your .env file.

  3. Start development server:

    npm run dev

    This builds Keystone, applies checked-in database migrations, and starts Next.js.

  4. Access the application: Open the URL npm run dev prints, then use these paths:

    • Storefront: /
    • Store dashboard: /dashboard
    • Customer account: /account
    • GraphQL API: /api/graphql
  5. Create your first admin user: Visit /dashboard/init on that application URL to create the initial administrator.

  6. Run store onboarding: Use dashboard onboarding to create the store's catalog, suppliers, inventory, and fulfillment settings. Review pickup and delivery capacity, payment providers, and storefront settings before accepting orders.

Development Commands

  • npm run dev - Build Keystone, apply migrations, and start Next.js development.
  • npm run build - Build Keystone and Next.js for production; does not apply migrations.
  • npm start - Start the production Next.js server.
  • npm run migrate:gen - Build Keystone, generate view ordering, and generate/apply development migrations.
  • npm run migrate - Apply checked-in Prisma migrations.
  • npm run lint - Run ESLint.

Use a development database for migrate:gen; it generates and applies schema changes.

Payment Integration

Payment adapters register Stripe for public checkout and a separate local test adapter. Custom remote operations require an explicitly allowed HTTPS origin. Configure Stripe using .env.example; test adapters are not production checkout providers.

Fulfillment Integration

Order-line fulfillment, delivery-route commands, and pickup actions coordinate store work through controlled mutations. Recurring baskets and refund status checks run from staff buttons; there are no workers or timers.

Events and notifications

NEVER build outbox/texting/email notification machinery or cron/worker services. External events = Openfront Commerce webhooks (features/webhooks in the openfront repo) only.

Documentation

See the Openfront Grocery documentation for the vertical's application guide, data model, access boundaries, and integration notes. The source models and business commands describe the implementation in this repository.

Security & Permissions

Role-Based Access Control

  • canAccessDashboard - Store dashboard access.
  • canManageProducts - Catalog and merchandising.
  • canManageOrders - Order and fulfillment operations.
  • canManageInventory - Inventory operations.
  • canManageSuppliers - Suppliers and purchasing.
  • canManageDelivery - Delivery operations.
  • canManagePayments - Payments and refunds.
  • canManageUsers - Staff and customer administration.

Security Features

  • Session-based authentication and store-scoped operations.
  • Privileged capabilities rechecked against current database state.
  • Customer ownership checks for carts, accounts, and orders.
  • Token-checked guest order access.
  • Stripe webhook verification and recorded payment-event identity.
  • Production GraphQL depth limits and disabled public introspection.

The current public store is the migrated store_juniper store; settings are singleton records, not an organization/location tenant hierarchy.

Platform Components

Admin Platform (/dashboard)

  • Catalog & merchandising: Products, departments, promotions, and product information.
  • Orders & fulfillment: Picking, substitutions, packing, and handoff.
  • Inventory & purchasing: Lots, expiry, counts, recalls, receipts, and suppliers.
  • Pickup & delivery: Slots, curbside check-in, parking, and delivery routes.
  • Payments & reports: Refunds, settlements, reconciliation, and financial closes.
  • Customers & staff: Accounts, subscriptions, communications, and staff access.

Storefront Experience

  • Product discovery: Departments, products, and deals.
  • Shopping: Cart, favorites, lists, and substitution preferences.
  • Checkout: Pickup or delivery selection and configured Stripe payment.
  • Account management: Order history, addresses, profile, privacy requests, and subscriptions.

Deployment

Production Deployment

The Vercel button imports this repository. Provision PostgreSQL and configure the environment, storage, and any enabled integrations separately.

Build the application, apply migrations as a release step, and start the production server:

npm run build
npm run migrate
npm start

Back up an existing database before applying migrations. The included railway.toml builds without migrations and applies them when the application starts.

Scaling Considerations

The web process is the only process. There are no worker, cron or scheduler services; time-based states are computed when a page loads or when staff press a button.

Contributing

Use the development commands above when preparing changes. Keep model changes and their migrations together, and describe any workflow or permission changes in your pull request.

License

This project is licensed under the MIT License. See LICENSE.

Support


Built with Next.js and KeystoneJS.