- Project Overview
- Architecture Overview
- Database Schema Design
- User Roles & Permissions
- Core Modules Documentation
- Development Guidelines
- Deployment & DevOps
Aegis is a comprehensive expense management system designed to streamline the process of submitting, approving, and reimbursing business expenses. It provides a centralized platform for organizations to manage their expense workflows efficiently while maintaining compliance with company policies and financial regulations.
- Multi-tenancy: Isolated environments for different companies
- Role-based access control: Different permissions for admins, managers, and employees
- Expense reporting: Digital submission and tracking of expenses
- Approval workflows: Configurable multi-level approval processes
- Reimbursement processing: Automated payment tracking and reconciliation
- Analytics dashboards: Expense trends, budget tracking, and financial insights
- Integrations: Connections with accounting software, payment processors, and HR systems
- Companies: Organizations of all sizes looking to digitize and streamline expense management
- Finance Teams: CFOs, controllers, and accountants who need to monitor and control company spending
- Managers: Department heads who need to approve team expenses
- Employees: Staff members who need to submit expense reports
- Reduce the time spent on expense management by 70%
- Decrease expense processing costs by 50%
- Improve policy compliance and reduce fraudulent expense submissions
- Provide actionable insights into spending patterns to optimize budgets
- Enable seamless integration with existing financial systems
┌─────────────────────────────────────────────────────────────────┐
│ Client Layer │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │
│ │ Admin Panel │ │ Company Panel │ │ Employee Panel│ │
│ └───────────────┘ └───────────────┘ └───────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Application Layer │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │
│ │ Laravel │ │ FilamentPHP │ │ Livewire │ │
│ │ Framework │ │ Admin Panels │ │ Components │ │
│ └───────────────┘ └───────────────┘ └───────────────┘ │
│ │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │
│ │ Models │ │ Controllers │ │ Services │ │
│ └───────────────┘ └───────────────┘ └───────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Data Layer │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │
│ │ PostgreSQL │ │ Redis │ │ File Storage │ │
│ │ Database │ │ Cache │ │ (S3/Local) │ │
│ └───────────────┘ └───────────────┘ └───────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Integration Layer │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │
│ │ Accounting │ │ Payment │ │ API │ │
│ │ Software │ │ Processors │ │ Gateway │ │
│ └───────────────┘ └───────────────┘ └───────────────┘ │
└─────────────────────────────────────────────────────────────────┘
- Laravel 12: PHP framework for the application core
- FilamentPHP 4: Admin panel framework
- PostgreSQL: Primary database
- Redis: Caching and queue management
- TailwindCSS: Utility-first CSS framework
- Livewire: Server-driven frontend components
- Alpine.js: Lightweight JavaScript framework for interactivity
- Docker: Containerization
- GitHub Actions: CI/CD pipeline
- AWS/Digital Ocean: Cloud hosting
- Purpose: System-wide administration and configuration
- Users: Platform administrators
- Features:
- Company management
- System configuration
- Global reporting
- User management across all companies
- Purpose: Company-specific administration
- Users: Company administrators and managers
- Features:
- Company settings management
- Department configuration
- Approval workflow setup
- Company-wide reporting
- User management within the company
- Purpose: Day-to-day expense management
- Users: Regular employees
- Features:
- Expense submission
- Report creation
- Reimbursement tracking
- Personal dashboard
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ Companies │ │ Users │ │ Departments │
├────────────────┤ ├────────────────┤ ├────────────────┤
│ id │ │ id │ │ id │
│ name │◄──────┤ company_id │ │ company_id │
│ subdomain │ │ department_id │◄──────┤ name │
│ settings │ │ name │ │ manager_id │
│ created_at │ │ email │ │ budget │
│ updated_at │ │ password │ │ created_at │
└────────────────┘ │ role │ │ updated_at │
│ created_at │ └────────────────┘
│ updated_at │
└────────────────┘
▲
│
│
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ Expenses │ │ Reports │ │ Categories │
├────────────────┤ ├────────────────┤ ├────────────────┤
│ id │ │ id │ │ id │
│ company_id │ │ company_id │ │ company_id │
│ user_id │ │ user_id │◄──────┤ name │
│ report_id │◄──────┤ title │ │ description │
│ category_id │ │ description │ │ created_at │
│ amount │ │ status │ │ updated_at │
│ date │ │ submitted_at │ └────────────────┘
│ description │ │ created_at │
│ receipt_path │ │ updated_at │
│ status │ └────────────────┘
│ created_at │ ▲
│ updated_at │ │
└────────────────┘ │
│
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ Approvals │ │ Reimbursements │ │ Notifications │
├────────────────┤ ├────────────────┤ ├────────────────┤
│ id │ │ id │ │ id │
│ company_id │ │ company_id │ │ company_id │
│ report_id │◄──────┤ report_id │◄──────┤ user_id │
│ approver_id │ │ amount │ │ type │
│ level │ │ status │ │ title │
│ status │ │ payment_method │ │ content │
│ comments │ │ payment_date │ │ read_at │
│ approved_at │ │ reference │ │ created_at │
│ created_at │ │ created_at │ │ updated_at │
│ updated_at │ │ updated_at │ └────────────────┘
└────────────────┘ └────────────────┘
- Stores organization information
- Contains company-specific settings and configuration
- Primary tenant identifier for multi-tenancy
- All system users with role designation
- Linked to specific company (tenant)
- May belong to a department
- Organizational units within companies
- Has budget allocation and manager assignment
- Used for expense categorization and approval routing
- Expense categories (e.g., Travel, Meals, Office Supplies)
- Can be system-defined or company-specific
- Used for expense classification and reporting
- Individual expense entries
- Contains amount, date, description, and receipt information
- Linked to a report, user, company, and category
- Collection of expenses submitted together
- Has workflow status (Draft, Submitted, In Review, Approved, Rejected)
- Linked to approvals and reimbursements
- Tracks approval workflow for expense reports
- Contains approval level, status, and comments
- Multiple approvals may exist for a single report (multi-level workflow)
- Tracks payment status for approved reports
- Contains payment method, date, and reference information
- Final step in the expense lifecycle
- System messages for users
- Triggered by workflow events (submission, approval, rejection, etc.)
- Supports multiple notification channels
- Company ID Scoping: All database tables include a
company_idcolumn - Global Scope: Laravel global scopes automatically filter queries by the current company
- Domain/Subdomain Strategy: Each company accesses the system via a unique subdomain (company.aegis.com)
- Middleware:
CompanyTenantMiddlewareidentifies the current company from the subdomain - Service Container: Current company is bound to the service container for global access
- Query Scoping: Automatic filtering of all queries to ensure data isolation
- Shared Resources: System-level data (like system categories) accessible across tenants
- Description: System-wide administrator with full access to all features and companies
- Responsibilities:
- Platform configuration
- Company account management
- System monitoring and maintenance
- Global reporting and analytics
- Description: Administrator for a specific company
- Responsibilities:
- Company settings management
- User management within the company
- Approval workflow configuration
- Company-wide reporting
- Description: Department head or team leader
- Responsibilities:
- Expense approval
- Department budget management
- Team expense monitoring
- Department reporting
- Description: Regular staff member
- Responsibilities:
- Expense submission
- Report creation
- Personal expense tracking
| Resource/Action | Super Admin | Company Admin | Manager | Employee |
|---|---|---|---|---|
| Admin Panel | ||||
| System Configuration | ✓ | ✗ | ✗ | ✗ |
| Company Management | ✓ | ✗ | ✗ | ✗ |
| Global Reporting | ✓ | ✗ | ✗ | ✗ |
| Company Panel | ||||
| Company Settings | ✓ | ✓ | ✗ | ✗ |
| User Management | ✓ | ✓ | ✗ | ✗ |
| Department Management | ✓ | ✓ | ✗ | ✗ |
| Category Management | ✓ | ✓ | ✗ | ✗ |
| Approval Workflow Config | ✓ | ✓ | ✗ | ✗ |
| Company Reporting | ✓ | ✓ | ✓ | ✗ |
| Department Management | ||||
| Department Settings | ✓ | ✓ | ✓* | ✗ |
| Department Budget | ✓ | ✓ | ✓* | ✗ |
| Department Reporting | ✓ | ✓ | ✓* | ✗ |
| Expense Management | ||||
| Create Expenses | ✓ | ✓ | ✓ | ✓ |
| Edit Own Expenses | ✓ | ✓ | ✓ | ✓ |
| Edit Any Expense | ✓ | ✓ | ✗ | ✗ |
| Delete Own Expenses | ✓ | ✓ | ✓ | ✓ |
| Delete Any Expense | ✓ | ✓ | ✗ | ✗ |
| Report Management | ||||
| Create Reports | ✓ | ✓ | ✓ | ✓ |
| Submit Reports | ✓ | ✓ | ✓ | ✓ |
| View Own Reports | ✓ | ✓ | ✓ | ✓ |
| View Department Reports | ✓ | ✓ | ✓ | ✗ |
| View All Company Reports | ✓ | ✓ | ✗ | ✗ |
| Approval Workflow | ||||
| Approve/Reject Reports | ✓ | ✓ | ✓* | ✗ |
| Override Approvals | ✓ | ✓ | ✗ | ✗ |
| Reimbursement | ||||
| Process Reimbursements | ✓ | ✓ | ✗ | ✗ |
| View Own Reimbursements | ✓ | ✓ | ✓ | ✓ |
| View All Reimbursements | ✓ | ✓ | ✗ | ✗ |
| Analytics & Reporting | ||||
| Personal Dashboard | ✓ | ✓ | ✓ | ✓ |
| Department Dashboard | ✓ | ✓ | ✓ | ✗ |
| Company Dashboard | ✓ | ✓ | ✗ | ✗ |
| System Dashboard | ✓ | ✗ | ✗ | ✗ |
| Export Reports | ✓ | ✓ | ✓ | ✓* |
✓ = Access granted
✗ = Access denied
✓* = Limited access (own department only or with restrictions)
- Spatie Permission Package: Utilizing Laravel's Spatie Permission package for role and permission management
- Policy-Based Authorization: Laravel policies for fine-grained access control
- Filament Shield: Integration with Filament for admin panel access control
- Middleware: Role-based middleware for route protection
- UI Adaptation: Dynamic UI elements based on user permissions
The expense reporting module allows users to create, submit, and track expense reports through a defined workflow.
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Create │ │ Submit │ │ Review │ │ Approval │
│ Expense │────►│ Report │────►│ Process │────►│ Decision │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
│
▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Reimbursed │◄────│ Payment │◄────│ Accounting │◄────│ Approved │
│ Complete │ │ Process │ │ Integration │ │ │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
-
Expense Creation
- Digital receipt capture (upload, email, or mobile scan)
- OCR for automatic data extraction
- Category and project assignment
- Tax and currency handling
-
Report Submission
- Grouping expenses into reports
- Policy compliance checking
- Submission to appropriate approval chain
-
Status Tracking
- Real-time status updates
- Timeline view of report progress
- Notification system for status changes
The approval workflow module manages the review and approval process for expense reports, supporting multi-level approvals based on company policies.
Companies can configure approval workflows based on:
- Expense amount thresholds
- Expense categories
- Department hierarchies
- Special approval requirements
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Report │ │ Level 1 │ │ Level 2 │ │ Level 3 │
│ Submitted │────►│ Manager │────►│ Department │────►│ Finance │
└─────────────┘ └─────────────┘ │ Head │ │ Team │
└─────────────┘ └─────────────┘
-
Dynamic Routing
- Automatic determination of approval chain
- Skip-level logic for special cases
- Delegation capabilities for approvers
-
Approval Actions
- Approve/Reject/Request clarification
- Partial approvals
- Bulk approval capabilities
- Mobile approval support
-
Compliance Enforcement
- Policy violation flagging
- Audit trail of approval decisions
- Comment system for communication
The reimbursement module handles the payment process for approved expense reports, tracking from approval to payment completion.
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Report │ │ Reimbursement│ │ Payment │ │ Payment │
│ Approved │────►│ Created │────►│ Processing │────►│ Complete │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
│
▼
┌─────────────┐
│ Employee │
│ Notification │
└─────────────┘
-
Payment Methods
- Direct deposit integration
- PayPal/Venmo support
- Check processing
- Crypto payment options
-
Batch Processing
- Grouping reimbursements for efficient processing
- Scheduled payment runs
- Bulk export for accounting systems
-
Reconciliation
- Payment tracking and confirmation
- Accounting system synchronization
- Tax reporting support
The analytics module provides insights into expense data through dashboards, reports, and data visualization tools.
-
Employee Dashboard
- Personal expense summary
- Pending reports and reimbursements
- Historical expense trends
-
Manager Dashboard
- Team expense overview
- Budget tracking vs. actual
- Approval queue management
-
Finance Dashboard
- Company-wide expense analytics
- Department comparisons
- Category breakdown analysis
- Policy compliance metrics
-
Interactive Visualizations
- Expense trends over time
- Category distribution charts
- Department comparison graphs
- Geographical expense mapping
-
Export Capabilities
- PDF report generation
- Excel/CSV data export
- Scheduled report delivery
- Custom report builder
-
Budget Management
- Budget vs. actual tracking
- Forecast projections
- Anomaly detection
- Spending alerts