Convert Figma logo to code with AI

cool-team-official logocool-admin-midway

🔥 cool-admin(midway版)一个很酷的后台权限管理框架,Ai编码、流程编排、模块化、插件化、CRUD极速开发,永久开源免费,基于midway.js 3.x、typescript、typeorm、mysql、jwt、vue3、vite、element-ui等构建

2,587
576
2,587
83

Top Related Projects

7,327

🍔 A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. 🌈

66,731

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀

18,867

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa

34,121

ORM for TypeScript and JavaScript. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

38,831

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

15,054

The API and real-time application framework

Quick Overview

Cool Admin Midway is a comprehensive admin platform based on Node.js Midway.js, Vue.js, and Element Plus. It provides a robust backend management system with features like RBAC permissions, code generation, and a flexible plugin system. The project aims to simplify the development of admin interfaces for various applications.

Pros

  • Comprehensive solution combining backend (Midway.js) and frontend (Vue.js) technologies
  • Modular architecture with a plugin system for easy customization and extension
  • Built-in RBAC (Role-Based Access Control) for fine-grained permission management
  • Code generation tools to speed up development process

Cons

  • Steep learning curve due to the integration of multiple technologies
  • Limited documentation in English, which may pose challenges for non-Chinese speakers
  • Potential over-engineering for simpler projects that don't require all features
  • Dependency on specific versions of frameworks may require careful management during updates

Code Examples

  1. Entity definition using TypeORM:
import { Entity, Column } from 'typeorm';
import { BaseEntity } from '@cool-midway/core';

@Entity('sys_user')
export class SysUserEntity extends BaseEntity {
  @Column({ comment: 'Username' })
  username: string;

  @Column({ comment: 'Password' })
  password: string;
}
  1. Controller example with decorators:
import { Provide, Controller, Get, Inject } from '@midwayjs/decorator';
import { CoolController, BaseController } from '@cool-midway/core';
import { UserService } from '../service/user';

@Provide()
@Controller('/admin/sys/user')
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: SysUserEntity,
})
export class SysUserController extends BaseController {
  @Inject()
  userService: UserService;

  @Get('/info')
  async info() {
    return this.ok(await this.userService.info());
  }
}
  1. Service example:
import { Provide } from '@midwayjs/decorator';
import { BaseService } from '@cool-midway/core';

@Provide()
export class UserService extends BaseService {
  async info() {
    // Implement user info retrieval logic
    return { /* user info */ };
  }
}

Getting Started

  1. Clone the repository:

    git clone https://github.com/cool-team-official/cool-admin-midway.git
    
  2. Install dependencies:

    cd cool-admin-midway
    yarn install
    
  3. Configure the database in src/config/config.local.ts

  4. Run the development server:

    yarn dev
    
  5. Access the admin panel at http://localhost:8001

Competitor Comparisons

7,327

🍔 A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. 🌈

Pros of Midway

  • More comprehensive and mature framework with broader ecosystem support
  • Better documentation and community resources
  • Stronger TypeScript integration and decorators support

Cons of Midway

  • Steeper learning curve for beginners
  • Less opinionated, requiring more configuration for complex setups
  • May be overkill for smaller projects or simple APIs

Code Comparison

Midway:

import { Provide, Inject, Controller, Get } from '@midwayjs/decorator';

@Provide()
@Controller('/api')
export class APIController {
  @Inject()
  ctx: Context;

  @Get('/data')
  async getData() {
    return { success: true, data: 'Hello from Midway' };
  }
}

Cool Admin Midway:

import { Provide, Controller, Get } from '@cool-midway/core';

@Provide()
@Controller('/api')
export class APIController {
  @Get('/data')
  async getData() {
    return this.ok('Hello from Cool Admin Midway');
  }
}

The code comparison shows that while both frameworks use similar decorators, Cool Admin Midway provides a more streamlined approach with built-in response helpers like this.ok(). Midway offers more flexibility but requires more boilerplate code for context handling and response formatting.

66,731

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀

Pros of Nest

  • More mature and widely adopted framework with a larger community
  • Extensive documentation and ecosystem of plugins/modules
  • Built-in support for TypeScript and decorators

Cons of Nest

  • Steeper learning curve for developers new to TypeScript or decorators
  • Can be overkill for smaller projects or microservices
  • Opinionated architecture may not suit all project structures

Code Comparison

Nest:

@Controller('cats')
export class CatsController {
  @Get()
  findAll(): string {
    return 'This action returns all cats';
  }
}

Cool Admin Midway:

@Provide()
@Controller('/api/admin/sys/user')
export class SysUserController {
  @Inject()
  sysUserService: SysUserService;

