MCPcopy Index your code
hub / github.com/HFQR/xitca-web

github.com/HFQR/xitca-web @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
4,670 symbols 14,393 edges 520 files 1,008 documented · 22%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

xitca-web

Readme | GitHub | Documentation

GitHub code size in bytes Maintenance

A HTTP library and web framework written in 100% safe Rust with zero-copy serialization/deserialization support

Table of Contents

Features

  • Supports HTTP/1.x, HTTP/2 and HTTP/3.
  • Powerful request routing with optional opt-in macros
  • Full Tokio compatibility
  • Cross crate integration with Tower.
  • Client/server WebSockets support
  • Transparent content compression/decompression (br, gzip, deflate, zstd)
  • Multipart streams
  • Static assets
  • SSL support using Xitca-tls or rustls
  • Middlewares (Logger, Tracing, etc)

⬆️ Back to Top

Minimum Supported Rust Version

The latest release of the crate supports 1.85 and above rust versions.

⬆️ Back to Top

Quick Start

For a list of other examples, see: Examples

To get started using Xitca-web add the following code to your main.rs file:

use xitca_web::{handler::handler_service, middleware::Logger, route::get, App};

async fn index() -> &'static str {
    "Hello world!!"
}

fn main() -> std::io::Result<()> {
    App::new()
        .at("/", get(handler_service(index)))
        .enclosed(Logger::new())
        .serve()
        .bind("localhost:8080")?
        .run()
        .wait()
}

And then add the following dependencies to your Cargo.toml file:

xitca-web = { version = "*" , features = ["logger"]}

And then run the application/server using cargo run command and it should start the server/application on http://127.0.0.1:8080. Open your prefered browser and navigate to the address on which the server has started and you should see a hello world!! message appear.

[!Warning] The project is still not stable. So expect breaking changes to appear at any time.

⬆️ Back to Top

FAQ (Frequently Asked Questions)

Why Yet Another HTTP Library and Framework?

The primary reason behind creating Xitca-web is to provide more memory safe framework which uses 100% safe rust. As well as to provide a framework which provides its own HTTP library, async IO abstraction, tls integration and a database driver all in one package with a low-memory footprint, less synchronization overhead between threads, a very small dependency tree and with good interoperability between with other async frameworks like tokio, async-std, etc and with crates like Tower and HTTP. Additionally, the following HTTP library and framework was built to provide a simple and compact code base with easier to understand and adoptable API both internally and externally and to provide the choice to the user to opt-out of macro usage when using xitca-web which can greatly improve build/compile times by eliminating the extra proc-macro build/compile step.

⬆️ Back to Top

More Contributors Wanted

We are looking for more willing contributors to help grow this project. For more information on how you can contribute, check out the project board and the CONTRIBUTING.md file for guidelines and rules for making contributions.

⬆️ Back to Top

Supporting Xitca-web

For full details and other ways you can help out, see: Contributing

If you use Xitca-web and would like to contribute to its development, we're glad to have you on board! Contributions of any size or type are always welcome, and we will always acknowledge your efforts.

Several areas that we need a bit of help with at the moment are:

  • Documentation: Help improve and write documentation for different features.
  • Logo: Help create a logo for the project.
  • Submit a PR to add a new feature, fix a bug, update the docs, or anything else.
  • Star Xitca-web on GitHub.

⬆️ Back to Top

Documentation

[!Note] We welcome any contributions to the documentation as this will benefit everyone who uses this project.

⬆️ Back to Top

Roadmap

Coming soon!.

⬆️ Back to Top

Contributing

Contributions are welcome from anyone. It doesn't matter who you are; you can still contribute to the project in your own way.

Not a developer but still want to contribute?

Check out this video by Mr. Nick on how to contribute.

Developer

If you are a developer, have a look at the CONTRIBUTING.md document for more information.

⬆️ Back to Top

License

xitca-web is licensed under the APACHEv2 license.

⬆️ Back to Top

Credits

We would like to thank the following people for their contributions and support:

Contributors

Stargazers

⬆️ Back to Top


Thank you for Visiting

Extension points exported contracts — how you extend this code

Service (Interface)
trait for composable http services. Used for middleware, resolver and tls connector. [117 implementers]
client/src/service/mod.rs
AsVersion (Interface)
A helper trait for get a protocol from certain types. [8 implementers]
http/src/version.rs
Execute (Interface)
Defining how a query is executed. can be used for customizing encoding, executing and database data decoding. For custo [33 …
postgres/src/execute.rs
ReadyService (Interface)
Extend trait for [Service](crate::Service). Can be used to cehck the ready state of a service before calling it. # Exa [29 …
service/src/ready/mod.rs
Body (Interface)
An asynchronous streaming body composed of [`Frame`]s. Each frame is either a [`Frame::Data`] carrying payload bytes or [28 …
http-body/src/body.rs
AsyncIo (Interface)
A wrapper trait for an [AsyncRead]/[AsyncWrite] tokio type with additional methods. [6 implementers]
io/src/io/poll.rs
IoBuf (Interface)
An `io-uring` compatible buffer. The `IoBuf` trait is implemented by buffer types that can be used with io-uring operat [7 …
tokio-uring/src/buf/io_buf.rs
ChunkVectoredUninit (Interface)
[Buf::chunks_vectored] method but take slice of `MaybeUninit ` instead of `T` [5 implementers]
unsafe_collection/src/bytes/uninit.rs

Core symbols most depended-on inside this repo

map_err
called by 198
service/src/service/ext.rs
map
called by 187
web/src/app/mod.rs
now_or_panic
called by 150
unsafe_collection/src/futures.rs
as_mut
called by 133
unsafe_collection/src/bytes/limit.rs
get_mut
called by 128
tokio-uring/src/buf/slice.rs
iter
called by 107
router/src/params.rs
headers_mut
called by 105
client/src/request.rs
len
called by 80
io/src/bytes.rs

Shape

Method 2,655
Function 1,098
Class 648
Enum 158
Interface 111

Languages

Rust99%
TypeScript1%

Modules by API surface

http/src/h3/proto/qpack/dynamic.rs78 symbols
web/src/handler/types/params.rs55 symbols
postgres/src/config.rs55 symbols
http/src/h2/proto/flow.rs51 symbols
http/src/h2/proto/frame/headers.rs49 symbols
http/src/h1/proto/trasnder_coding.rs49 symbols
postgres/src/error.rs45 symbols
http/src/h3/proto/headers.rs40 symbols
http/src/h2/proto/hpack/encoder.rs39 symbols
http/src/util/service/router.rs38 symbols
http/src/h3/proto/frame.rs38 symbols
http/src/h3/proto/qpack/decoder.rs36 symbols

Datastores touched

postgresDatabase · 1 repos
bench_dbDatabase · 1 repos
dbDatabase · 1 repos
your_database_nameDatabase · 1 repos

For agents

$ claude mcp add xitca-web \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact