Last Updated: 3/13/2026
Architecture Overview
LinkAce is a self-hosted bookmark manager built with Laravel 11, designed to run in Docker containers or as a traditional PHP application.
Technology Stack
Backend
- Framework: Laravel 11.48
- Language: PHP 8.2+
- Database: MySQL, PostgreSQL, SQLite, or SQL Server
- Cache/Queue: Redis (optional)
- Search: Database-based full-text search
Frontend
- Build Tool: Laravel Mix (webpack)
- CSS Framework: Bootstrap (implied by UI components)
- JavaScript: Vanilla JS with web components (e.g.,
<time-ago>) - Icons: Custom icon components
Infrastructure
- Containerization: Docker + Docker Compose
- Web Server: nginx (in Docker) or Apache/nginx (traditional)
- Process Manager: Supervisor (for queue workers)
Application Architecture
LinkAce follows Laravel’s MVC architecture with additional layers:
┌─────────────────────────────────────────────────┐
│ HTTP Layer │
│ (Routes, Middleware, Controllers) │
└─────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────┐
│ Business Logic Layer │
│ (Actions, Repositories, Services) │
└─────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────┐
│ Data Layer │
│ (Models, Database, Eloquent ORM) │
└─────────────────────────────────────────────────┘Directory Structure
app/
├── Actions/ # Business logic actions
├── Audits/ # Audit trail modifiers
├── Console/ # Artisan commands
├── Enums/ # Enumerations and constants
├── Exceptions/ # Custom exception handlers
├── Helper/ # Helper functions
├── Http/
│ ├── Controllers/ # HTTP controllers
│ │ ├── API/ # API endpoints
│ │ ├── Admin/ # Admin panel
│ │ ├── App/ # Main application
│ │ └── Guest/ # Public/guest features
│ ├── Middleware/ # HTTP middleware
│ └── Requests/ # Form requests
├── Jobs/ # Queue jobs
├── Listeners/ # Event listeners
├── Mail/ # Email templates
├── Models/ # Eloquent models
├── Notifications/ # Notification classes
├── Policies/ # Authorization policies
├── Providers/ # Service providers
├── Repositories/ # Data repositories
├── Rules/ # Custom validation rules
├── Scopes/ # Query scopes
├── Settings/ # Application settings
└── View/ # View composers
config/ # Configuration files
database/
├── factories/ # Model factories
├── migrations/ # Database migrations
└── seeders/ # Database seeders
resources/
├── lang/ # Translations
└── views/ # Blade templates
routes/
├── api.php # API routes
├── channels.php # Broadcasting channels
└── web.php # Web routes
storage/ # File storage, logs, cache
tests/ # PHPUnit testsKey Components
1. Actions Pattern
LinkAce uses the Action pattern to encapsulate business logic:
Location: app/Actions/
Purpose: Single-responsibility classes that perform specific operations.
Example Actions:
- Link creation
- Bookmark import/export
- Link checking
- Backup operations
2. Repositories
Data access is abstracted through repository classes:
Location: app/Repositories/
Purpose: Centralize database queries and provide a clean API for data access.
3. Jobs & Queues
Asynchronous tasks are handled through Laravel’s queue system:
Location: app/Jobs/
Key Jobs:
SaveLinkToWaybackmachine- Archive links on Internet Archive- Link checking jobs
- Backup jobs
- Email sending
Queue Configuration:
- Driver: Redis (recommended) or database
- Workers managed by Supervisor
4. Events & Listeners
Event-driven architecture for decoupled components:
Location: app/Listeners/
Purpose: React to application events (link created, user registered, etc.)
5. Middleware
HTTP middleware for cross-cutting concerns:
Common Middleware:
- Authentication (
auth,auth:sanctum) - Rate limiting (
throttle) - CSRF protection
- Role/permission checks
6. Service Providers
Laravel service providers bootstrap application services:
Location: app/Providers/
Key Providers:
AppServiceProvider- Application-level servicesAuthServiceProvider- Authentication & authorizationEventServiceProvider- Event listenersRouteServiceProvider- Route configuration
Data Flow
Web Request Flow
1. HTTP Request
↓
2. Routing (routes/web.php)
↓
3. Middleware (auth, CSRF, etc.)
↓
4. Controller (app/Http/Controllers/)
↓
5. Action/Repository (app/Actions/, app/Repositories/)
↓
6. Model (app/Models/)
↓
7. Database
↓
8. View (resources/views/)
↓
9. HTTP ResponseAPI Request Flow
1. HTTP Request
↓
2. Routing (routes/api.php)
↓
3. Middleware (auth:sanctum, throttle)
↓
4. API Controller (app/Http/Controllers/API/)
↓
5. Action/Repository
↓
6. Model
↓
7. Database
↓
8. JSON ResponseDatabase Design
Core Tables
users- User accountslinks- Bookmarked URLslink_lists- Bookmark collectionstags- Tagging systemnotes- Link annotationslink_lists(pivot) - Link-to-list relationshipslink_tags(pivot) - Link-to-tag relationships
System Tables
personal_access_tokens- API tokenspassword_resets- Password reset tokensfailed_jobs- Failed queue jobsaudits- Audit trailactivity_log- Activity loggingsettings- Application settingsroles- User rolespermissions- User permissionsmodel_has_roles- User-role assignmentsmodel_has_permissions- User-permission assignmentsrole_has_permissions- Role-permission assignments
Soft Deletes
Most models use soft deletes (trash functionality):
- Links
- Lists
- Tags
- Notes
- Users
Soft-deleted records can be restored or permanently deleted.
External Integrations
1. Internet Archive (Wayback Machine)
LinkAce can automatically archive bookmarks to the Internet Archive.
Job: SaveLinkToWaybackmachine
Configuration:
archive_backups_enabled- Enable/disable archivingarchive_private_backups_enabled- Archive private links
2. Email Services
Supports multiple email providers via Laravel’s mail system:
Supported Drivers:
- SMTP
- Mailgun (via
symfony/mailgun-mailer) - SendGrid
- Amazon SES
- Postmark
Configuration: .env file and config/mail.php
3. Backup Services
Automatic backups via spatie/laravel-backup:
Supported Destinations:
- Local filesystem
- Amazon S3 (via
league/flysystem-aws-s3-v3) - FTP (via
league/flysystem-ftp) - SFTP (via
league/flysystem-sftp-v3)
4. OAuth/OIDC Providers
SSO integration via Laravel Socialite:
Package: laravel/socialite + provider packages
Providers:
- Auth0, Authentik, Azure, Cognito, FusionAuth, Google, GitHub, GitLab, Keycloak, OIDC, Okta, Zitadel
5. Monitoring & Error Tracking
Sentry Integration:
- Package:
sentry/sentry-laravel - Automatic error reporting and performance monitoring
Security Architecture
Authentication Layers
- Session-based (Web): Laravel Fortify + session guard
- Token-based (API): Laravel Sanctum
- SSO (OAuth/OIDC): Laravel Socialite
Authorization Layers
- Policies: Model-level authorization
- Roles & Permissions: Spatie Laravel Permission
- Visibility Scopes: Automatic query filtering
Data Protection
- Password Hashing: bcrypt
- CSRF Protection: Token-based
- SQL Injection Prevention: Eloquent ORM + prepared statements
- XSS Prevention: Blade template escaping
Performance Optimization
Caching Strategy
- Configuration Cache:
php artisan config:cache - Route Cache:
php artisan route:cache - View Cache: Compiled Blade templates
- Query Cache: Redis (optional)
Database Optimization
- Indexes: On foreign keys and frequently queried columns
- Eager Loading: Prevent N+1 queries
- Pagination: For large result sets
Asset Optimization
- Laravel Mix: Asset compilation and minification
- Versioning: Cache busting via Mix versioning
Deployment Architecture
Docker Deployment (Recommended)
┌─────────────────────────────────────────┐
│ Docker Compose │
├─────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌────────────────┐ │
│ │ nginx │ │ PHP-FPM │ │
│ │ (web server)│←→│ (LinkAce) │ │
│ └──────────────┘ └────────────────┘ │
│ ↑ ↓ │
│ │ ┌────────────────┐ │
│ │ │ Database │ │
│ │ │ (MySQL/Postgres)│ │
│ │ └────────────────┘ │
│ │ ↓ │
│ │ ┌────────────────┐ │
│ └──────────│ Redis │ │
│ │ (cache/queue) │ │
│ └────────────────┘ │
└─────────────────────────────────────────┘Docker Compose Files:
docker-compose.yml- Developmentdocker-compose.production.yml- Production
Traditional Deployment
┌─────────────────────────────────────────┐
│ Web Server (nginx/Apache) │
├─────────────────────────────────────────┤
│ │
│ ┌──────────────────────────────────┐ │
│ │ PHP-FPM / mod_php │ │
│ │ (LinkAce) │ │
│ └──────────────────────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────┐ │
│ │ Database Server │ │
│ │ (MySQL/Postgres/SQLite) │ │
│ └──────────────────────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────┐ │
│ │ Redis (optional) │ │
│ └──────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────┐ │
│ │ Supervisor (queue workers) │ │
│ └──────────────────────────────────┘ │
└─────────────────────────────────────────┘Configuration Management
Environment Variables
All configuration is driven by .env file:
Key Variables:
APP_*- Application settingsDB_*- Database configurationMAIL_*- Email settingsREDIS_*- Redis configurationSSO_*- SSO settingsBACKUP_*- Backup settings
Configuration Files
Located in config/:
app.php- Application settingsauth.php- Authenticationdatabase.php- Database connectionsmail.php- Email configurationqueue.php- Queue configurationservices.php- Third-party services
Testing
Test Structure
tests/
├── Feature/ # Feature tests (HTTP, integration)
└── Unit/ # Unit tests (isolated logic)Test Tools
- PHPUnit: Test framework
- Laravel Testing: HTTP testing, database factories
- Mockery: Mocking framework
Running Tests
./vendor/bin/phpunit
# or
php artisan testCLI Commands
Custom Artisan Commands
Located in app/Console/Commands/:
Key Commands:
- Link checking
- Backup operations
- User management
- Database maintenance
Running Commands
php artisan linkace:check-links
php artisan linkace:backupMonitoring & Logging
Logging
- Driver: Stack (multiple channels)
- Channels: Daily rotating files, Syslog, Slack, etc.
- Location:
storage/logs/
Log Viewer
Built-in log viewer via rap2hpoutre/laravel-log-viewer:
Access: Admin panel → Logs
Activity Logging
Automatic activity logging via spatie/laravel-activitylog:
- User actions
- Model changes
- System events
Audit Trail
Comprehensive audit trail via owen-it/laravel-auditing:
- Tracks all model changes
- Stores old and new values
- Records user, IP, and timestamp