Skip to content
Clean GraphQL API
Lean Mean Clean Apps

Five templates, one search box. Everything in the docs is in here, including the bits we hoped you'd skim.

Try one of these

Results say which template they came from, so you won't end up reading about Lambda when you wanted GraphQL. Again.

Run it locally

There are two ready-made environments. local is for dotnet run: sample data on, logs to the console. docker is for Docker Compose: sample data on, logs to Seq, database on a volume. Both are for your machine. Neither is for production, which is why neither is the default.

Terminal window
dotnet run --project ./src/Presentation

launchSettings.json sets the environment to local and listens on http://localhost:5032 and https://localhost:7032.

Where What
/graphql The endpoint. POST a query, or open it in a browser for Nitro
/graphql?sdl The schema in SDL, the same text the snapshot test checks
/health/live Answers 200 while the process is up
/health/ready Answers 200 when the database can be reached
http://localhost:5341 Seq, when running with Docker Compose

The health endpoints answer without a token even when authentication is on, so a load balancer never needs to log in.

Nitro is the easy way: it knows the schema, autocompletes, and keeps your query history. The sample data uses a fixed seed, so these ids are the same on every machine. See the schema reference for every query, mutation and type.

# One movie, its reviews and who wrote them
{
movie(id: "e159975e-4e6a-1ffd-713e-1eb9d8d4a593") {
title
reviews { stars author { firstName lastName } }
}
}
# Write a review
mutation {
createReview(input: { authorId: "01fa8b58-05d2-abd4-e55c-2633222dd0a5", movieId: "e159975e-4e6a-1ffd-713e-1eb9d8d4a593", stars: 5 }) {
id
stars
}
}
Terminal window
dotnet test

Each test class builds its own in-memory SQLite database from the migrations and the same fixed seed. No test can change what another one sees, and nothing touches movie-reviews.db. One of the tests compares /graphql?sdl with tests/Presentation.Tests.Integration/GraphQL/Schema/schema.graphql, so a schema change you didn’t mean to make fails the build before anyone’s client notices.

The Dockerfile has a stage for each job, so you can build only what you need.

Stage What it does
build Restores and builds the solution
test Runs every test with coverage
coverage Exports the coverage report to your machine
publish Publishes the Presentation project
run The image you deploy
Terminal window
docker build . --target coverage --output type=local,dest=out
Terminal window
docker build . --target run --tag acme-movies:latest \
--build-arg VERSION_PREFIX=1.2.3 --build-arg VERSION_SUFFIX=beta

The version query then reports 1.2.3-beta and the commit it was built from.