Itemloop is a full-stack, multilingual web application for reuse and recycling centers to manage their inventory of second-hand items. It is optimized for collaborative, community-based use, supports desktop and mobile devices, and includes PWA features for offline access.
This project is open source and welcomes contributions under the AGPL v3 license.
| Layer | Technology |
|---|---|
| Frontend | Angular 20+ (standalone components, signals, Angular CDK) |
| Backend | PHP 8.2+ Β· Slim Framework 4 |
| Database | MySQL 5.7+ |
| Image processing | Intervention Image (GD driver) β WebP conversion + thumbnails |
| Hosting target | Shared PHP/MySQL hosting (e.g., OVH) β no SSH required after deploy |
The backend is built on Slim Framework 4 β fully assembled locally with no post-deploy server-side commands required.
- Product CRUD β title, description, category, condition, color, quantity, estimated value, barcode, dimensions (L/W/H cm, weight kg), destination, visibility
- Product list β search, multi-filter (category, condition, location), grid/list toggle, pagination, CSV export
- Product form β 3-column layout: product info / characteristics + location / photos + quick info; view mode (read-only) and edit mode
- Photo lightbox β click any photo to view full-size; β/β navigation and Esc to close; keyboard support
- Structured locations β Building β Zone β Shelf with auto-generated, editable codes
- Image management β multiple images per product, WebP conversion, thumbnail generation, drag-to-reorder, cover image (first image by sort order)
- Cart β add-to-cart with quantity picker (max = available stock) on product view page; cart page with item list, price/line-total columns, grand total, clear and place-order actions; persisted in
localStorage - Dashboard β KPI cards (total products, total quantity, estimated value) + category donut chart
- Role-based access β Customer (browse + cart), Editor (full product/location CRUD), Admin (everything + user management)
- Public / private visibility β guests see only public products; editors/admins see all
- Authentication β register, login, logout (PHP session-based)
- User management (admin only)
- Multilingual UI β French + English, auto-detected from browser, manually switchable
- Comboboxes with inline create β colors and categories created on the fly
- Angular CDK drag-and-drop for image ordering
- Centralized currency config β
app-settings.tssets the currency code (default:EUR) used everywhere
itemloop/
βββ src/
β βββ backend/ # Slim Framework 4 API
β β βββ public/ # Web root (index.php entry point, storage/)
β β β βββ storage/products/ # Uploaded images (WebP)
β β βββ src/
β β βββ Controllers/ # ProductController, LocationController, etc.
β β βββ Middleware/ # Auth, Editor, Admin, OptionalAuth, CSRF
β βββ frontend/ # Angular 20 app
β βββ src/
β βββ app/ # Features: products, locations, users, auth, cart
β βββ assets/i18n/ # en.json, fr.json
βββ deploy.sh # Local build script β generates deploy_package/ (no SSH needed)
βββ REQUIREMENTS.md # User stories and roadmap
- PHP 8.2+ with the GD extension enabled
- Composer
- Node.js 20.19+ (or 22.12+) and npm β required by Angular 20
- MySQL 5.7+
git clone https://github.com/Emprint/itemloop.git
cd itemloopcd src/backend
composer install
cp .env.example .env
# Edit .env β set DB_HOST, DB_NAME, DB_USER, DB_PASSTip: The DevDB VS Code extension lets you browse and query the MySQL database directly from the editor.
Import the database schema (first time only):
mysql -u youruser -p yourdb < src/backend/sql/schema.sqlExisting installs: when a new version adds or changes database columns, apply only the relevant file from
src/backend/sql/migrations/β do not re-import the fullschema.sql. Seesql/migrations/README.md.
Start the backend dev server:
php -d upload_max_filesize=20M -d post_max_size=25M -S localhost:8000 -t publicThe
-dflags matter: PHP's built-in server defaults toupload_max_filesize=2M, which silently rejects most phone photos. They mirror the production limits shipped indeploy/frontend-api.user.ini.
cd src/frontend
npm install
npm start # runs ng serve β http://localhost:4200The dev server proxies /api and /storage to http://localhost:8000 via proxy.conf.json.
If you change proxy.conf.json, restart ng serve to pick up the new proxy rules.
Before committing, format and lint:
npx prettier --write src
ng lintAll routes are prefixed with /api.
Write requests (POST, PUT, PATCH, DELETE) must carry the X-XSRF-TOKEN header β call GET /csrf-cookie first to obtain it.
| Method | Path | Auth required | Description |
|---|---|---|---|
| GET | /csrf-cookie |
β | Sets the XSRF-TOKEN cookie β call before any write request |
| POST | /auth/register |
β | Register a new account |
| POST | /auth/login |
β | Login |
| POST | /auth/logout |
β | Logout |
| POST | /auth/forgot-password |
β | Send a password reset email |
| POST | /auth/reset-password |
β | Reset the password from a token |
| GET | /me |
β | Returns current user info |
| Method | Path | Auth required | Description |
|---|---|---|---|
| GET | /me/profile |
β | Get own profile |
| PATCH | /me/profile |
β | Update own profile |
| POST | /me/change-password |
β | Change own password |
| Method | Path | Auth required | Description |
|---|---|---|---|
| GET | /products |
optional | List products β all for editors/admins, public-only for guests |
| GET | /products/{id} |
optional | Get a single product |
| POST | /products |
Editor+ | Create product |
| PUT | /products/{id} |
Editor+ | Update product |
| DELETE | /products/{id} |
Editor+ | Delete product |
| GET | /products/{id}/history |
Editor+ | Stock movement / change ledger for a product |
| POST | /products/{id}/stock-movement |
Editor+ | Record a stock movement |
| Method | Path | Auth required | Description |
|---|---|---|---|
| POST | /products/{id}/images |
Editor+ | Upload images (multipart/form-data, field: images[]) |
| PATCH | /products/{id}/images/reorder |
Editor+ | Reorder images β body: {"ids":[3,1,2]} |
| DELETE | /products/{id}/images/{image_id} |
Editor+ | Delete image |
| Method | Path | Auth required | Description |
|---|---|---|---|
| GET | /buildings |
β | List buildings |
| POST | /buildings |
Editor+ | Create building |
| PUT | /buildings/{id} |
Editor+ | Update building |
| DELETE | /buildings/{id} |
Editor+ | Delete building |
| GET | /zones |
β | List zones |
| POST | /zones |
Editor+ | Create zone |
| PUT | /zones/{id} |
Editor+ | Update zone |
| DELETE | /zones/{id} |
Editor+ | Delete zone |
| GET | /locations |
β | List locations (shelf level) |
| POST | /locations |
Editor+ | Create location |
| PUT | /locations/{id} |
Editor+ | Update location |
| DELETE | /locations/{id} |
Editor+ | Delete location |
| Method | Path | Auth required | Description |
|---|---|---|---|
| POST | /orders |
β | Place an order (reserves stock) |
| GET | /orders/mine |
β | List own orders |
| GET | /orders |
Editor+ | List all orders |
| PATCH | /orders/{id}/status |
Editor+ | Update an order's status |
| Method | Path | Auth required | Description |
|---|---|---|---|
| GET | /users |
Admin | List all users |
| POST | /users/save |
Admin | Create or update a user |
| POST | /users/delete |
Admin | Delete a user |
| GET | /users/pending |
Admin | List users awaiting validation |
| GET | /users/pending/count |
Admin | Count of users awaiting validation |
| PATCH | /users/{id}/validate |
Admin | Activate a pending user |
| PATCH | /users/{id}/deactivate |
Admin | Deactivate a user |
| Method | Path | Auth required | Description |
|---|---|---|---|
| GET | /product-categories |
β | List categories |
| POST | /product-categories |
Editor+ | Create category |
| PUT | /product-categories/{id} |
Editor+ | Update category |
| DELETE | /product-categories/{id} |
Editor+ | Delete category |
| GET | /product-conditions |
β | List conditions |
| POST | /product-conditions |
Editor+ | Create condition |
| PUT | /product-conditions/{id} |
Editor+ | Update condition |
| DELETE | /product-conditions/{id} |
Editor+ | Delete condition |
| GET | /product-colors |
β | List colors |
| POST | /product-colors |
Editor+ | Create color |
| PUT | /product-colors/{id} |
Editor+ | Update color |
| DELETE | /product-colors/{id} |
Editor+ | Delete color |
| GET | /dashboard |
optional | Dashboard statistics (total products, qty, estimated value, category breakdown) |
| Method | Path | Auth required | Description |
|---|---|---|---|
| GET | /settings |
β | Read application settings (app_name, currency, public_mode, shop_mode, β¦) |
| PUT | /settings |
Admin | Update application settings |
| GET | /admin/email-logs |
Admin | List sent emails |
| GET | /export/products.pdf |
Editor+ | Export the product list as PDF |
| GET | /export/orders.pdf |
Editor+ | Export the order list as PDF |
Cart: The cart is entirely client-side (
localStorage) β no backend endpoints. Checkout posts the cart toPOST /orders. Excel export is generated client-side (xlsx) β there is no server-side endpoint for it.
| Property | Value |
|---|---|
| Accepted formats | JPEG, PNG, WebP, GIF |
| Max upload size | 4 MB per image |
| Full image | Resized to max 1920Γ1920 px, WebP quality 90 |
| Thumbnail | Resized to max 400Γ400 px, WebP quality 80 |
| Storage | src/backend/public/storage/products/ |
| URL | /storage/products/{name}.webp / {name}_thumb.webp |
| Cover image | First image by sort_order β drag to reorder in the form |
| Delete | Removes both full-size and thumbnail files from disk |
deploy.sh builds the Angular frontend + installs Composer dependencies locally, then pushes both to your server using rsync over SSH.
-
sshpassβ feeds the SSH password non-interactively to rsync:brew install hudochenkov/sshpass/sshpass # macOS sudo apt install sshpass # Linux/Debian
Recommended alternative: set up SSH key authentication on your server and remove the
sshpass -p "$SSH_PASS"wrapper fromdeploy.sh. SSH keys are more secure and don't requiresshpassat all. -
rsyncβ usually pre-installed on macOS and Linux. -
composerβ must be available in yourPATH. The Angular CLI is run throughnpx, so the project-local one innode_modulesis used; no global install needed.
On Windows:
deploy.shis a POSIX shell script and needsrsync+sshpass, neither of which Git Bash ships with (and there is no reliablesshpassbuild for Windows). Run the whole toolchain from WSL instead β installphp-cli php-gd php-mysql php-mbstring php-curl php-zip php-xml composer nodejs npm rsync sshpassthere, and installnode_modulesfrom WSL too (the nativeesbuildbinary is platform-specific, so anode_modulesinstalled from Windows will not work under WSL and vice versa).
These steps configure the server directory layout and only need to be done once:
-
Create the API entry point at
~/frontend/api/index.php:<?php require __DIR__ . '/../../backend/public/index.php';
-
~/frontend/api/β created and managed automatically bydeploy.sh(no manual step needed). -
Create
~/frontend/.htaccessβ usedeploy/frontend.htaccessas the content. After this first-time setup,deploy.shwill keep it up to date automatically. -
Create
~/backend/.envfromsrc/backend/.env.examplewith your production DB credentials andAPP_URL. -
Create the image storage directory at
~/frontend/storage/products/and setSTORAGE_PATHin~/backend/.env:STORAGE_PATH=/absolute/real/path/to/frontend/storage/productsOVH note: PHP-FPM's
open_basediruses the real filesystem path, not the/home/usernamealias. Runecho $HOMEvia SSH to get the real path (e.g./homez.NNN/account/sitename). -
PHP upload limits β nothing to do by hand:
deploy.shshipsdeploy/frontend.user.inianddeploy/frontend-api.user.inito~/frontend/.user.iniand~/frontend/api/.user.ini:upload_max_filesize = 20M post_max_size = 25M
PHP reads
.user.inifrom the running script's directory up to the docroot. The entry point is~/frontend/api/index.php, so~/backend/public/.user.inihas no effect β~/frontend/api/.user.iniis the file that matters. The default 2 MB limit silently truncates phone photos.Changes take up to
user_ini.cache_ttl(5 min on OVH) to apply. -
Import the database schema once via phpMyAdmin (or
mysqlCLI):mysql -u youruser -p yourdb < src/backend/sql/schema.sql
Copy deploy.env.example to deploy.env (gitignored β never commit it) and fill in your values:
cp deploy.env.example deploy.envSSH_USER=your_ssh_username
SSH_HOST=your_ssh_host
SSH_PORT=22
SITE_URL=https://yourdomain.comSSH_PASS=yourpassword ./deploy.shThe script will:
- Build the Angular app to
deploy_package/frontend/ - Run
composer install --no-devinsrc/backend/ - rsync
deploy_package/frontend/β~/frontend/on the server (--delete, but keepsstorage/) - rsync
src/backend/β~/backend/on the server (skips.envandpublic/) - copy
src/backend/public/index.phpseparately β it is the only file frompublic/the API needs
OVH cache note:
.htaccesschanges may take 35β60 seconds to take effect due to PHP-FPM opcode caching.
- Roles: Customer (browse public items, cart), Editor (full product/location CRUD), Admin (everything + user management)
- Password policy: min 8 characters, at least 1 letter, 1 digit, 1 special character
- Passwords: hashed with PHP
password_hash()(bcrypt /PASSWORD_DEFAULT) - Sessions: PHP native session handling (no JWT, no Sanctum)
- CSRF: token-based protection on mutating API routes
- Currency: configured in
src/frontend/src/app/app-settings.tsβ changecurrency: 'EUR'to any ISO 4217 code
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
- Any modifications must be published under the same license.
- If you run the app as a network service, the source code must be made available to users.
- Commercial use is permitted for your own operations; reselling under a proprietary license is not.
See LICENSE for full terms.
Itemloop is developed as a community-driven project. Pull requests, feedback, and translations are welcome.
This app is developed with the help of GitHub Copilot.
Before contributing, please read the LICENSE (AGPL-3.0) and respect the spirit of fair and open collaboration.