mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
- update the structure to have monolithic setup - updated deployments - added live-reloading for devops
3.4 KiB
3.4 KiB
Repository Restructure Plan
Current Structure
posterg-website/
├── apps/
│ ├── public/ # Public website
│ └── admin/ # Admin panel
├── shared/ # Shared PHP libraries
├── database/ # Database files
├── nginx/ # Server config
└── docs/ # Documentation
Proposed Structure (Idiomatic PHP)
posterg-website/
├── index.php # Public website root
├── memoire.php
├── search.php
├── apropos.php
├── contact.php
├── licences.php
├── assets/ # Static files (CSS, JS, images)
│ ├── posterg.css
│ ├── normalize.css
│ └── fonts/
├── inc/ # Page templates/partials
│ ├── header.php
│ └── footer.php
├── lib/ # Shared libraries (renamed from shared/)
│ ├── Database.php
│ ├── RateLimit.php
│ ├── config.php
│ └── cache/
├── admin/ # Admin panel (from apps/admin/)
│ ├── index.php
│ ├── list.php
│ ├── edit.php
│ └── ...
├── database/ # Database files & schema
│ ├── schema.sql
│ ├── test.db
│ └── ...
├── vendor/ # Third-party dependencies (gitignored)
│ └── php-live-reload/ # Local dev only
├── nginx/ # Server configuration
├── docs/ # Documentation
├── tests/ # Tests (future)
└── .gitignore # Updated
Benefits
✅ Standard PHP structure - Follows common conventions
✅ Flatter hierarchy - Easier to navigate
✅ Clear separation - lib/ for code, inc/ for templates, assets/ for static files
✅ Simpler paths - Less ../../ in require statements
✅ Vendor folder - Standard for third-party code
Migration Steps
1. Move public to root
mv apps/public/* .
2. Move admin
mv apps/admin admin/
rm -rf apps/
3. Rename shared to lib
mv shared lib/
4. Update all require paths
require_once __DIR__ . '/shared/Database.php'→require_once __DIR__ . '/lib/Database.php'require_once __DIR__ . '/../shared/Database.php'→require_once __DIR__ . '/../lib/Database.php'
5. Setup vendor for local dev
mkdir -p vendor/
echo "vendor/" >> .gitignore
Path Changes Summary
| Old Path | New Path |
|---|---|
apps/public/index.php |
index.php |
apps/public/inc/header.php |
inc/header.php |
apps/public/assets/posterg.css |
assets/posterg.css |
apps/admin/index.php |
admin/index.php |
shared/Database.php |
lib/Database.php |
shared/config.php |
lib/config.php |
shared/cache/ |
lib/cache/ |
Deployment Changes
Before
rsync apps/public/ posterg:/var/www/html/
rsync apps/admin/ posterg:/var/www/html/formulaire/
rsync shared/ posterg:/var/www/html/shared/
After
rsync --exclude 'vendor' --exclude 'tests' . posterg:/var/www/html/
Much simpler!
PHP Live Reload Setup
For Local Development Only
- Clone to
vendor/php-live-reload/(gitignored) - Include in local dev server
- Auto-refresh browser on file changes
- Never deployed to production
Usage
# Setup (one time)
just setup-dev
# Start dev server with live reload
just serve-public # or serve-admin