MongoDB + GraphQL GraphQL + Node 14++ Apollo+ Blueprint+ X-Framework

基于 X-Framework 与 Blueprint 快速生成含 GraphQL API 与管理后台的全栈应用

Blueprint 基于 X-Framework 做快速原型,API 依赖 Apollo/GraphQL,数据层用 MongoDB,CLI 生成代码后分别启动 API 与管理端。

✓ 快速原型生成✓ 依赖注入模块化 ✕ 原型方案绑定 MongoDB

方案简介

基于 X-Framework 与 Blueprint 快速生成含 GraphQL API 与管理后台的全栈应用。Blueprint 基于 X-Framework 做快速原型,API 依赖 Apollo/GraphQL,数据层用 MongoDB,CLI 生成代码后分别启动 API 与管理端。

前置要求

  • MongoDB
  • Node 14+
  • 全局安装 CLI:

实施步骤

1. 安装环境与 CLI

安装 MongoDB 与 Node 14+,然后全局安装 @bluelibs/x:

bash
npm i -g @bluelibs/x

2. 创建项目

运行交互式命令选择项目并完成创建:

bash
x # pick project and complete it there

3. 生成代码并启动

进入项目目录,生成 Blueprint 代码,依次启动 API 与管理后台(管理后台需在 API 启动之后再启动):

bash
cd project
npm run blueprint:generate
npm run start:api
npm run start:admin # Start after API has started

注意事项与常见问题

  • 快速原型方案(Blueprint for X-Framework)与 GraphQL 和 MongoDB 紧耦合,但 BlueLibs 整体并非如此,也支持 SQL。
  • 安全漏洞请通过邮件 theodor@bluelibs.com 报告,所有漏洞将被及时处理。

优缺点

  • ✓ 快速原型生成
  • ✓ 依赖注入模块化
  • ✕ 原型方案绑定 MongoDB

出处

本方案挖掘自开源项目 bluelibs/bluelibs,方案内容与实施命令均来自其 README 原文。

方案出处
bluelibs/bluelibs:A collection of open-source software solutions designed for the modern web and e
777 star A collection of open-source software solutions designed for the modern web and enterprise scale.

本方案由真实开源项目挖掘整理,实施命令均来自其 README 原文,安装使用请遵循项目开源协议。