How zamelane/wepics-laravel works
Purpose and entry points
Wepics is a Laravel backend/API for the separate Wepics Vue WebUI. It serves photo/video albums from local storage, manages users and access, and exposes Swagger-documented APIs. HTTP enters through public/index.php, boots via bootstrap/app.php, and is routed by routes/api.php and routes/web.php. The packaged frontend assets and Blade shell are under public/assets/ and resources/views/index.blade.php.
HTTP API boundary
Controllers implement the externally visible domain API: albums, images, tags, reactions, access rights, invitations, settings, and users. Requests are validated by dedicated Form Requests, and responses are shaped through API Resources.
Paths: app/Http/Controllers/AlbumController.php, app/Http/Controllers/ImageController.php, app/Http/Requests/UploadRequest.php.
Authentication and authorization
Laravel HTTP middleware establishes request handling, with custom token authentication and standard authenticated/guest transitions. Domain authorization is represented by access-right records, tokens, invitations, user ownership/quota migrations, and an access-level enum.
Paths: app/Http/Middleware/TokenAuth.php, app/Models/AccessRight.php, app/Models/Token.php.
Media and album domain
The persistent model centers on nested albums and their aliases, images, tags, reactions, duplicate records, age ratings, and image-to-reaction/tag associations. Relational storage is established through Laravel migrations; images correspond to media available from local application storage.
Paths: app/Models/Album.php, app/Models/Image.php, database/migrations/2025_03_14_100100_add_nestedset_albums_table.php.
Media ingestion and transformation
Image uploads and local-folder indexing feed the catalog. Helpers encapsulate streaming, thumbnail behavior, and NVENC-related formatting. Video preview creation is asynchronous through Laravel’s queue/job mechanism and FFmpeg integration.
Paths: app/Console/Commands/StoreIndex.php, app/Jobs/GeneratePreviewVideo.php, config/laravel-ffmpeg.php.
Storage, indexing, and operational controls
Local filesystem storage is a material boundary: the README directs source media to storage/app/images/ (including directory symlinks), while Laravel filesystem configuration controls disks. Disk usage checks and cached space information support quota/capacity behavior; the application also has a database-backed queue migration.
Paths: config/filesystems.php, app/Console/Commands/CheckDiskUsage.php, app/Cacheables/SpaceInfo.php.
Runtime and infrastructure
The service is PHP/Laravel, typically run behind Apache/XAMPP, with MySQL as the documented database. It uses Composer dependencies, Laravel cache/queue/database abstractions, Sanctum configuration, mail/service configuration, and Swagger static UI/API documentation.
Paths: composer.json, config/database.php, config/queue.php.
Components 20
HTTP API
- Vue WebUI and Blade shell · Separate Vue client is served with packaged assets and a Blade shell.
resources/views/index.blade.php - HTTP entry point
public/index.php - API and web routes
routes/api.php - Domain controllers · Exposes album, image, tag, reaction, access, invitation, settings, and user APIs.
app/Http/Controllers/AlbumController.php - Form requests
app/Http/Requests/UploadRequest.php - Token authentication
app/Http/Middleware/TokenAuth.php
Domain
- Access rights and tokens · Records govern authenticated access, invitations, and ownership.
app/Models/AccessRight.php - Albums and media catalog · Nested albums organize images, tags, reactions, aliases, and duplicate records.
app/Models/Album.php - Image model
app/Models/Image.php - Relational schema · Defines nested albums and related persistent domain data.
database/migrations/2025_03_14_100100_add_nestedset_albums_table.php
Media pipeline
- Local media storage · Source media resides under storage/app/images/.
config/filesystems.php - Local-folder indexer · Indexes local source media into the catalog.
app/Console/Commands/StoreIndex.php - Video preview job · Asynchronously creates video previews.
app/Jobs/GeneratePreviewVideo.php - FFmpeg integration
config/laravel-ffmpeg.php - Capacity and quota checks · Checks disk usage and supports cached space information.
app/Console/Commands/CheckDiskUsage.php
Laravel platform
- Laravel application
bootstrap/app.php - MySQL database
config/database.php - Database queue
config/queue.php - Space information cache
app/Cacheables/SpaceInfo.php - PHP/Laravel dependencies · Composer-defined Laravel runtime and integrations.
composer.json
Connections 23
- Vue WebUI and Blade shell → HTTP entry point: HTTP requests
- HTTP entry point → Laravel application: boots
- Laravel application → API and web routes: loads routes
- API and web routes → Token authentication: applies middleware
- Token authentication → Domain controllers: authorizes requests
- API and web routes → Domain controllers: dispatches
- Domain controllers → Form requests: validates input
- Domain controllers → Access rights and tokens: checks access
- Domain controllers → Albums and media catalog: manages
- Albums and media catalog → Image model: contains
- Access rights and tokens → MySQL database: persists
- Albums and media catalog → MySQL database: persists
- Relational schema → MySQL database: defines
- Local-folder indexer → Local media storage: scans
- Local-folder indexer → Albums and media catalog: indexes into catalog
- Domain controllers → Local media storage: reads and uploads media
- Domain controllers → Video preview job: queues preview generation
- Video preview job → Database queue: runs through
- Video preview job → FFmpeg integration: generates previews
- FFmpeg integration → Local media storage: writes previews
- Capacity and quota checks → Local media storage: measures
- Capacity and quota checks → Space information cache: updates
- PHP/Laravel dependencies → Laravel application: provides framework