A first MVP of an ERP system for a trading company dealing in plastics / raw materials.
| 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 |
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
- Python 3.10 or higher
- Node.js 18 or higher
- npm
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 8000The API is now running at: http://localhost:8000 API documentation (Swagger UI): http://localhost:8000/docs
Open a second terminal:
cd frontend
# Install dependencies
npm install
# Start the development server
npm run devThe app is now running at: http://localhost:3000
- Overview cards: Purchase Orders, Sales Orders, Stock Items, Suppliers
- Recent Purchase Orders table
- 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
- Placeholder page with table structure ready for future data
- Placeholder page with table structure ready for future data
| 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 |
- 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