Zanzibar 是一个扩展框架,用来构建配置驱动的 Web 应用。Zanzibar 的目标是将应用开发简化成两步:
Zanzibar 将基于配置来生成样板和胶水代码。你只需要填充你的业务代码,Zanzibar 就可以帮你生成一个可发布的应用。
Zanzibar 内建的组件可以简化微服务和网关服务的开发。
Zanzibar 的项目目录结构:
example-gateway # root directory ├── bin # directory for generated application binaries │ └── example-gateway # generated example-gateway binary ├── build # directory for all generated code │ ├── clients # generated mocks and module initializers for clients │ ├── endpoints # generated mocks and module initializers for endpoints │ ├── gen-code # generated structs and (de)serializers by Thrift compiler │ ├── middlewares # generated module initializers for middlewares │ │ └── default # generated module initializers for default middlewares │ └── services # generated mocks and module intialziers for services ├── build.yaml # config file for Zanzibar code generation, see below for details ├── clients # config directory for modules of client module class │ └── bar # config directory for a client named 'bar' ├── config # config directory for application runtime properties │ ├── production.yaml # config file for production environment │ └── test.yaml # config file for test environment ├── copyright_header.txt # optional copyright header for open source application ├── endpoints # config directory for modules of endpoint module class │ └── bar # config directory for an endpoint named 'bar' ├── idl # idl directory for all thrift files │ ├── clients # idl directory for client thrift files │ └── endpoints # idl directory for endpoint thrift files ├── middlewares # config directory for modules of middleware module class │ ├── transform-response # config directory for a middleware named 'transform-response' │ ├── default # directory for all default middlewares │ │ └── log-publisher # config directory for a default middleware named 'log-publisher' │ └── default.yaml # config file describing default middlewares and their execution order └── services # config directory for modules of service module class └── example-gateway # config directory for a service named 'example-gateway'