Skip to content

Installation

Install Rust and Cargo using the official Rust installation guide. Use a current stable toolchain. Then install the CLI from crates.io:

Terminal window
cargo install necrassrs-cli --locked
necrass --version

The Cargo package is named necrassrs-cli; the installed executable is named necrass. If your shell cannot find it, ensure Cargo’s binary directory is on PATH (~/.cargo/bin on Unix or %USERPROFILE%\.cargo\bin on Windows).

Run the CLI without arguments in a terminal:

Terminal window
necrass

It asks for a project directory, Cargo package name, and backend framework. The default directory is my-api, and the package name defaults to the directory name. Choose a supported backend framework from the available options.

For scripts or when you already know the settings, use an explicit command:

Terminal window
necrass init my-api

This creates a project without asking questions. Use --name <NAME> to override the Cargo package name and --framework <FRAMEWORK> to select a backend framework.

Without a path, necrass init uses the current directory. Targets must be new or empty; existing projects, nonempty directories, and symbolic-link targets are rejected.

Use necrass --help and necrass init --help for command usage. Without a terminal, supply an explicit command; bare necrass prints help and exits with an error.

The starter uses released NecrassRs packages from crates.io. Cargo records the resolved package versions in the new project’s Cargo.lock on the first build. Keep that lockfile for repeatable builds.

If you accepted the my-api directory or used the commands above:

Terminal window
cd my-api
cargo run

Both starters serve GraphQL on POST /graphql and GraphiQL on GET /graphql at http://127.0.0.1:3000. Open GraphiQL and run:

{
hello(name: "Sheri")
}

Or send the request from another terminal:

Terminal window
curl -sS http://127.0.0.1:3000/graphql \
-H 'Content-Type: application/json' \
-H 'Accept: application/graphql-response+json' \
--data '{"query":"{ hello(name: \"Sheri\") }"}'

The response is:

{ "data": { "hello": "Hello, Sheri" } }

GraphiQL loads browser assets from esm.sh and needs network access. See Introspection and GraphiQL for UI and introspection settings.

  1. Define your API in schema/**/*.graphql.
  2. Run cargo build to generate contracts and synchronize src/resolvers.rs.
  3. Implement new resolver bodies and run the server.

Retained fields keep their existing resolver bodies. New fields receive unimplemented!() stubs, which you must implement before calling them. Deleting or renaming a field removes an untouched generated stub. If you edited its body, attributes, or comments, synchronization stops until you remove or migrate it.

After initialization, ordinary builds and runs use Cargo; the CLI is not needed for schema changes. The starter configures panic = "abort" in development and release builds, so calling an unimplemented resolver terminates the process. Return ResolverError for ordinary application errors.

These pages follow the source checkout from which this site is built; they do not describe a versioned release. Use docs.rs for the API reference of a published version.