Application Types
In Sword, an application type is an execution engine that exposes an entry point for controllers. Each type is enabled by a feature and can run alongside the others in the same application.
Not every type talks to the outside world. Web, Socket.IO, gRPC, and NATS events handle external traffic, while Jobs and in-memory events do their work inside the process. All of them mount controllers as the entry point to your business logic.
Each application type is enabled by a feature, and you can add other features that extend it in its own context.
Web Application
The Web application type is enabled with the web feature:
[dependencies]
sword = { version = "0.6", features = ["web"] }You can build most of the patterns you would normally use in axum. To learn more about this application type, see Practical Guides > Web.
Complements
A web application can be extended with these features:
web-multipart: Enables support formultipart/form-datain HTTP controllers.web-validator: Enables input data validation in web controllers with thevalidatorcrate.web-swagger-ui: Enables Swagger UI to serve OpenAPI specifications.
Socket.IO Application
The Socket.IO application type is enabled with the socketio feature:
[dependencies]
sword = { version = "0.6", features = ["socketio"] }You can build most of the patterns you would normally use in socketioxide.
INFO
Since socketioxide requires the axum router, the web feature is enabled automatically when you use this application type.
Enabling this feature gives you the sword::socketio::* import as a prelude. To learn more about this application type, see Practical Guides > Socket.IO.
Complements
A Socket.IO application can be extended with these features:
socketio-validator: Enables input data validation in Socket.IO controllers with thevalidatorcrate.
gRPC Application
The gRPC application type is enabled with the grpc feature:
[dependencies]
sword = { version = "0.6", features = ["grpc"] }This application type lets you use most of the patterns you would normally use in tonic.
Enabling this feature gives you the sword::grpc::* import as a prelude. To learn more about this application type, see Practical Guides > gRPC.
Complements
A gRPC application can be extended with these features:
grpc-error-details: Enables access to theGrpcStatusstruct to build detailed gRPC errors.grpc-reflection: Enables gRPC reflection. Useful for service introspection with clients like grpcurl.
Scheduled Jobs Application
The jobs feature lets you declare controllers that run scheduled tasks with cron. It is enabled with:
[dependencies]
sword = { version = "0.6", features = ["jobs"] }To learn more, see Practical Guides > Jobs.
Events Application
An events application handles in-memory events and events from external sources such as NATS. It is enabled with the events feature:
[dependencies]
sword = { version = "0.6", features = ["events", "events-nats"] }Complements
You must enable at least one event adapter. Sword currently supports these adapters:
events-nats: Enables the NATS event adapter.events-memory: Enables the in-memory event adapter.
To learn more, see Practical Guides > Handling Events.

