跳到正文
DEV Community· yuntian001·· 3 小時前AI 評分42

Me-Admin 如何以全棧 Node.js 和固定約定簡化管理系統開發

Solo dev stack: why I build admin systems with full-stack Node.js and a framework with fixed conventions

AI 導讀

Me-Admin 是以 Node.js 和 Vue 建構的免費開源全棧管理系統框架,透過固定目錄結構、分層方式和內置 RBAC 權限,減少重複搭建工作。定義 Sequelize 實體後,執行兩條命令即可生成控制器、API、前端頁面及菜單權限;生成的是可直接修改的源碼。作者表示,固定約定亦有助 AI 參照既有模組生成更準確的代碼。

正文

Some context

I build a lot of admin systems — client work and my own projects. They all share the same traits: tight deadlines, changing requirements, and usually just me on the keyboard.

After years of trial and error, the setup that works best for me is full-stack Node.js + a framework with fixed conventions. Here's why, and what I built around it.

The practical benefits of full-stack Node.js

Not theory — things I actually feel day to day:

One person can carry the whole project. Vue on the frontend, Node on the backend, one language. I write an endpoint and immediately wire up the page for it. No context switching between two languages.

Shared types. With TypeScript on both ends, the API's field types are the same types the frontend uses. Backend changes a field, the frontend build fails and tells you where. No comparing against API docs by hand.

No integration meetings. When you write both ends, you decide what the API looks like. Integration cost is basically zero — anyone who has done frontend/backend coordination knows how much time that saves.

Hiring is easier. If the project grows, half the people who know Vue can pick up Node quickly.

Full-stack alone isn't enough — you need fixed conventions

Node full-stack solves the language problem. But there's another one: every project rebuilds the same plumbing — directory layout, permissions, list pages, menu config. It's roughly the same every time, yet you redesign it every time. It wastes time, and the designs drift, so your own old projects feel foreign six months later.

So I turned my own way of working into Me-Admin — the conventions and common features are already decided:

  • Fixed directory structure and layering; every module looks identical
  • Built-in RBAC (menu / button / API levels), users, roles, menus — ready out of the box
  • The stuff admin panels always need — lists, search, pagination, forms, uploads — already has components and established patterns
  • Mainstream stack: Midway 3 + Sequelize + PostgreSQL on the backend, Vue 3 + Vite + Element Plus + vxeTable on the frontend

The biggest time-saver: define an entity, run two commands, get a whole module.

# Sync the database schema
pnpm exec meadmin sync product

# Generate controller, API, frontend pages, menu permissions
pnpm exec meadmin crud product --menu

Refresh the admin panel and the module is in the menu — full CRUD working. The output is plain source code in your repo, no black boxes. Edit it directly.

GitHub logo meadmin-cn / meadmin

Me-Admin 是一个免费开源的nodejs + vue 全栈一站式中后台解决方案,后端基于medwayjs ,前台基于vue3构建,开箱即用。本项目采用最宽松的MIT协议,最新技术栈,助力你快速创建企业级web中后台项目。

Me-Admin

npm version License: MIT Node.js GitHub stars

English | 简体中文

Me-Admin 一键 CRUD 演示

Me-Admin 仪表盘

Me-Admin 一键 CRUD 列表   Me-Admin 菜单权限(RBAC)

全栈一站式解决方案 —— Me-Admin 是一个免费开源的 Node.js + Vue 全栈中后台框架,后端基于 Midway.js 3,前端基于 Vue 3,一键 CRUD、SSR 渲染、权限体系开箱即用。MIT 协议,无加密、无授权限制,可商用。

30 秒生成一个业务模块

定义好 Sequelize 实体之后,只需两条命令:

# 同步数据库结构
pnpm exec meadmin sync exampleDemo

# 一键生成:控制器、接口、前端页面、菜单权限
pnpm exec meadmin crud exampleDemo --menu

meadmin 由 @meadmin/cli 提供命令行入口,统一通过 pnpm exec meadmin <命令> 调用。

刷新后台,菜单已经出现——列表、搜索、分页、增删改查、接口与菜单权限全部就位。生成的都是可读可改的源码,后续业务直接在上面写,没有黑盒。

主要特性

  • 一键 CRUD:命令行一键生成控制器、模型、视图与菜单权限,重复工作交给框架
  • SSR · CSR 混合渲染:前台 SSR 提升 SEO 与首屏速度,后台 CSR 保证交互体验
  • 内置权限系统:RBAC 权限模型开箱即用,菜单、按钮、接口三级管控;支持无限父子级分组与自由授权,管理员可跨组别;动态路由权限方案,支持按钮级权限,前端菜单与接口动态获取两种模式
  • 插件化架构:功能以插件形式自由安装卸载,生态持续扩展,系统保持精简
  • 全 TypeScript:自动生成 TS 类型,前后端契约免维护
  • 组件自动按需引入:自动按需引入 components 下的组件定义,支持自定义引入位置和模式,真正的按需引入
  • 友好的国际化:前端支持按组件异步加载语言包
  • 自定义 keepAlive:可按 key 进行 vue keep-alive,解决不同路由统一组件不能独立刷新缓存的问题
  • 可配置主题:主题色与主题模式均可配置
  • 集成 vxeTable:功能最完善的 Vue 表格组件

技术栈

层 技术
计算层 Vue 3 · Vite · TypeScript · Pinia · Element Plus · vue-request@next
服务层 Node.js · Midway.js 3.x · Sequelize 7
存储层 PostgreSQL · Redis

快速启动

依赖环境

  • PostgreSQL 数据库
  • Redis 缓存数据库
  • Node.js >= 22.14.0
  • pnpm

初始化项目

pnpm create meadminjs@latest

根据提示配置数据库等选项即可。

调试项目

pnpm dev
  • …

Works for agile sprints, works for AI coding too

Two situations where this setup really pays off:

Deadline-driven agile work. Requirement comes in → define the entity → run the commands → the basics are done. All remaining time goes to actual business logic. Requirement changes? Update the entity and regenerate, or just edit the generated code.

AI-assisted coding. This is my biggest takeaway from the past year. Because the framework's conventions are fixed and every module has the same shape, AI writes noticeably more accurate code by copying existing modules. Even more direct: I have the AI write the entity definition (describe the table's fields), which it does fast and well, then the commands generate the module. The only AI output I need to review is that one entity file — a few dozen lines, checked at a glance. Everything else is identical generator output.

Simple truth: the more fixed the conventions, the smoother the work — whether a human or an AI is writing it.

Try it

pnpm create meadminjs@latest
pnpm dev

Admin panel at http://127.0.0.1:7001/admin (admin / meAdmin#202507!P). MIT licensed, use it for anything.

Questions → open an issue, I answer all of them: https://github.com/meadmin-cn/meadmin/issues

If it saves you time, a star means a lot: https://github.com/meadmin-cn/meadmin

來源:DEV Community · dev.to