  @Get('/page')
  async page(@Query(ALL) query) {
    return this.sysUserService.page(query);
  }
}

Key Differences

  • Nest uses a more Angular-like approach with decorators
  • Cool Admin Midway is built on top of Midway.js, which is based on Egg.js
  • Nest has a more modular structure, while Cool Admin Midway focuses on admin panel functionality
  • Cool Admin Midway provides more out-of-the-box features for admin systems

Conclusion

Nest is a versatile framework suitable for various applications, while Cool Admin Midway is more specialized for admin panel development. Choose based on your project requirements and team expertise.

18,867

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa

Pros of egg

  • More mature and established framework with a larger community
  • Extensive plugin ecosystem for easy extensibility
  • Built-in security features and best practices

Cons of egg

  • Steeper learning curve for beginners
  • Less opinionated, requiring more configuration
  • May be overkill for smaller projects

Code Comparison

egg:

// app/controller/home.js
const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    this.ctx.body = 'Hello World';
  }
}

cool-admin-midway:

// src/controller/home.ts
import { Provide, Controller, Get } from '@midwayjs/decorator';

@Provide()
@Controller('/')
export class HomeController {
  @Get('/')
  async home() {
    return 'Hello World';
  }
}

Both frameworks use a similar controller-based structure, but cool-admin-midway leverages TypeScript and decorators for a more modern approach. egg uses a more traditional class-based structure with less syntactic sugar.

egg is generally more flexible and customizable, while cool-admin-midway provides a more opinionated and streamlined development experience. The choice between the two depends on project requirements, team preferences, and the desired level of control over the application structure.

34,121

ORM for TypeScript and JavaScript. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

Pros of TypeORM

  • More mature and widely adopted ORM with extensive documentation
  • Supports multiple database systems, offering greater flexibility
  • Active community and frequent updates

Cons of TypeORM

  • Steeper learning curve for beginners
  • Can be overkill for smaller projects or simple database operations
  • Performance may be slower compared to raw SQL queries in some cases

Code Comparison

TypeORM:

import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"

@Entity()
export class User {
    @PrimaryGeneratedColumn()
    id: number

    @Column()
    firstName: string
}

Cool Admin Midway:

import { EntityModel } from '@midwayjs/orm';
import { PrimaryGeneratedColumn, Column } from 'typeorm';

@EntityModel()
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  firstName: string;
}

Both repositories use TypeORM as the underlying ORM, but Cool Admin Midway is built on top of the Midway framework, providing additional features and abstractions. TypeORM offers more flexibility and direct control over database operations, while Cool Admin Midway provides a more opinionated structure and additional built-in functionalities for rapid development of admin systems.

38,831

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

Pros of Prisma

  • More mature and widely adopted ORM with extensive documentation
  • Supports multiple databases (PostgreSQL, MySQL, SQLite, etc.)
  • Type-safe database access with auto-generated TypeScript types

Cons of Prisma

  • Steeper learning curve for developers new to ORM concepts
  • Less flexibility in complex database operations compared to raw SQL
  • Requires additional setup and configuration for each project

Code Comparison

Prisma schema definition:

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
  posts Post[]
}

Cool Admin Midway entity definition:

@EntityModel('user')
export class User extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ unique: true })
  email: string;

  @Column({ nullable: true })
  name: string;
}

Both projects aim to simplify database operations, but Prisma offers a more comprehensive ORM solution with broader database support. Cool Admin Midway, on the other hand, provides a full-stack admin panel solution built on Midway.js, which may be more suitable for rapid development of admin interfaces. The choice between the two depends on the specific project requirements and the developer's familiarity with the respective ecosystems.

15,054

The API and real-time application framework

Pros of Feathers

  • More mature and widely adopted framework with a larger community
  • Supports real-time functionality out of the box
  • Flexible and modular architecture allowing for easy customization

Cons of Feathers

  • Steeper learning curve for developers new to its concepts
  • Less opinionated, which may require more setup and configuration
  • Limited built-in admin interface compared to Cool Admin Midway

Code Comparison

Feathers service creation:

const feathers = require('@feathersjs/feathers');
const app = feathers();

app.use('messages', {
  async find() {
    return [{ id: 1, text: 'Hello' }];
  }
});

Cool Admin Midway controller:

import { Provide, Controller, Get } from '@midwayjs/decorator';

@Provide()
@Controller('/api/user')
export class UserController {
  @Get('/')
  async getUser() {
    return { id: 1, name: 'John' };
  }
}

Both frameworks offer different approaches to creating services or controllers. Feathers focuses on a service-based architecture, while Cool Admin Midway uses a more traditional controller-based approach with decorators.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Midway Logo

