{"id":24905780,"url":"https://github.com/denver-code/corex","last_synced_at":"2026-02-23T16:34:11.755Z","repository":{"id":275052935,"uuid":"924932236","full_name":"denver-code/corex","owner":"denver-code","description":"CoreX is a modular API framework for building extensible systems in Rust. ","archived":false,"fork":false,"pushed_at":"2025-01-30T22:58:28.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-12T13:06:31.470Z","etag":null,"topics":["api","axum","rust","tokio","web"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/corex-api","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/denver-code.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":"2025-01-30T22:34:20.000Z","updated_at":"2025-01-30T23:00:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"b82f9fbc-f8bf-46fd-bcd7-5bcb7a3091f6","html_url":"https://github.com/denver-code/corex","commit_stats":null,"previous_names":["denver-code/corex"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/denver-code/corex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denver-code%2Fcorex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denver-code%2Fcorex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denver-code%2Fcorex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denver-code%2Fcorex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denver-code","download_url":"https://codeload.github.com/denver-code/corex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denver-code%2Fcorex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29748222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api","axum","rust","tokio","web"],"created_at":"2025-02-02T00:25:12.296Z","updated_at":"2026-02-23T16:34:11.727Z","avatar_url":"https://github.com/denver-code.png","language":"Rust","readme":"# CoreX\n\n**CoreX** is a modular API framework for building extensible systems in Rust. It allows you to create a core system and extend its functionality through plugins (extensions). This crate is designed to be simple, flexible, and easy to use, making it ideal for building modular web applications.\n\n---\n\n## Features\n\n- **Modular Design**: Extend the core system with plugins (extensions).\n- **Easy to Use**: Simple API for registering extensions and running the server.\n- **Asynchronous**: Built on top of `axum` and `tokio` for high-performance asynchronous operations.\n- **Extensible**: Add custom routes, middleware, and functionality through extensions.\n\n---\n\n## Installation\n\nAdd `corex-api` to your `Cargo.toml`:\n\n```toml\n[dependencies]\ncorex-api = \"0.1.0\"\n```\n\n---\n\n## Usage\n\n### 1. Define an Extension\n\nCreate an extension by implementing the `ExtensionTrait`:\n\n```rust\nuse axum::{Router, routing::get, response::Json};\nuse serde_json::json;\nuse corex_api::{CoreX, ExtensionTrait};\nuse std::sync::Arc;\n\nstruct AuthExtension;\n\nimpl ExtensionTrait for AuthExtension {\n    fn name(\u0026self) -\u003e \u0026'static str {\n        \"AuthExtension\"\n    }\n\n    fn extend(\u0026self, router: Router) -\u003e Router {\n        router.route(\"/auth\", get(|| async { Json(json!({ \"message\": \"Auth endpoint\" })) }))\n    }\n}\n```\n\n### 2. Register Extensions and Run the Server\n\nUse the `CoreX` system to register extensions and start the server:\n\n```rust\n#[tokio::main]\nasync fn main() {\n    let mut core = CoreX::new(\"127.0.0.1\".to_string(), 3000);\n    core.register_extension(Arc::new(AuthExtension));\n    core.run().await;\n}\n```\n\n### 3. Test the Endpoints\n\nStart the server and test the endpoints:\n\n```bash\ncurl http://localhost:3000/auth\n```\n\nResponse:\n\n```json\n{\n  \"message\": \"Auth endpoint\"\n}\n```\n\n---\n\n## Example: Multiple Extensions\n\nYou can register multiple extensions to extend the core system:\n\n```rust\nstruct ExampleExtension;\n\nimpl ExtensionTrait for ExampleExtension {\n    fn name(\u0026self) -\u003e \u0026'static str {\n        \"ExampleExtension\"\n    }\n\n    fn extend(\u0026self, router: Router) -\u003e Router {\n        router.route(\"/example\", get(|| async { Json(json!({ \"message\": \"Example endpoint\" })) }))\n    }\n}\n\n#[tokio::main]\nasync fn main() {\n    let mut core = Core::new(\"127.0.0.1\".to_string(), 3000);\n    core.register_extension(Arc::new(AuthExtension));\n    core.register_extension(Arc::new(ExampleExtension));\n    core.run().await;\n}\n```\n\nTest the endpoints:\n\n```bash\ncurl http://localhost:3000/auth\ncurl http://localhost:3000/example\n```\n\n---\n\n## Example: Remote Extension  \nYou can import extensions from github repositories:\n\n```toml\n[dependencies]\nauth-extension = { git = \"https://github.com/denver-code/auth-extension\" }\n```\n\nAnd register the extension in your main file as usual:\n\n```rust\nuse auth_extension::AuthExtension;\nuse corex::CoreX;\nuse std::sync::Arc;\n\n#[tokio::main]\nasync fn main() {\n    let host = \"0.0.0.0\".to_string();\n    let port = 3000;\n    let mut core = CoreX::new(host, port);\n\n    core.register_extension(Arc::new(AuthExtension));\n\n    core.run().await;\n}\n\n```\n\n## API Documentation\n\n### `CoreX`\n\n- **`new(host: String, port: u16)`**: Creates a new Core system.\n- **`register_extension(extension: Arc\u003cdyn ExtensionTrait\u003e)`**: Registers an extension.\n- **`build() -\u003e Router`**: Builds the final router by applying all registered extensions.\n- **`run()`**: Starts the server and listens for incoming requests.\n\n### `ExtensionTrait`\n\n- **`name() -\u003e \u0026'static str`**: Returns the name of the extension.\n- **`extend(router: Router) -\u003e Router`**: Extends the router with additional routes or middleware.\n\n---\n\n## Running Tests\n\nTo run the tests, use the following command:\n\n```bash\ncargo test\n```\n\n---\n\n## Contributing\n\nContributions are welcome! If you'd like to contribute, please:\n\n1. Fork the repository.\n2. Create a new branch for your feature or bugfix.\n3. Submit a pull request.\n\n---\n\n## License\n\nThis project is licensed under:\n\n- **MIT License** ([LICENSE-MIT](LICENSE-MIT))\n\n---\n\n## Acknowledgments\n\n- Built on top of [`axum`](https://github.com/tokio-rs/axum) and [`tokio`](https://github.com/tokio-rs/tokio).\n- Inspired by modular and plugin-based architectures.\n\n---\n\n## Questions?\n\nIf you have any questions or need help, feel free to open an issue or reach out to the maintainers.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenver-code%2Fcorex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenver-code%2Fcorex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenver-code%2Fcorex/lists"}