Skip to content

dp-wu/erp

Repository files navigation

Shopify ERP/WMS (Lightweight, Open Source)

This project is a lightweight ERP/WMS prototype built with Django.

We previously had a Shopify DB backend focused mainly on data storage. Now we’re rebuilding it with Django, connecting backend (data + logic) and frontend (user workflows) in a single system so different user roles (Admin and Manager) can use it easily. The goal is a lightweight, open-source WMS that integrates with Shopify first and can extend to other platforms (e.g., TikTok Shop).


Project Structure

  • accounts — Custom user model; Tenant & User management
  • erp/settings — Environment-based configuration (base/dev/test/prod)
  • check_env.py — Environment variable validation script
  • tests/ — Pytest tests (global or per-app)
  • requirements.txt — Python dependencies

Environment Setup

1) Create virtual environment

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

2) Configure PostgreSQL

Local / CI (default)

By default, the project connects to a dummy test database:

DB_NAME=shopify_erp_test
DB_USER=postgres
DB_PASSWORD=postgres
DB_HOST=127.0.0.1
DB_PORT=5432

This is the configuration you should commit in .env.sample (safe for GitHub). If you clone the repo without additional setup, the system will fall back to this shopify_erp_test database.

AWS (real deployment)

Create the development database:

createdb -U postgres -h localhost shopify_erp_dev

Example .env.development:

DJANGO_ENV=development
DJANGO_SECRET_KEY=change-me
DEBUG=True

DB_NAME=shopify_erp_dev
DB_USER=postgres
DB_PASSWORD=postgres
DB_HOST=127.0.0.1
DB_PORT=5432

ALLOWED_HOSTS=127.0.0.1,localhost
CSRF_TRUSTED_ORIGINS=http://127.0.0.1:8000

Use .env.test for CI/tests and .env.production for deployment. Commit only .env.sample, never real .env.*.

3) Run migrations

python manage.py makemigrations
python manage.py migrate

4) Start development server

python manage.py runserver

Development Guidelines

  • Branch strategy

    • develop — active development
    • main — production-ready code
  • Commit messages

    • feat: ... (feature)
    • fix: ... (bug fix)
    • chore: ... (config/infra/cleanup)
  • Environment isolation

    • All secrets/configs must come from .env.* files (validated by check_env.py).

TODO Roadmap

✅ Completed

  • Django project initialization
  • Multi-environment configuration (dotenv + dev/test/prod)
  • Minimal pytest setup
  • .gitignore and .env.sample
  • check_env.py script
  • Created accounts app
  • Defined Tenant and custom User model (roles: admin/manager)

🚧 In Progress

  • Apply migrations on the target DB and verify accounts_* tables
  • Create initial Tenant + User via Django admin
  • Verify Tenant/User via Django shell

📌 Upcoming

  • Admin invites Manager (token + expiration, status=invited → active)
  • Role-based access decorator @require_admin
  • Shopify connector (OAuth + Webhooks with HMAC validation)
  • Ingest module (EventLog + idempotency + normalization)
  • Datahub module (Products, Orders, Inventory; CSV exports for Manager)
  • Notify module (instant alerts + daily digest via email)
  • Deployment (CI/CD; container/Docker optional later)

Architecture Overview

flowchart LR
    subgraph Shopify
        A[Shopify Store]
    end

    subgraph Connector
        B[Shopify Connector - OAuth and Webhooks]
    end

    subgraph Ingest
        C[EventLog - Idempotency - Normalizer]
    end

    subgraph Datahub
        D[Products / Orders / Inventory]
    end

    subgraph Notify
        E[Email Alerts / Digests]
    end

    subgraph Users
        U1[Admin]
        U2[Manager]
    end

    A -- Webhooks --> B
    B --> C
    C --> D
    C --> E
    D -- CSV Exports --> U2
    U1 -- Invite/Manage --> D
Loading

Project Goal

This repository is the Django-based rewrite of our original Shopify DB backend. We’re evolving from cross-platform data-only storage to a full-stack lightweight ERP/WMS that bridges backend data with a user-facing workflow layer. By open-sourcing it, we aim to help small e-commerce teams manage inventory, sync Shopify data, and scale to multiple platforms with minimal overhead.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages