登录 注册
开发者工具内容创作与媒体工具AI 模型与开发框架 apigraphqlsangriascala
1,962
Stars
219
Forks
55
Watchers
75
Open Issues
Apache-2.0
许可证
Scala
语言
2015-07-05
创建时间
2026-11-02
最近更新

项目能做什么

Sangria 是一个用 Scala 编写的 GraphQL 库,帮助开发者在 Scala 项目中快速构建符合规范的 GraphQL API。它支持定义 Schema、解析并执行查询,以及配合 circe 等库进行 JSON 序列化,可与 Apollo、Relay、GraphiQL 等工具开箱即用。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
![Sangria Logo](https://sangria-graphql.github.io/assets/img/sangria-logo.svg)

[Sangria](https://sangria-graphql.github.io/) is a scala [GraphQL](http://facebook.github.io/graphql/) library.

![Continuous Integration](https://github.com/sangria-graphql/sangria/workflows/Continuous%20Integration/badge.svg)
[![Coverage Status](http://coveralls.io/repos/sangria-graphql/sangria/badge.svg?branch=master&service=github)](http://coveralls.io/github/sangria-graphql/sangria?branch=master)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.sangria-graphql/sangria_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.sangria-graphql/sangria_2.13)
[![License](http://img.shields.io/:license-Apache%202-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)
[![Scaladocs](https://www.javadoc.io/badge/org.sangria-graphql/sangria_2.13.svg?label=docs)](https://www.javadoc.io/doc/org.sangria-graphql/sangria_2.13)
[![Join the chat at https://gitter.im/sangria-graphql/sangria](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sangria-graphql/sangria?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

SBT Configuration:

```scala
libraryDependencies += "org.sangria-graphql" %% "sangria" % "<latest version>"
```

You can find an example application that uses akka-http with sangria here:

https://github.com/sangria-graphql/sangria-akka-http-example

More info and the documentation can be found in the project home page:

[https://sangria-graphql.github.io/](https://sangria-graphql.github.io/)

I would also recommend you to check out [Sangria Playground](https://github.com/sangria-graphql/sangria-playground).
It is an example of GraphQL server written with Play framework and Sangria. It also serves as a playground,
where you can interactively execute GraphQL queries and play with some examples.

If you want to use sangria with [react-relay](https://facebook.github.io/relay) framework, then you also may be interested in [sangria-relay](https://github.com/sangria-graphql/sangria-relay).

Sangria is a spec compliant GraphQL implementation, so it works out of the box with [Apollo](https://github.com/apollographql/apollo-client), [Relay](https://facebook.github.io/relay/), [GraphiQL](https://github.com/graphql/graphiql) and other GraphQL tools and libraries.


## Hello World Example

In this example we will use [circe](https://github.com/circe/circe) JSON marshalling, so we also need to include following dependency:

```scala
libraryDependencies += "org.sangria-graphql" %% "sangria-circe" % "1.3.2"
```

The most simple Hello World application might look like this:

```scala
import sangria.schema._
import sangria.execution._
import sangria.macros._
import sangria.marshalling.circe._
import scala.concurrent.ExecutionContext.Implicits.global

val QueryType = ObjectType("Query", fields[Unit, Unit](
  Field("hello", StringType, resolve = _ => "Hello world!")
))

val schema = Schema(QueryType)

val quer
阅读完整原文

项目深度分析 AI 生成

Scala 3 与现代异步生态商业支持与迁移咨询服务

产品构想针对使用 Sangria 的中大型企业,提供 Scala 2 到 Scala 3 的 Sangria 升级支持,以及结合 Pekko / Cats Effect / ZIO 的性能调优与技术保障。
核心功能Scala 3 代码库迁移咨询、定制化 Macro 优化、复杂 DataLoader/Batch 性能排查、SLA 级技术支持服务合同。
目标用户有遗留 Scala 资产但需要长期维护升级的金融科技、电商等企业研发团队。
难度/周期高 · 1 - 3 个月(建立案例与销售线索) · 成本:极低(主要是时间成本)
收费模式技术咨询费、企业级年度维保订阅(Support Contract)。
竞争风险Scala 社区体量相对有限,潜在付费企业客户基数较小,获客周期较长。
依据 已验证事实

Sangria 企业级 GraphQL 监控、安全与审计中间件

产品构想针对 Sangria 研发的专有中间件插件及配套可视化 SaaS 平台,专注于深度安全防御(Query 复杂度分析、深度限制、DoS 阻断)与性能追踪(Resolver 耗时打点)。
核心功能一键注入的 Sangria Instrumentation 插件、查询复杂度与配额管理看板、字段级性能链路追踪、安全合规告警。
目标用户暴露公开或多租户 GraphQL API 的 Scala 后端技术负责人。
难度/周期中等 · 2 - 4 个月 · 成本:低(云监控服务器及前端展示费用)
收费模式按监控节点/请求量计费的 SaaS 订阅或针对私有化部署的商业授权 License。
竞争风险Apollo Studio 等跨语言方案占领了通用 GraphQL 观测市场,纯 Scala 方案吸引力需通过极轻量与合规优势打平(推测)。
依据 AI推测

基于 Sangria 的轻量级 Headless API 网关与 BaaS 平台

产品构想利用 Sangria 和 Scala 高并发特性,开发一款专注于把现有 SQL/NoSQL 数据库直接转化为安全 GraphQL API 的微服务网关工具(类似 Hasura 的 Scala 生态精简版)。
核心功能基于配置自动生成 Sangria Schema、数据库连接池自动化管理、开箱即用的 JWT 鉴权与基于角色的行级访问控制(RBAC)。
目标用户希望快速将数据源暴露为 GraphQL 接口的中小型研发团队或独立开发者。
难度/周期高 · 4 - 6 个月 · 成本:中等(基础设施与测试开发)
收费模式开源核心 + 企业版高级功能(多租户、审计日志)或托管云服务订阅。
竞争风险该领域已有 Hasura、PostGraphile 等成熟竞品,重构网关产品的技术和市场竞争难度极大。
依据 尚需验证的假设
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

相似项目数据正在完善中,暂不展示(避免误导)

项目优势与风险

技术成熟度创建于 2015-07-05,近 30 天仍在推送,发布过 100 个 Release
社区活跃Star 1,962 / Fork 219 / Issue 75(数据支持,可自行核实)
许可证Apache-2.0
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。