puerto 0.9.0

Puerto — Rust full-stack DDD framework CLI. Scaffolds Clean Architecture projects with auto-wired DI, SQLx support, and zero manual wiring. Formerly puerto-framework.
mod api;
mod generated;

use poem::{Server, listener::TcpListener};

const BANNER: &str = r#"
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    ***********   ++++++++++++   =============
    %#*******##%%%#**********#%%%%++++++++++*%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      ****###########%%%%%%%%%%%%%%%%%%%%%%%
  *****************************        ****
  ***********     ***********************
   *                     ***************
                                *****

    H  A  R  B  O  R"#;

#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
    dotenvy::dotenv().ok();

    tracing_subscriber::fmt()
        .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
        .init();

    if std::env::var("HARBOR_BANNER").as_deref() != Ok("false") {
        println!("{}", BANNER);
        println!("    v{}\n", env!("CARGO_PKG_VERSION"));
    }

    let port = std::env::var("SERVICE_PORT")
        .ok()
        .and_then(|p| p.parse::<u16>().ok())
        .unwrap_or(8080);

    Server::new(TcpListener::bind(format!("0.0.0.0:{port}")))
        .run(generated::bootstrap::build_app().await)
        .await
}