README.md in shatter-rb-0.0.2 vs README.md in shatter-rb-0.1.0

- old
+ new

@@ -1,33 +1,91 @@ -# Shatter -TODO: Delete this and the text below, and describe your gem +![shatter-banner](https://user-images.githubusercontent.com/1334489/211411749-49d3377f-e413-4838-bae7-60705688b514.png#gh-light-mode-only) +![shatter-banner-darkmode](https://user-images.githubusercontent.com/1334489/211412250-0660c441-31f1-4d74-87f8-5118ccebffa0.png#gh-dark-mode-only) -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/shatter`. To experiment with that code, run `bin/console` for an interactive prompt. +<p align='center'> +An async first RPC app server built in Ruby. Supported by DRb, Puma, and Zookeeper. +</p> -## Installation -TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. +## Why -Install the gem and add to the application's Gemfile by executing: +Small apps are very common and RPC is a great simple alternative to REST, GraphQL, SOAP, and others. Shatter allows you to very simply, without too much opinion, define your business functions and invoke them with a premade HTTP endpoint. - $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG +## Whats needed -If bundler is not being used to manage dependencies, install the gem by executing: +* Ruby3.1 and later +* A box to run it on +* Zookeeper instance +* Optional: Extra server to run the service layer across different boxes. - $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG -## Usage +## Developing -TODO: Write usage instructions here +### Installation +Start with creating your project directory. +``` +mkdir MyApp +``` -## Development +Create a new Gemfile and `bundle install`. +```ruby +source "https://rubygems.org" -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +gem 'shatter-rb' +``` -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). +Create the project with: +``` +bundle exec shatter new <AppName> +``` +For now, app name should be in provided in UpperCamelCase. + +Init zookeeper with the required keys needed +```ruby +bundle exec shatter init_service_discovery +``` + + +Finally, you start shatter by running both the web server and service applications. + +```bash +bin/service +bin/server +``` + +Congrats! Shatter is up and running! + +### Testing things out + +Included in the setup is one example `HelloWorldFunction` to show you how things work. You can invoke it with curl like: + +``` +curl -i -X POST -d '{}' localhost:9292/hello_world +``` + +Check the `location` header in the response and follow that url till your response is ready. The Javascript client does all this for you, however. + + +You can check out a demo js script here: +https://github.com/EricRoos/shatter/blob/main/javascript/dist/demo.js + + + +### Front end things + +We suggest you use Vite to setup your front end. Shatter comes with the ability to export your functions to a typescript definition that will give you a configured out of the box client ready for use. No need for wiring yourself except for importing whats generated. + +You can generate your typescript with: + +``` + bundle exec shatter generate_typescript --path web/src/ +``` + +Assuming you have setup your javascript based front end at ./web + ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/shatter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/shatter/blob/master/CODE_OF_CONDUCT.md). ## License @@ -35,5 +93,9 @@ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct Everyone interacting in the Shatter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/shatter/blob/master/CODE_OF_CONDUCT.md). + +## Attribution + +Shatter logo provided by: <a href='https://pngtree.com/so/Beautiful'>Beautiful png from pngtree.com/</a>