Hello NestForge GraphQL
What the GraphQL-first example includes, how it boots, and what users should study first.
Run the example
Section titled “Run the example”Example location:
examples/hello-nestforge-graphqlRun it from the repository root:
cargo run -p hello-nestforge-graphqlThe example exposes:
- GraphiQL at
http://127.0.0.1:3001/ - GraphQL at
http://127.0.0.1:3001/graphql
Example purpose
Section titled “Example purpose”This example shows the smallest GraphQL-first application in the workspace while still using the NestForge module and config model.
Files included
Section titled “Files included”The example currently includes:
src/main.rssrc/app_module.rssrc/app_config.rssrc/graphql/mod.rssrc/graphql/schema.rs
Recommended reading order
Section titled “Recommended reading order”Read the example in this order:
src/app_module.rssrc/graphql/schema.rssrc/main.rs
What each file does
Section titled “What each file does”src/main.rs
Section titled “src/main.rs”Bootstraps the app through NestForgeFactory::<AppModule>::create(), resolves
AppConfig, builds the GraphQL schema, and mounts:
/graphql- GraphiQL at
/
It listens on port 3001.
src/app_module.rs
Section titled “src/app_module.rs”Registers config as a provider and exports it for downstream use. There are no HTTP controllers because GraphQL is the primary transport.
src/app_config.rs
Section titled “src/app_config.rs”Implements FromEnv and provides the default app name for the example.
src/graphql/schema.rs
Section titled “src/graphql/schema.rs”Defines:
QueryRootMutationRootUserandCreateUserInput- an in-memory
UserStore build_schema(app_name)
What users learn from this example
Section titled “What users learn from this example”This example teaches:
- how to mount GraphQL without traditional controllers
- how to feed app configuration into schema construction
- how to use an in-memory store for resolver examples
- how to separate module wiring from schema logic
What is intentionally not included
Section titled “What is intentionally not included”This example is deliberately small. It does not try to demonstrate:
- advanced auth
- custom GraphQL context extraction from NestForge providers
- database-backed resolvers
- multi-module GraphQL composition
Use it as a transport bootstrap reference, then move to a larger application structure as your schema grows.
What to verify
Section titled “What to verify”When running the example, verify:
- the schema is built with app config injected into it
/serves GraphiQL/graphqlserves the API- seeded users can be queried and created