Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zewo/zewo
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.
https://github.com/zewo/zewo
buildpack concurrency coroutines fibers green-threads heroku non-blocking server-side-swift slack swift swiftenv swiftpm synchronous-apis xcode zewo
Last synced: about 1 month ago
JSON representation
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.
- Host: GitHub
- URL: https://github.com/zewo/zewo
- Owner: Zewo
- License: mit
- Created: 2015-11-06T03:41:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-03-26T16:31:25.000Z (over 4 years ago)
- Last Synced: 2024-10-09T14:01:08.988Z (about 1 month ago)
- Topics: buildpack, concurrency, coroutines, fibers, green-threads, heroku, non-blocking, server-side-swift, slack, swift, swiftenv, swiftpm, synchronous-apis, xcode, zewo
- Language: Swift
- Homepage: http://zewo.io
- Size: 5.4 MB
- Stars: 1,854
- Watchers: 64
- Forks: 88
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Why Zewo?
• Support
• Community
• Contributing# Zewo
**Zewo** is a lightweight library for web applications in Swift.
## What sets Zewo apart?
Zewo is **not** a web framework. Zewo is a lightweight library for web applications in Swift. Most server-side Swift projects use Grand Central Dispatch (**GCD**) as the concurrency library of choice. The drawback of using GCD is that its APIs are **asynchronous**. With async code comes **callback hell** and we all know it, it's no fun.
Node.js is the best example of how callbacks can be frustrating. Express.js creator **TJ Holowaychuk** wrote a blog post about [Callback vs Coroutines](https://medium.com/@tjholowaychuk/callbacks-vs-coroutines-174f1fe66127#.3l3pf1xqf) in 2013 and one year later [left the Node.js community](https://medium.com/@tjholowaychuk/farewell-node-js-4ba9e7f3e52b#.okwqsltyx) in favor of Go. There were many reasons for that but one of the main reasons was the concurrency model. Sure we have futures and promises and functional reactive programming. They all mitigate the problem, but the async nature of the code will always be there.
At **Zewo** we use **coroutines**. Coroutines allow concurrency while maintaining **synchronous** APIs. We all learn how to program with synchronous code. We're used to reason about our code synchronously. Being able to use synchronous APIs makes the code much more readable and understandable. Coroutines are also **faster** than threads, because they live in user-space, unlike threads which are managed by the kernel.
Our implementation of **coroutines** (which is based on [libdill](https://github.com/sustrik/libdill)) is **single-threaded**. This means that you don't have to worry about **locks** or **race conditions**. So your code is **safer** by default. To use all the CPU power available all you have to do is to replicate the work according to the number of logical CPUs available. As an example, this could mean running as many processes of your server as cores in your machine. **Rob Pike**, one of the creators of Go had a talk called [Concurrency is not Parallelism](https://www.youtube.com/watch?v=cN_DpYBzKso) that explains this concept **very** well. Go also has the philosophy:
```
Don't communicate by sharing memory. Share memory by communicating.
```Like Go, instead of sharing memory and handling state we promote the use of [CSP](https://en.wikipedia.org/wiki/Communicating_sequential_processes)-style concurrency using channels. This pattern brings the abstractions used on the development of distributed systems closer to the way we're used to think about communication. It also aligns well with Swift's mindset of immutability and value types. All of these things contributes to a distinct experince on the server-side Swift.
With **Zewo** you get:
* Go-style concurrency
* Synchronous APIs
* Incredible performance
* Safer applications
* Scalable systems
* Cleaner code
* Proper error handling
* No callback hell
* No race conditions## Support
If you have **any** trouble create a Github [issue](https://github.com/Zewo/Zewo/issues/new) and we'll do everything we can to help you. When stating your issue be sure to add enough details and reproduction steps so we can help you faster. If you prefer you can join our [Slack](http://slack.zewo.io) and go to the **#help** channel too.
## Community
We have an amazing community of open and welcoming developers. Join us on [Slack](http://slack.zewo.io) to get to know us!
## License
All **Zewo** modules are released under the MIT license. See [LICENSE](LICENSE) for details.
[slack-image]: http://s13.postimg.org/ybwy92ktf/Slack.png
[slack-url]: http://slack.zewo.io