约定式模块加载:ModuleServiceProvider 启动 config/modules.php 中启用的模块,并接入其路由、迁移、命名空间视图、翻译、配置与模块服务提供者
laravel-modular-monolith-starter — Laravel 启动器模板
作者 Sharps-M
Modulith 是一个基于 Laravel 的模块化单体启动器,按业务域划分自包含模块并强制分层边界,内置 RBAC、审计、Docker 与 CI。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
目前有 1 张原始预览,可打开完整图片查看设计细节。
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
分层模块与边界约束:Domain、Application、Infrastructure、UI 分层,架构测试会在 Domain 引入 Infrastructure、UI、HTTP 或门面时使构建失败
RBAC 与防提权:权限按模块命名空间划分,超级管理员通过 Gate::before 获得全部权限,只有超级管理员能授予该角色或编辑其他超级管理员
加固认证与审计:无公开注册、禁用账号无法登录、登录限速、密码重置不暴露账号存在;角色变更与发出的邮件均被记录
可替换品牌与主题:名称取自 APP_NAME,Logo 来自单个 Blade 局部视图,颜色来自 CSS 设计令牌,支持明暗主题
Docker 与 CI:Docker Compose 提供 PHP-FPM、Nginx、MariaDB;GitHub Actions 运行 Pint、PHPUnit、Vite 构建与 Docker 镜像构建
模板详细介绍
Modulith 是面向模块化单体(modular monolith)的 Laravel 启动器。它把每个业务域放进独立模块,模块内部按 Domain、Application、Infrastructure、UI 分层,依赖只向内指向 Domain;同时提供架构测试,若 Domain 类引入 Infrastructure、UI、HTTP 或门面(facade)会导致构建失败。认证、基于角色的访问控制、审计和 UI 外壳由所有模块共享。
模块通过约定加载:ModuleServiceProvider 会启动 config/modules.php 中列出的模块,并接入其路由、迁移、命名空间视图、翻译、配置以及模块自身的服务提供者。仓库自带 Gestion 模块(用户与角色管理)和一个 Skeleton_referencia 参考模块,新增业务域时复制参考模块并在配置中启用即可,无需改动核心。
权限使用 Spatie Permission,按模块命名空间划分(如 gestion.usuarios.administrar),Super Administrador 角色通过 Gate::before 获得全部权限,并设有防提权校验:只有超级管理员能授予超级管理员角色或编辑其他超级管理员。认证方面没有公开注册,被禁用账号无法登录,登录有速率限制,密码重置不暴露账号是否存在。审计记录角色变更(操作者、对象、变更前后),发出的邮件记录到独立频道。品牌可替换:名称取自 APP_NAME,Logo 来自一个 Blade 局部视图,颜色来自 CSS 设计令牌,支持明暗主题。
项目提供 Docker Compose(PHP-FPM、Nginx、MariaDB)与 GitHub Actions 流水线,包含 Pint、PHPUnit、Vite 构建和 Docker 镜像构建。UI 与深入技术文档(docs/ 目录)使用西班牙语,代码标识符也遵循同一约定。仓库采用 MIT 许可,免费范围为该版本代码,演示图片、字体、图标等第三方素材需按各自许可核对,域名、托管、数据库等外部服务可能另行收费。
适合你的项目吗?
适用场景
- 需要按业务域拆分代码、又不想引入分布式复杂度的 Laravel 项目起步
- 为内部管理平台搭建带用户与角色管理、审计记录的基础骨架
- 在团队中通过架构测试约束分层依赖,防止 Domain 层被基础设施细节污染
- 以参考模块为模板快速复制并启用新的业务模块
适合人群
- 使用 Laravel 并认可模块化单体架构的团队
- 需要 RBAC、审计与加固认证等后台管理基础能力的项目
- 希望用 Docker Compose 统一本地与部署环境的开发者
- 能接受 UI 与文档以西班牙语为主的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
需要 Docker 与 Docker Compose;克隆仓库后复制 .env.example 为 .env
- 2
执行 docker compose up -d --build,再在容器内运行 composer install、php artisan key:generate、php artisan migrate --seed
- 3
前端需在宿主机执行 npm install 与 npm run build,随后访问 http://localhost:8080
- 4
种子数据使用 .env 中的 SEED_ADMIN_EMAIL 与 SEED_ADMIN_PASSWORD 创建超级管理员;密码留空时会生成随机密码并只打印一次
- 5
测试与代码风格检查:docker compose exec app php artisan test 与 vendor/bin/pint --test
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 界面与深入技术文档(docs/ 目录)均为西班牙语,代码标识符也遵循同一约定;不熟悉西班牙语的团队使用与维护成本较高。
- 运行与部署需要 Docker 与 Docker Compose 环境,无法在无容器环境中直接启动。
- 初始超级管理员依赖 .env 中的 SEED_ADMIN_EMAIL 与 SEED_ADMIN_PASSWORD;密码留空时随机生成且仅打印一次,需及时保存。
- 前端资源需在宿主机执行 npm install 与 npm run build 构建,依赖 Node/npm 工具链。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
The UI and the in-depth technical docs ([`docs/`](docs/README.md)) are in > Spanish, the language of the platforms this base was built for. Code > identifiers follow the same convention.
README 原文
Requirements: Docker and Docker Compose.
README 原文
The seeder creates a super admin using `SEED_ADMIN_EMAIL` / `SEED_ADMIN_PASSWORD` from `.env`; if the password is left empty, a random one is generated and printed once.
README 原文
https://github.com/Sharps-M/laravel-modular-monolith-starter/blob/main/LICENSEhttps://github.com/Sharps-M/laravel-modular-monolith-starter/blob/main/README.mdnpm install && npm run build
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-02。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料一般 · 68 / 100
- 技术栈
- Laravel
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-10-01
- 截图检查日期
- 2026-10-02
目前没有记录演示链接。请依据仓库说明在本地评估;仅凭截图无法确认交互行为。
目录记录的主要技术栈是 Laravel。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
已完成服务器许可规则与 AI 来源核对;未经过人工编辑审核。
查看当时使用的来源资料
SHA-256: c43d8c31247ede698dc27e2eec6e7e091d4b2c7d51d50b952fa85458a0c69c75
2026-10-02T14:38:19.866Z
来源文件 / 仓库# Modulith — Laravel Modular Monolith Starter
[](https://github.com/Sharps-M/laravel-modular-monolith-starter/actions/workflows/ci.yml)


[](LICENSE)
**Modulith** is a production-minded **Laravel 12 starter for modular monoliths**: each business
domain lives in its own self-contained module with explicit layers (Domain,
Application, Infrastructure, UI), while authentication, role-based access
control, auditing and the UI shell are shared by every module.
It is the extracted, generic core of internal management platforms I build and
maintain. Add a domain by copying a reference module and enabling it in config:
no changes to the core.

> The UI and the in-depth technical docs ([`docs/`](docs/README.md)) are in
> Spanish, the language of the platforms this base was built for. Code
> identifiers follow the same convention.
---
## Highlights
- **Convention-based module loader.** `ModuleServiceProvider` boots every
module listed in `config/modules.php` and wires its routes, migrations,
namespaced views, translations, config and its own service provider.
- **Layered modules with enforced boundaries.** An architecture test fails the
build if a Domain class imports Infrastructure, UI, HTTP or facades.
- **Repository contracts in the domain, Eloquent in infrastructure**, bound per
module, so controllers never depend on the ORM.
- **RBAC with Spatie Permission.** Permissions are namespaced per module
(`gestion.usuarios.administrar`); a `Super Administrador` role gets full
access through `Gate::before`.
- **Privilege-escalation guards.** Only a super admin can grant the super admin
role or edit another super admin; assignable roles are validated against the
module's catalog.
- **Hardened authentication.** No public sign-up, disabled accounts cannot log
in, login is rate-limited, and password reset never reveals whether an
account exists.
- **Audit trail.** Role changes are stored (who, whom, before/after) and every
outgoing email is logged to a dedicated channel.
- **Replaceable branding.** Name from `APP_NAME`, logo from one Blade partial,
colors from CSS design tokens, with light and dark themes.
- **Dockerized** (PHP 8.3-FPM, Nginx, MariaDB) and **CI on every push**: Pint,
PHPUnit on PHP 8.3/8.4, Vite build and Docker image build.
## Architecture
```
app/ Shared kernel: auth, users, feedback, auditing, mail
modules/
├── Gestion/ Users & roles administration (enabled)
│ ├── Domain/ Repositories (contracts)
│ ├── Infrastructure/ Eloquent repositories, config, service provider
│ ├── UI/ Controllers, form requests, routes, Blade views
│ └── Tests/ Feature tests, auto-discovered by PHPUnit
└── Skeleton_referencia/ Reference module to copy when adding a new domain
```
Dependencies only point inward:
```
UI ──► Application ──► Domain ◄── Infrastructure
```
Enabling a module is one line:
```php
// config/modules.php
'enabled' => [
'Gestion',
'Inventory', // copied from modules/Skeleton_referencia
],
```
The reasoning behind each design choice is recorded in
[`docs/decisiones.md`](docs/decisiones.md).
## Tech stack
| Layer | Technology |
|-------|------------|
| Backend | PHP 8.3, Laravel 12, Spatie Permission 6 |
| Database | MariaDB 11.4 (SQLite in-memory for tests) |
| Frontend | Blade, Bootstrap 5.3, Tailwind 3 (`tw-` prefix), Vite 6 |
| Infrastructure | Docker Compose: PHP-FPM, Nginx 1.27, MariaDB |
| Quality | PHPUnit 11, Laravel Pint, GitHub Actions |
## Getting started
Requirements: Docker and Docker Compose.
```bash
git clone https://github.com/Sharps-M/laravel-modular-monolith-starter.git
cd laravel-modular-monolith-starter
cp .env.example .env
docker compose up -d --build
docker compose exec app composer install
docker compose exec app php artisan key:generate
docker compose exec app php artisan migrate --seed
npm install && npm run build
```
Open <http://localhost:8080>. The seeder creates a super admin using
`SEED_ADMIN_EMAIL` / `SEED_ADMIN_PASSWORD` from `.env`; if the password is left
empty, a random one is generated and printed once.
### Running the tests
```bash
docker compose exec app php artisan test
docker compose exec app vendor/bin/pint --test
```
## Adding a module
1. Copy `modules/Skeleton_referencia/` to `modules/YourModule/` and rename the
namespaces.
2. Add `'YourModule'` to `enabled` in `config/modules.php`.
3. Put routes in `UI/Http/routes.php`, views in `UI/Views/` (available as
`view('your_module::...')`), migrations in
`Infrastructure/Database/Migrations/` and tests in `Tests/`.
4. Declare the module's permissions in `RolesPermisosSeeder` and protect its
routes with `can:`.
Full guide (in Spanish): [`modules/README.md`](modules/README.md) and
[`docs/nuevo-proyecto.md`](docs/nuevo-proyecto.md).
## Screenshots
| Sign in | New user | Dark theme |
|---------|----------|------------|
|  |  |  |
## Documentation
| Document | Contents |
|----------|----------|
| [`docs/decisiones.md`](docs/decisiones.md) | Architecture decision record and AI-assisted development rules |
| [`docs/despliegue.md`](docs/despliegue.md) | Deployment and infrastructure guide |
| [`docs/guidelines/`](docs/guidelines) | Per-subsystem guidelines: base app, users module, visual identity, email |
| [`modules/README.md`](modules/README.md) | How the module system works |
| [`CHANGELOG.md`](CHANGELOG.md) | Release history |
## License
[MIT](LICENSE)
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

sage
WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and block editor support
Laravel · 启动器

wave
Wave - The Software as a Service Starter Kit, designed to help you build the SAAS of your dreams 🚀 💰
Laravel · SaaS

filament-starter
A beautiful starting point for your next TALL stack project using Filament. ⚡
Laravel · 启动器

electrik
Laravel SaaS starter kit: auth, teams, Stripe billing, and Slate 3 — Composer package for Laravel 12
Laravel · SaaS

php-saas
The everything-included starter kit for your next idea
Laravel · SaaS

filament-jetstream
A Laravel starter kit built with Filament inspired by Jetstream.
Laravel · 启动器
