Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/randomhashtags/destiny
Standalone Lightweight HTTP Server using Swift Macros for routing.
https://github.com/randomhashtags/destiny
http http-server server server-side-swift swift swift-macro swift-macros web-server
Last synced: 3 days ago
JSON representation
Standalone Lightweight HTTP Server using Swift Macros for routing.
- Host: GitHub
- URL: https://github.com/randomhashtags/destiny
- Owner: RandomHashTags
- License: apache-2.0
- Created: 2024-10-17T14:26:24.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-11T22:35:50.000Z (12 days ago)
- Last Synced: 2024-12-15T08:35:06.260Z (8 days ago)
- Topics: http, http-server, server, server-side-swift, swift, swift-macro, swift-macros, web-server
- Language: Swift
- Homepage:
- Size: 387 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Destiny
Destiny is a standalone lightweight web server that makes use of the latest Swift features to push performance to the absolute limits of the Swift Language, and designed to require the minimum amount of dependencies.
It provides a router (which is used via a Swift Macro) that accepts router groups, middleware and routes for processing requests.
Features like compression, embedded support, TLS, and Web Sockets are coming soon.
## Roadmap
- Custom hostname and port (Nov 8, 2024)
- Middleware and Routes (Nov 8, 2024)
- Register middleware/routes after starting server (Nov 8, 2024)
- Support multiple data representations (Nov 8, 2024)
- Routes with custom parameters (Nov 8, 2024)
- Configure settings via Command Line Arguments (Dec 11, 2024)
- CORS (Dynamic CORS implemented Dec 9, 2024)
- Redirects (Static Redirects implemented Dec 11, 2024)
- Router Groups
- Metric Middleware
- Queries
- Commands
- Preprocessor flags
- Data Validation (form, POST, etc)
- Authentication
- Compression
- Hybrid Routes
- TLS/SSL
- Web Sockets
- SIMD processing for headers
- Response streaming
- Support custom middleware & routes in default `#router`
- Support third-party macro expansions in `#router`
- Unit testing middleware/routes/requests
- Better handling of clients to unlock more throughput
- CSS & JavaScript minification (separate repo?)
- Swift-APNS (separate repo?)
- Embedded support## Getting started
coming soon...
### Command Line Arguments
Command Line Arguments are prefixed using double hyphens. Command Line Argument aliases are prefixed using a single hyphen.
hostname
Assign the hostname of the server.
- Aliases: `h`
- Usage: `--hostname `port
Assigns the port of the server.
- Aliases: `p`
- Usage: `--port `maxpendingconnections
Assigns the maximum pending connections the server can queue.
- Aliases: `mpc`
- Usage: `--maxpendingconnections `## Benchmarks
- Libraries tested
- [RandomHashTags/destiny](https://github.com/RandomHashTags/destiny) v0.1.0 (this library)
- [hummingbird-project/hummingbird](https://github.com/hummingbird-project/hummingbird) v2.1.0
- [vapor/vapor](https://github.com/vapor/vapor) v4.106.0### Static
Initial testing of a basic HTML response shows that this library has the lowest server latency and most consistent timings **when serving the same content**.
### Dynamic
Depends on how much dynamic content you add, but initial testing compared to a Static response cost only a few microseconds more (~10-50). I am actively researching and testing improvements.
### Conclusion
This library is the clear leader in reliability, performance and efficiency. Static content offer the best performance, while dynamic content still tops the charts.
## Contributing
Create a PR.