How shahriarshaon1993/subscription-management works
Project type and purpose
• This is a full-stack Laravel monolithic web application for subscription management.
• Purpose: Allow users to browse plans, register, purchase via Stripe, and manage subscriptions/transactions.
File structure
• Top-level directories:
• app/ (HTTP controllers, middleware, models, providers)
• config/ (environment and service settings)
• database/ (migrations, factories, seeders)
• public/ (front controller index.php, static assets)
• resources/ (Blade views, CSS/JS assets via Vite)
• routes/ (web & console routes)
• storage/ (logs, cache, sessions, file uploads)
• tests/ (Feature & Unit tests)
• Architectural patterns:
• MVC (Models in app/Models, Views in resources/views, Controllers in app/Http/Controllers)
• Service integration (Stripe checkout and webhook handling in PlanController)
• Event/queue system (Laravel Jobs for asynchronous processing if configured)
• Role-based middleware (RoleMiddleware)
Key insights from README
• Uses Blade templates & Tailwind via Vite
• MySQL for persistent storage, optionally Redis for caching/queues
• Stripe for payment processing (checkout sessions + webhooks)
• Routes defined in routes/web.php (public) and middleware guards for auth
Main components and relationships
a. Frontend (Browser)
• Sends HTTP requests to Laravel (public/index.php)
• Renders views (Blade templates) & static assets
b. Web Server / Application Layer
• Nginx/Apache → public/index.php → Laravel HTTP Kernel
• Middleware (auth, role checks)
• Controllers (HomeController, PlanController, Auth controllers)
• Services: Stripe SDK integration, form validation, business logic
c. Persistence Layer
• MySQL database (users, roles, plans, subscriptions, transactions, jobs, cache)
• Eloquent ORM (Models)
d. Asynchronous/Queue Layer (optional if using queues)
• Laravel Queue workers
• Jobs for sending emails, processing webhooks, updating subscription status
e. External Services
• Stripe API (checkout, webhooks)
• Mail service (SMTP, configured in config/mail.php)
f. Storage
• Local or cloud storage for uploaded files (config/filesystems.php)
Architectural patterns & design principles
• MVC separation (clear model, view, controller layers)
• Single monolithic codebase with decoupled components via services
• Event-driven updates via Stripe webhooks
• Middleware for cross-cutting concerns (authentication, roles)
• Environment-based config for credentials (dotenv)