Egg
๐ฅ๐ฅ๐ฅ๐ฅ Born to build better enterprise frameworks and apps with Node.js & Koa. https://307.run/eggcode
- Built-in Process Management - Plugin System - Framework Customization - Lots of [plugins](https://github.com/search?q=topic%3Aegg-plugin&type=Repositories) The project is written primarily in TypeScript, distributed under the MIT License license, first published in 2016. It has gained significant community traction with 18,993 stars and 1,808 forks on GitHub. Key topics include: egg, eggjs, enterprise, framework, koa.
English | ็ฎไฝไธญๆ
<div style="text-align:center"> <img src="site/public/assets/egg-banner.png" /> </div>Features
- Built-in Process Management
- Plugin System
- Framework Customization
- Lots of plugins
Quickstart
Follow the commands listed below.
bash$ mkdir showcase && cd showcase $ pnpm create egg@beta $ pnpm install $ pnpm run dev $ open http://localhost:7001
Node.js >= 20.19.0 required, supports
require(esm)by default.
Monorepo Structure
This project is structured as a pnpm monorepo with the following packages:
packages/egg- Main Eggjs frameworkexamples/helloworld-commonjs- CommonJS example applicationexamples/helloworld-typescript- TypeScript example applicationsite- Documentation website
The monorepo uses pnpm catalog mode for centralized dependency management, ensuring consistent versions across all packages.
Development Commands
bash# Install dependencies for all packages pnpm install # Build all packages pnpm run build # Test all packages pnpm run test # Run specific package commands pnpm --filter=egg run test pnpm --filter=@examples/helloworld-typescript run dev pnpm --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:
bashutoo 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:
bashutoo run dev:services:status utoo run dev:services:stop utoo 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:
bashEGG_DEV_SERVICES_MYSQL_IMAGE=mysql:5.7 utoo run dev:services:start EGG_DEV_SERVICES_REDIS_IMAGE=redis:7 utoo run dev:services:start
Run utoo 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:
- Redis plugin fixtures under
plugins/redis/test/fixtures/apps/**/config.*use127.0.0.1:6379; skipped Redis plugin tests become runnable when that port is available. - Session Redis fixtures under
plugins/session/test/fixtures/redis-session/config/config.default.jsuse127.0.0.1:6379. - DAL runtime tests in
tegg/core/dal-runtime/test/DataSource.test.tsandtegg/core/dal-runtime/test/DAO.test.tsuse local MySQL on port3306. - DAL module fixtures in
tegg/plugin/dal/test/fixtures/apps/dal-app/modules/dal/module.ymlandtegg/standalone/standalone/test/fixtures/dal-*/module.ymluse local MySQL on port3306. - ORM fixtures in
tegg/plugin/orm/test/fixtures/prepare.jsandtegg/plugin/orm/test/fixtures/apps/orm-app/config/config.default.tsuse local MySQL on port3306.
Documentations
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
License
Contributors
Showing top 12 contributors by commit count.
