Skip to content

FP07/exact1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

TradeCore ERP — Plastics & Raw Materials Trading

A first MVP of an ERP system for a trading company dealing in plastics / raw materials.

Tech Stack

Layer Technology
Frontend Next.js 14 (React) + TypeScript
Styling Tailwind CSS
Backend Python FastAPI
Database SQLite (easy switch to PostgreSQL later)
ORM SQLAlchemy 2.0

Project Structure

exact1/
├── backend/
│   ├── app/
│   │   ├── main.py           # FastAPI app, startup, CORS, routers
│   │   ├── database.py       # SQLAlchemy engine + session
│   │   ├── models.py         # Database table definitions
│   │   ├── schemas.py        # Pydantic request/response schemas
│   │   ├── seed.py           # Seed data (suppliers, dropdowns, etc.)
│   │   └── routers/
│   │       ├── dashboard.py          # GET /api/dashboard/stats
│   │       ├── suppliers.py          # GET/POST /api/suppliers
│   │       ├── reference_data.py     # All dropdown endpoints
│   │       └── purchase_orders.py    # GET/POST /api/purchase-orders
│   └── requirements.txt
│
├── frontend/
│   ├── src/
│   │   ├── app/
│   │   │   ├── layout.tsx            # Root layout with sidebar
│   │   │   ├── page.tsx              # Dashboard
│   │   │   ├── purchase-orders/
│   │   │   │   ├── page.tsx          # PO list
│   │   │   │   ├── new/page.tsx      # New PO form
│   │   │   │   └── [id]/page.tsx     # PO detail view
│   │   │   ├── stocklist/page.tsx    # Stock (placeholder)
│   │   │   └── sales-orders/page.tsx # Sales (placeholder)
│   │   ├── components/
│   │   │   ├── layout/Sidebar.tsx    # Left navigation
│   │   │   └── ui/
│   │   │       ├── StatCard.tsx      # Dashboard stat card
│   │   │       └── PageHeader.tsx    # Page title bar
│   │   └── lib/
│   │       ├── api.ts                # All API calls
│   │       └── types.ts              # TypeScript type definitions
│   ├── next.config.js                # Proxies /api to FastAPI backend
│   ├── tailwind.config.ts
│   └── package.json
│
└── README.md

How to Run Locally

Prerequisites

  • Python 3.10 or higher
  • Node.js 18 or higher
  • npm

1. Start the Backend

cd backend

# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate        # Mac/Linux
# or: venv\Scripts\activate     # Windows

# Install dependencies
pip install -r requirements.txt

# Start the server (auto-creates the database + seeds data)
uvicorn app.main:app --reload --port 8000

The API is now running at: http://localhost:8000 API documentation (Swagger UI): http://localhost:8000/docs


2. Start the Frontend

Open a second terminal:

cd frontend

# Install dependencies
npm install

# Start the development server
npm run dev

The app is now running at: http://localhost:3000


What's Built (MVP v1.0)

Dashboard

  • Overview cards: Purchase Orders, Sales Orders, Stock Items, Suppliers
  • Recent Purchase Orders table

Purchase Orders

  • List page: all POs in a sortable table
  • New PO form with:
    • Supplier selection (auto-fills: name, address, telephone, VAT)
    • Order date, payment terms, pickup conditions
    • Our company VAT number (multi-entity support)
    • Salesperson selection
    • Pickup month dropdown
    • Dynamic material lines (material group, quantity kg, price/kg, packing type)
    • Dynamic lot numbers (lot number + 3 specification fields)
    • Pickup address + delivery conditions
    • Live calculation table (material cost, transport, handling, other, total, cost/kg)
  • Detail view: full read-only view of a saved PO

Stocklist

  • Placeholder page with table structure ready for future data

Sales Orders

  • Placeholder page with table structure ready for future data

Database Tables

Table Purpose
suppliers Supplier master data
payment_terms Payment terms reference list
pickup_conditions Incoterms for pickup
delivery_conditions Incoterms for delivery
company_vat_numbers Our own company VAT numbers (multi-entity)
salespersons Internal salesperson list
packing_types Packing type reference list
material_groups Plastic / raw material types
purchase_orders Purchase order headers
purchase_order_items Material lines per PO
purchase_order_lots Lot numbers per PO

Next Steps (future versions)

  • Stock module: receive PO into stock, track inventory
  • Sales orders: create SO linked to customers and stock
  • Customers master data
  • PDF generation for PO documents
  • User authentication
  • PostgreSQL migration for production

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors