MCPcopy Index your code
hub / github.com/ZihanType/predawn

github.com/ZihanType/predawn @0.9.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.9.0 ↗ · + Follow
710 symbols 1,199 edges 126 files 7 documented · 1%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Predawn

Crates.io version docs.rs docs

predawn is a Rust web framework like Spring Boot.

use predawn::{
    app::{run_app, Hooks},
    controller,
};
use rudi::Singleton;

struct App;

impl Hooks for App {}

#[tokio::main]
async fn main() {
    run_app::<App>().await;
}

#[derive(Clone)]
#[Singleton]
struct Controller;

#[controller]
impl Controller {
    #[endpoint(paths = ["/"], methods = [post])]
    async fn hello(&self, name: String) -> String {
        format!("Hello {name}")
    }
}

Features

  • Built-in OpenAPI support.
  • Automatic dependency injection.
  • Programmable configuration.

More examples can be found in the examples directories.

More complex example

use std::sync::Arc;

use async_trait::async_trait;
use predawn::{
    app::{run_app, Hooks},
    controller,
};
use rudi::Singleton;

struct App;

impl Hooks for App {}

#[tokio::main]
async fn main() {
    run_app::<App>().await;
}

#[async_trait]
trait Service: Send + Sync {
    fn arc(self) -> Arc<dyn Service>
    where
        Self: Sized + 'static,
    {
        Arc::new(self)
    }

    async fn hello(&self) -> String;
}

#[derive(Clone)]
#[Singleton(binds = [Service::arc])]
struct ServiceImpl;

#[async_trait]
impl Service for ServiceImpl {
    async fn hello(&self) -> String {
        "Hello, World!".to_string()
    }
}

#[derive(Clone)]
#[Singleton]
struct Controller {
    svc: Arc<dyn Service>,
}

#[controller]
impl Controller {
    #[endpoint(paths = ["/"], methods = [GET])]
    async fn hello(&self) -> String {
        self.svc.hello().await
    }
}

Credits

Extension points exported contracts — how you extend this code

ToSchema (Interface)
(no doc) [11 implementers]
predawn-schema/src/to_schema.rs
Plugin (Interface)
(no doc) [6 implementers]
predawn/src/plugin/mod.rs
ErrorExt (Interface)
(no doc) [25 implementers]
predawn-core/src/error_ext.rs
ParseField (Interface)
(no doc) [7 implementers]
predawn/src/extract/multipart/parse_field.rs
ResponseError (Interface)
(no doc) [25 implementers]
predawn-core/src/response_error.rs
Handler (Interface)
(no doc) [17 implementers]
predawn/src/handler/mod.rs
FromRequestHead (Interface)
(no doc) [6 implementers]
predawn-core/src/from_request.rs
Middleware (Interface)
(no doc) [4 implementers]
predawn/src/middleware/mod.rs

Core symbols most depended-on inside this repo

insert
called by 66
predawn/src/route.rs
join
called by 20
predawn/src/normalized_path.rs
extract_description
called by 19
predawn-macro/src/util.rs
generate_string_expr
called by 19
predawn-macro/src/util.rs
as_ref
called by 14
predawn-core/src/error.rs
build
called by 11
predawn/src/response/sse/event_stream.rs
into_inner
called by 10
predawn/src/path_params.rs
generate
called by 10
predawn-macro/src/tag.rs

Shape

Method 388
Function 137
Class 117
Enum 36
Interface 32

Languages

Rust100%

Modules by API surface

examples/hello-world/src/main.rs42 symbols
predawn/src/response_error.rs35 symbols
predawn/src/extract/path/de.rs26 symbols
predawn/src/response/sse/event_stream.rs17 symbols
predawn/src/handler/mod.rs17 symbols
predawn-core/src/request.rs17 symbols
predawn/src/response/download.rs15 symbols
predawn/src/response/sse/event.rs14 symbols
predawn-core/src/location.rs14 symbols
predawn/src/normalized_path.rs13 symbols
predawn/src/app.rs13 symbols
predawn-core/src/response_error.rs13 symbols

Datastores touched

(mysql)Database · 1 repos
workspaceDatabase · 1 repos

For agents

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

⬇ download graph artifact

Ask about this repo answers extend the page