{"id":13612512,"url":"https://github.com/aedm/esp32-s3-rust-axum-example","last_synced_at":"2025-04-13T12:32:03.973Z","repository":{"id":223652434,"uuid":"761089358","full_name":"aedm/esp32-s3-rust-axum-example","owner":"aedm","description":"Tokio + Axum running on ESP32-S3","archived":false,"fork":false,"pushed_at":"2024-08-12T20:38:50.000Z","size":46,"stargazers_count":27,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T08:12:07.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aedm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-21T08:11:15.000Z","updated_at":"2025-04-10T02:28:07.000Z","dependencies_parsed_at":"2024-11-07T20:43:47.130Z","dependency_job_id":null,"html_url":"https://github.com/aedm/esp32-s3-rust-axum-example","commit_stats":null,"previous_names":["aedm/esp32-s3-rust-axum-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aedm%2Fesp32-s3-rust-axum-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aedm%2Fesp32-s3-rust-axum-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aedm%2Fesp32-s3-rust-axum-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aedm%2Fesp32-s3-rust-axum-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aedm","download_url":"https://codeload.github.com/aedm/esp32-s3-rust-axum-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248714607,"owners_count":21149926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T20:00:30.950Z","updated_at":"2025-04-13T12:32:03.687Z","avatar_url":"https://github.com/aedm.png","language":"Rust","funding_links":[],"categories":["Projects"],"sub_categories":["`std`"],"readme":"# Rust + Tokio + Axum on ESP32-S3\n\nThis is an example application that demonstrates how to use Rust, Tokio and Axum to build a web server on the ESP32-S3 microcontroller.\n\n## Quick Start\n\nYou'll need tools:\n- `espup` - a tool to install the ESP32 toolchain and other tools\n- `cargo-espflash` - a tool to flash the ESP32\n\n```\ncargo install espup cargo-espflash\nespup install\n```\n\n### Build and run\n\n1. Set the WiFi credentials as environment variables. They will be baked into the executable at build time.\n    - `WIFI_SSID`\n    - `WIFI_PASS`\n2. This command builds the project and flashes it to the ESP32-S3:\n    ```sh\n    cargo espflash flash --release --monitor \n    ```\n\n### Test it\n\nOnce the ESP32-S3 is connected to your network, it displays the IP address on the serial console. The server runs on port 80.\n\n```sh\n$ curl http://192.168.0.24/state | jq\n{\n  \"counter\": 940,\n  \"free_heap\": 216452,\n  \"ip_address\": \"192.168.0.24\",\n  \"mac_address\": \"DC:DA:0C:2A:26:C8\",\n  \"message\": \"Hello from ESP32!\"\n}\n```\n\n## But is it any good?\n\nI mean, this is strapping rockets to a bicycle.\n\nIt works if you don't overload it. The ESP32-S3 is a microcontroller with limited resources. The web server can only handle a few requests at a time before it runs out of memory. \n\n### Ballpark numbers\n- 5 concurrent requests\n- 50 requests per second\n\nIf I go over ~5 concurrent requests, IDF runs out of memory and crashes. \n\nAxum wasn't designed for microcontrollers to put it mildly. It's actually a miracle it works at all. I did this for science. We do what we must because we can.\n\n\n### Alternatives\n\nBesides Axum, Warp also works. It uses somewhat less memory, so you can maybe throw a few more requests at it.\n\nAt the time of writing this, Rocket and Actix-web don't work since they require Tokio's `rt-multi-thread` feature which doesn't compile on EPS32 yet.\n\nHonestly, just use MQTT or something. It's a microcontroller, not a server.\n\n\n## Other ESP32 chips\n\nSee `.cargo/config.toml` for the list of supported chips. Set the `target` to the chip you're using. \n\n## Acknowledgements\n\nThis project is heavily inspired by Sami J. Mäkinen's [esp32temp](https://github.com/sjm42/esp32temp). Thanks for figuring out how to make this work!\n\n\n## License\n\nWhatever.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faedm%2Fesp32-s3-rust-axum-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faedm%2Fesp32-s3-rust-axum-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faedm%2Fesp32-s3-rust-axum-example/lists"}