cool-admin(midway版)一个很酷的后台权限管理系统,开源免费,模块化、插件化、极速开发CRUD,方便快速构建迭代后台管理系统,支持serverless、docker、普通服务器等多种方式部署 到 官网 进一步了解。

GitHub license GitHub tag GitHub tag

特性

Ai时代,很多老旧的框架已经无法满足现代化的开发需求,Cool-Admin开发了一系列的功能,让开发变得更简单、更快速、更高效。

  • Ai编码:通过微调大模型学习框架特有写法,实现简单功能从Api接口到前端页面的一键生成
  • 流程编排:通过拖拽编排方式,即可实现类似像智能客服这样的功能
  • 模块化:代码是模块化的,清晰明了,方便维护
  • 插件化:插件化的设计,可以通过安装插件的方式扩展如:支付、短信、邮件等功能

技术栈

  • 后端:**node.js midway.js koa.js typescript**
  • 前端:**vue.js element-plus jsx pinia vue-router**
  • 数据库:**mysql postgresql sqlite**

如果你是前端,后端的这些技术选型对你是特别友好的,前端开发者可以较快速地上手。 如果你是后端,Typescript 的语法又跟 java、php 等特别类似,一切看起来也是那么得熟悉。

如果你想使用 java 版本后端,请移步cool-admin-java

官网

https://cool-js.com

视频教程

官方 B 站视频教程

演示

AI 极速编码

https://show.cool-admin.com

  • 账户:admin
  • 密码:123456

Admin Home

项目前端

https://github.com/cool-team-official/cool-admin-vue

或

https://gitee.com/cool-team-official/cool-admin-vue

或

https://gitcode.com/cool_team/cool-admin-vue

微信群

Admin Wechat

运行

修改数据库配置,配置文件位于src/config/config.local.ts

以 Mysql 为例,其他数据库请参考数据库配置文档

Mysql(>=5.7版本),建议 8.0,node 版本(>=16.x),建议 18.x,首次启动会自动初始化并导入数据

// mysql,驱动已经内置,无需安装
typeorm: {
    dataSource: {
      default: {
        type: 'mysql',
        host: '127.0.0.1',
        port: 3306,
        username: 'root',
        password: '123456',
        database: 'cool',
        // 自动建表 注意:线上部署的时候不要使用,有可能导致数据丢失
        synchronize: true,
        // 打印日志
        logging: false,
        // 字符集
        charset: 'utf8mb4',
        // 是否开启缓存
        cache: true,
        // 实体路径
        entities: ['**/modules/*/entity'],
      },
    },
  },

安装依赖并运行

$ npm i
$ npm run dev
$ open http://localhost:8001/

注: npm i如果安装失败可以尝试使用cnpm,或者切换您的镜像源,推荐使用pnpm

CURD(快速增删改查)

大部分的后台管理系统,或者 API 服务都是对数据进行管理,所以可以看到大量的 CRUD 场景(增删改查),cool-admin 对此进行了大量地封装,让这块的编码量变得极其地少。

新建一个数据表

src/modules/demo/entity/goods.ts,项目启动数据库会自动创建该表,无需手动创建

import { BaseEntity } from '@cool-midway/core';
import { Column, Entity, Index } from 'typeorm';

/**
 * 商品
 */
@Entity('demo_app_goods')
export class DemoAppGoodsEntity extends BaseEntity {
  @Column({ comment: '标题' })
  title: string;

  @Column({ comment: '图片' })
  pic: string;

  @Column({ comment: 'ä»·æ ¼', type: 'decimal', precision: 5, scale: 2 })
  price: number;
}

编写 api 接口

src/modules/demo/controller/app/goods.ts,快速编写 6 个 api 接口

import { CoolController, BaseController } from '@cool-midway/core';
import { DemoAppGoodsEntity } from '../../entity/goods';

/**
 * 商品
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: DemoAppGoodsEntity,
})
export class DemoAppGoodsController extends BaseController {
  /**
   * 其他接口
   */
  @Get('/other')
  async other() {
    return this.ok('hello, cool-admin!!!');
  }
}

这样我们就完成了 6 个接口的编写,对应的接口如下:

  • POST /app/demo/goods/add 新增
  • POST /app/demo/goods/delete 删除
  • POST /app/demo/goods/update 更新
  • GET /app/demo/goods/info 单个信息
  • POST /app/demo/goods/list 列表信息
  • POST /app/demo/goods/page 分页查询(包含模糊查询、字段全匹配等)

部署

部署教程

内置指令

  • 使用 npm run lint 来做代码风格检查。

低价服务器

阿里云、腾讯云、华为云低价云服务器,不限新老