{"id":26372641,"url":"https://github.com/odigij/simple-epoll-web-server-cpp","last_synced_at":"2025-03-17T01:18:30.100Z","repository":{"id":278391811,"uuid":"935223231","full_name":"odigij/simple-epoll-web-server-cpp","owner":"odigij","description":"Lightweight, experimental web server built in C++","archived":false,"fork":false,"pushed_at":"2025-03-16T11:43:41.000Z","size":240,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T12:36:38.918Z","etag":null,"topics":["cpp17","server","static-site","web"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/odigij.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-02-19T05:18:45.000Z","updated_at":"2025-03-16T11:43:44.000Z","dependencies_parsed_at":"2025-02-19T14:40:42.033Z","dependency_job_id":"e235fff5-0d34-4e2b-976c-f49c2286e7b3","html_url":"https://github.com/odigij/simple-epoll-web-server-cpp","commit_stats":null,"previous_names":["odigij/simple-epoll-web-server-cpp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odigij%2Fsimple-epoll-web-server-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odigij%2Fsimple-epoll-web-server-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odigij%2Fsimple-epoll-web-server-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odigij%2Fsimple-epoll-web-server-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/odigij","download_url":"https://codeload.github.com/odigij/simple-epoll-web-server-cpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243955799,"owners_count":20374373,"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":["cpp17","server","static-site","web"],"created_at":"2025-03-17T01:18:29.537Z","updated_at":"2025-03-17T01:18:30.083Z","avatar_url":"https://github.com/odigij.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Epoll Web Server (SEWS)\n\n## Warning\n\n**SEWS** is in **WIP**. There are many things to do. Everyone is welcome to contribute.\n\n## 📌 Description\n\n**SEWS** is a lightweight, experimental web server built in **C++** for learning and exploring web frameworks. It leverages **`sys/epoll`** for non-blocking, event-driven networking and is designed to be simple to use via **SSH on a remote server**. SEWS is **strictly single-threaded**, focusing on efficient I/O handling without multi-threading complexity.\n\nIt supports **HTTPS via OpenSSL** and serves **static files**, automatically generating **trie-based nodes** for files inside **`assets/public/static`** to optimize lookups. \n\n**Routing is fully customizable** via the `sews::initializeApp` function, allowing developers to define routes with support for **multiple paths and parameterized URLs** (manual parsing required for multiple parameters).\n\nWhile not as feature-rich as mainstream web frameworks, **SEWS provides a minimalistic and educational approach** to server development, making it ideal for experimenting with event-driven architectures and low-level networking.\n\n---\n\n## ✨ **Technical Features**\n| Feature | Description |\n|---------|------------|\n| **Epoll-based I/O** | Uses `epoll` for efficient event-driven networking, enabling non-blocking I/O operations. |\n| **Minimalist, Single-threaded Design** | SEWS is strictly single-threaded, leveraging `sys/epoll` for event-driven concurrency without multi-threading. |\n| **Command-Line Configuration** | Supports server configuration via CLI arguments at startup, allowing flexible initial setup. SEWS uses **JetBrains Mono font** and **Material Design Icons for logs**. |\n| **Static Content Serving** | Automatically detects and serves static files, generating **trie-based nodes** for assets in `assets/public/static`. |\n| **OpenSSL Integration** | Supports **HTTPS connections**, enabling secure communication. |\n| **Custom Routing System** | Allows defining routes via `sews::initializeApp`, supporting multiple paths and parameterized URLs (manual parsing required for multiple parameters). |\n\n---\n\n## ⚙️ **Command-Line Options**\nSEWS supports various command-line options for configuring server behavior at startup.\n\n| Option | Description | Example |\n|--------|-------------|---------|\n| `-p`   | Set the server’s listening port. | `./sews -p 8080` |\n| `-m`   | Define the maximum number of pending connections in the backlog queue before new requests are refused. | `./sews -m 128` |\n| `-e`   | Set the number of events that can be processed per epoll cycle. | `./sews -e 32` |\n| `-t`   | Specify the timeout (in milliseconds) for epoll waiting. | `./sews -t 500` |\n| `-f`   | Define additional configuration flags for advanced server behavior. | `./sews -f 0` |\n| `--help` | Show all available CLI options and their descriptions. | `./sews --help` |\n\n---\n\n## 🔧 **Build and Run Instructions**\n\n### **📌 Requirements**\n- **Linux OS** (or WSL if on Windows)\n- **C++17 or later**\n- **GCC or Clang compiler**\n- **CMake**\n- **OpenSSL**\n\n### 📌 Build and Run Instructions\n\n**Clone the Repository:**\n   ```bash\n   git clone https://github.com/odigij/simple-epoll-web-server-cpp.git\n   ```\n\n**Navigate to the Project Directory:**\n   ```bash\n   cd simple-epoll-web-server-cpp\n   ```\n\n**Create a Build Directory and Enter It:**\n   ```bash\n   mkdir build \u0026\u0026 cd build\n   ```\n\n**Generate Build Files with CMake:**\n   ```bash\n   cmake ..\n   ```\n\n**Compile the Project:**\n   ```bash\n   make\n   ```\n\n**(Optional) Generate an SSL Certificate for HTTPS:**\n   If you want to enable **HTTPS**, create a self-signed SSL certificate. The default flag option has been set to 1 to enable TLS. You may want to explicitly set it to 0 for HTTP (-f 0):\n   ```bash\n   openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -nodes\n   ```\n\n**Run SEWS:**\n   ```bash\n   ./sews (optionaly you may want to use \"./sews \u0026\" to run it in background)\n   ```\n   This starts the server in the background on port **8080** as default.\n\n**Check Available CLI Options:**\n   ```bash\n   ./sews --help\n   ```\n   This will display all supported command-line options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodigij%2Fsimple-epoll-web-server-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fodigij%2Fsimple-epoll-web-server-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodigij%2Fsimple-epoll-web-server-cpp/lists"}