# webezy

webezyio is free and open-source project that aims to be a complete framework for developing micro-services projects.
The underlying communication protocol is [```HTTP2```](https://en.wikipedia.org/wiki/HTTP/2) and for serialization and deserialization is [```protobuf```](https://developers.google.com/protocol-buffers/docs/pythontutorial).
It utulize those communication protocol, message serialization / deserialization and code generator with [```gRPC```](https://grpc.io) opensource project by google. 

Get full explanation and many more details on usage at [```webezy.io```](https://www.webezy.io).


# Installation
Install from pip
```sh
pip install webezyio
```

# Sub-modules

* builder - A command-pattern module for easy interacting with webezy.json
* cli - A CLI interface module for webezy
* coder - A pluggable API for all code generating methods
* commons - Common modules and methods, such as retrieving and modifying protos

# Project Structure

Every webezy.io project should look like the following schema:

> __Note:__ For simplicity we use for this example 1 service (`SampleService`) and 1 package (`SamplePackage`)
```sh
# Root dir of your project
my-project/
├─ bin/ # Some executable scripts
├─ clients/ # All clients code in multiple languages if specified
│  ├─ python/
│     ├─ client.py
├─ server/ # Server file
│  ├─ server.py
├─ protos/ # Proto defintions files
│  ├─ SampleService.proto
│  ├─ Samplepackage.proto
├─ service/ # Service file and protos compiled files
│  ├─ protos/
│  │  ├─ SampleService_pb2.py
│  │  ├─ SampleService_pb2_grpc.py
│  │  ├─ SamplePackage_pb2.py
│  │  ├─ SamplePackage_pb2_grpc.py
│  ├─ SampleService.py
├─ .gitignore
├─ README.md
```

# Docs

Go to [Webezy.io Docs](https://www.webezy.io/docs) for full explanation.

## Quick Start 

> __Note:__ Please refer to [CLI docs](https://www.webezy.io/docs/cli) for any question you got, also make sute to use the CLI help `webezy --help` should give you an additional information on every command you may possibly run

To create a new webezy.io project run the following command:
```sh
webezy new <YourProject>
```

Then you will need to navigate into your project

> __Note:__ if you didnt specified the `--path` argument when creating new project by default it will create a project under your current directory

```sh
cd <YourProject>
```

After you are under the new project directory you can go ahead and create webezy.io resources with those simple commands:

> __Note:__ Please note that every sub-command of `generate` and `new` can be shortend with the first letter e.g : `wz g p` is equivalent to `wz generate package`

```sh
# Generate new package to hold messages
webezy generate package
# Generate new service to hold RPC's (Methods)
webezy generate service
# Generate message under specified package
webezy generate message
# Generate RPC (Method) under specified service
webezy generate rpc
```
> __Note:__ Make sure before creating new RPC on service that you have imported at least 1 package to be used by the service. for more information visit -> [Package Docs](https://www.webezy.io/docs/tutorials/import-packages)


After you had generated your resources for the project and modified the code (See the docs for more explanation on how to develop your project and make changes [Sample Project](https://www.webezy.io/docs/tutorials/sample-project)).

You can now build your project and run your server with those simple commands:

```sh
# First build your project
webezy --build
# Then run the server
webezy --run
```

> __Note:__ you can auto-build your resources if applicable straight when you are generating them with adding `--build` argument to `webezy generate` comands.

You can use now your client code that has been autogenerated in your specified language(s) on creating the project.

> __Pro-Tip:__ you can always make your commands even shorter with replacing `webezy` with `wz`


### Dev-docs
You can build the auto generated docs from the webezyio modules.
It will generate module and function documnetations based on DocsString written on code.

```sh
cd ./docs && make html
```

Open ```./docs/build/html/index.html``` in a browser.