Jakedrw.com Server Architecture

2026-05-15

hetnzer server. caddy

treeView-beta
    "packages"
        "mermaid"
            "src"
        "parser"



# JakeDrw
jakedrw.com, www.jakedrw.com, staging.jakedrw.com {
    reverse_proxy jakedrw:1999 {
        transport http {
            # Maximum performance settings
            keepalive 90s
            keepalive_idle_conns 1000
            max_conns_per_host 200
            compression off
            read_timeout 10s
            write_timeout 10s
        }
    }

    # Ultra-aggressive caching
    header {
        # Security
        X-Frame-Options DENY
        X-Content-Type-Options nosniff
        Referrer-Policy strict-origin-when-cross-origin
        X-XSS-Protection "1; mode=block"
        -Server

        # Performance headers
        Cache-Control "public, max-age=31536000, immutable" *.{png,jpg,jpeg,gif,ico,svg,woff,woff2,webp,avif}
	Cache-Control "public, max-age=86400" *.{html,css,js}
    }

    # Maximum compression
    encode {
        zstd
        gzip 9
        minimum_length 256
    }
}


    <div class="section-header">
        <h2>Contributions</h2>
    </div>

    {% block content_contributions %}{% endblock %}
    
    {% include "component/footer.html" %}



{% block content_contributions %}
<table class="dt">
    {% for contribution in contributions %}
    <tr>
        <td class="date">{{ contribution.3 }}</td>
        <td class="title">
            <a href="{{ contribution.1 }}" class="link">{{ contribution.0 }}</a> -
            <a href="{{ contribution.1 }}">{{ contribution.2 }}</a>
        </td>
    </tr>
    {% endfor %}
</table>
{% endblock %}


#[actix_web::main]
async fn main() -> std::io::Result<()> {
    let tera = Tera::new("templates/**/*").expect("Failed to load templates");

    println!("JakeDrw.com server started at http://0.0.0.0:1999");

    HttpServer::new(move || {
        App::new()
            .app_data(web::Data::new(common::structs::AppState { tera: tera.clone() }))
            .route("/", web::get().to(pages::index::index))
            .route("/notes/{slug}", web::get().to(pages::notes::note))
            .configure(pages::static_files::config)
            .default_service(web::to(|| HttpResponse::NotFound()))
    })
    .bind("0.0.0.0:1999")?
    .run()
    .await
}

pulldown_cmark


    let slug = path.into_inner();
    let file_path = format!("notes/{slug}.md");

    let markdown = match fs::read_to_string(&file_path) {
        Ok(content) => content,
        Err(_) => return HttpResponse::NotFound().body("Note not found"),
    };

    // Convert markdown to HTML
    let options = Options::all();
    let parser = Parser::new_ext(&markdown, options);
    let mut html_output = String::new();
    html::push_html(&mut html_output, parser);

    // Rewrite relative image paths to /static/assets/notes/{slug}/
    html_output = html_output.replace(
        "src=\"",
        &format!("src=\"/static/assets/notes/{slug}/"),
    );

    // Extract title from first heading
    let title = markdown.lines().next()
        .map(|l| l.trim_start_matches('#').trim().to_string())
        .unwrap_or_else(|| slug.clone());

    let mut ctx = tera::Context::new();
    ctx.insert("title", &title);
    ctx.insert("linked_header", &title);
    ctx.insert("content", &html_output);



  1. example of docker setup?
  2. actix
  3. markdown to html rules