egg README

The project's README from github.com/eggjs/egg. As one markdown file: README.md.

English | 简体中文

NPM version NPM quality NPM download Node.js Version FOSSA Status

Continuous Integration Test coverage Known Vulnerabilities Open Collective backers and sponsors

Features

Quickstart

Follow the commands listed below.

$ corepack enable utoo
$ mkdir showcase && cd showcase
$ ut create egg@beta
$ ut install
$ ut run dev
$ open http://localhost:7001

Node.js >= 22.18.0 required.

Monorepo Structure

This project is structured as a utoo monorepo with the following packages:

The monorepo uses utoo catalog mode for centralized dependency management, ensuring consistent versions across all packages.

Development Commands

# Install dependencies for all packages
ut install --from pnpm

# Build all packages
ut run build

# Test all packages
ut run test

# Run specific package commands
ut --filter=egg run test
ut --filter=@examples/helloworld-typescript run dev
ut --filter=site run dev

Local External Services

Some DAL, ORM, Redis, and ecosystem benchmark paths need local MySQL and Redis services. Start the repository-aligned Docker services before running those tests on a clean machine:

ut run dev:services:start

This starts MySQL 8 and Redis 7, matching the main CI service versions, and creates the databases used by local DAL/ORM/e2e fixtures: test, apple, banana, test_runtime_datasource, test_runtime_dao, test_dal_plugin, test_dal_standalone, cnpmcore, and cnpmcore_unittest.

Useful commands:

ut run dev:services:status
ut run dev:services:stop
ut run dev:services:reset

The default host ports are 127.0.0.1:3306 for MySQL and 127.0.0.1:6379 for Redis. If either port is already used, the start command stops before changing containers. Keep using the existing service if it is compatible with CI, or stop it and run the command again. You can change Docker host ports with EGG_DEV_SERVICES_MYSQL_PORT and EGG_DEV_SERVICES_REDIS_PORT; however, the full DAL/ORM/Redis local test path still expects the default host ports.

Image overrides are available for compatibility checks:

EGG_DEV_SERVICES_MYSQL_IMAGE=mysql:5.7 ut run dev:services:start
EGG_DEV_SERVICES_REDIS_IMAGE=redis:7 ut run dev:services:start

Run ut run dev:services:reset before switching MySQL image families, for example between MySQL 8 and MySQL 5.7, because MySQL data directories are not downgrade-compatible across major versions.

Current hard-coded service assumptions:

Documentations

Contributors

contributors

How to Contribute

Please let us know how can we help. Do check out issues for bug reports or suggestions first.

To become a contributor, please follow our contributing guide, and review the repository guidelines for day-to-day development tips.

Sponsors and Backers

sponsors backers

License

MIT

FOSSA Status

egg (eggjs/egg)

Searching Database…

19K ·GitHub
这是什么?Egg 是一个 Node.js 框架,用于构建更好的企业级框架和 Web 应用,基于 Koa 开发。它在 GitHub 上有大约 19,000 颗星,提供英文和简体中文文档。
它是我用来搭建应用的框架,还是我在代码里调用的库?是一个完整的框架:你的应用构建在它之上,底层服务层是 Koa。主包 packages/egg 在仓库中被描述为 Eggjs 主框架。
我怎么用它把一个应用跑起来?按照 README 顶部的 Quickstart 命令操作即可。仓库里还附带两个可以直接运行的 hello-world 示例 —— examples/helloworld-commonjs 和 examples/helloworld-typescript,可以从它们入手。
开始之前我需要先装好什么?需要 Node.js 22.18.0 或更新版本。如果要在本地跑仓库的 DAL、ORM 和 Redis 测试,还需要用 Docker 启动 MySQL 8 和 Redis 7 服务,版本与 CI 保持一致。
本地测试环境有什么坑吗?测试固件默认使用 127.0.0.1:3306(MySQL)和 6379(Redis)端口,如果端口被占用,启动命令会直接停止。切换 MySQL 镜像版本之前,要先运行 'ut run dev:services:reset',因为数据目录不支持降级兼容。
Egg 开箱即用能提供什么?四大核心特性:内置进程管理、插件系统、框架定制能力,以及大量现成的插件来扩展你的应用。
它为什么自称企业级框架?这个名字是字面意思 —— 它就是'为构建更好的企业级框架和应用而生':面向大型服务端应用,并通过框架定制能力让团队把 Egg 打造成自己的内部框架。
这个仓库内部是什么结构?它是一个 utoo monorepo:packages/egg 存放主框架,site/ 存放文档网站,所有包的依赖版本都集中统一管理。
Egg 还在积极维护吗?是的 —— 该项目始于 2016 年,有大约 19,000 颗星,没有被归档,并且持续运行单元测试、e2e 和发布流程的 CI 工作流。
What are similar projects?koa, elpis, crystal, apollo-server, fastify, hapi, carno.js, node-restify
Creator
eggjs
Size
29.5 MB
Stars
19K
Age
10y
Commits · 90 Days