Installation
Install the NestForge CLI, set up your Rust project, and choose the features your application needs.
This page covers everything needed to go from zero to a running NestForge application.
Prerequisites
Section titled “Prerequisites”Before you start, make sure you have:
| Requirement | Notes |
|---|---|
| Stable Rust + Cargo | Install from rustup.rs |
| Git | Any recent version |
protoc | Only required if you use the gRPC feature |
Check your Rust version with:
rustc --version# rustc 1.75.0 (or later)Step 1: Install the CLI
Section titled “Step 1: Install the CLI”Install the NestForge CLI from crates.io:
cargo install nestforge-cliVerify the install worked:
nestforge --versionStep 2: Create a new project
Section titled “Step 2: Create a new project”Scaffold a new HTTP application:
nestforge new my-apicd my-apiThe generator creates the application bootstrap files at the root of src/:
my-api/ Cargo.toml .env .env.example src/ main.rs app_config.rs app_controller.rs app_service.rs app_module.rs health_controller.rsFeature folders such as src/users/ are generated later when you add modules or
resources.
Run it right away:
cargo runThe server starts on http://127.0.0.1:3000 by default.
Step 3: Understand your Cargo.toml
Section titled “Step 3: Understand your Cargo.toml”The generated Cargo.toml starts with only the core dependency:
[dependencies]nestforge = { version = "1", features = [] }tokio = { version = "1", features = ["full"] }anyhow = "1"axum = "0.7"serde = { version = "1", features = ["derive"] }serde_json = "1"NestForge is feature-gated. You only compile and link what you need.
Step 4: Choose your features
Section titled “Step 4: Choose your features”Enable features by adding them to your Cargo.toml:
[dependencies]nestforge = { version = "1", features = ["openapi"] }Here is the full feature reference:
| Feature | What it adds |
|---|---|
openapi | #[summary], #[tag], #[response] macros + docs mounting helpers |
config | ConfigModule, EnvSchema, load_config() for typed env config |
db | Db, connect_db() for SQL via sqlx |
orm | Repo, SqlRepo, EntityMeta on top of db |
graphql | graphql_router, GraphQlConfig, async_graphql re-export |
grpc | NestForgeGrpcFactory, GrpcContext, prost/tonic re-export |
websockets | websocket_router, WebSocketGateway, Message types |
microservices | MicroserviceRegistry, InProcessMicroserviceClient |
schedule | ScheduleRegistry, ScheduledJob, start_schedules(), shutdown_schedules() |
cache | CacheInterceptor, CachePolicy, cached_response_interceptor |
mongo | InMemoryMongoRepo, MongoConfig |
redis | InMemoryRedisStore, RedisConfig |
testing | TestFactory, TestingModule for integration tests |
data | Base data-layer trait; pulled in by cache, mongo, and redis |
Common feature combinations
Section titled “Common feature combinations”# REST API with OpenAPI docsnestforge = { version = "1", features = ["openapi", "config"] }
# REST API with a SQL databasenestforge = { version = "1", features = ["db", "orm", "openapi", "config"] }
# GraphQL APInestforge = { version = "1", features = ["graphql", "config"] }
# Full-stack transport appnestforge = { version = "1", features = ["openapi", "graphql", "websockets", "schedule", "config"] }Step 5: Verify the project builds
Section titled “Step 5: Verify the project builds”cargo checkYou should see no errors. If you see E0433 for unresolved items from nestforge, you likely need to add the corresponding feature flag.
What to read next
Section titled “What to read next”- Quick Start — build and run your first app
- CLI Workflow — current generator and export commands
- Feature Modules — how to add features to your app