Skip to main content

Super framework for your super app

Project description

🤖 Zrb (Read: Zaruba) : A Super Framework for Your Super App

📖 Documentation | 🏁 Getting started

Zrb is a CLI-based automation tool and low-code platform. Once installed, you can automate day-to-day tasks, generate projects and applications, and even deploy your applications to Kubernetes with a few commands.

To use Zrb, you need to be familiar with CLI.

Zrb as a low-code framework

Let's see how you can build and run a CRUD application.

# Create a project
zrb project create --project-dir my-project --project-name "My Project"
cd my-project

# Create a Fastapp
zrb project add fastapp --project-dir . --app-name "fastapp" --http-port 3000

# Add library module to fastapp
zrb project add fastapp-module --project-dir . --app-name "fastapp" --module-name "library"

# Add entity named "books"
zrb project add fastapp-crud --project-dir . --app-name "fastapp" --module-name "library" \
    --entity-name "book" --plural-entity-name "books" --column-name "code"

# Add column to the entity
zrb project add fastapp-field --project-dir . --app-name "fastapp" --module-name "library" \
    --entity-name "book" --column-name "title" --column-type "str"

# Run Fastapp as monolith
zrb project start-fastapp --fastapp-run-mode "monolith"

You will be able to access the application by pointing your browser to http://localhost:3000

Furthermore, you can also run the same application as microservices, run the application as docker containers, and even doing some deployments into your kubernetes cluster.

# Run Fastapp as microservices
zrb project start-fastapp --fastapp-run-mode "microservices"

# Run Fastapp as container
zrb project start-fastapp-container --fastapp-run-mode "microservices"
zrb project stop-fastapp-container

# Deploy fastapp and all it's dependencies to kubernetes
docker login
zrb project deploy-fastapp --fastapp-deploy-mode "microservices"

You can visit our tutorials to see more cool tricks.

Zrb as a task-automation framework

Aside from the builtin capabilities, Zrb also allows you to define your automation commands in Python. To do so, you need to create/modify a file named zrb_init.py.

# filename: zrb_init.py
from zrb import runner, CmdTask, StrInput

hello = CmdTask(
    name='hello',
    inputs=[StrInput(name='name', description='Name', default='world')],
    cmd='echo Hello {{input.name}}'
)
runner.register(hello)

Once defined, your command will be instantly available from the CLI:

zrb hello
# or provide the parameter directly:
# zrb hello --name "Go Frendi"
Name [world]: Go Frendi
🤖 ○ ◷ 2023-09-18 07:37:40.849 ❁ 47932 → 1/3 🍌            zrb hello • Run script: echo Hello Go Frendi
🤖 ○ ◷ 2023-09-18 07:37:40.849 ❁ 47932 → 1/3 🍌            zrb hello • Working directory: /home/gofrendi/zrb/playground
🤖 ○ ◷ 2023-09-18 07:37:40.854 ❁ 47933 → 1/3 🍌            zrb hello • Hello Go Frendi
Support zrb growth and development!
☕ Donate at: https://stalchmst.com/donation
🐙 Submit issues/PR at: https://github.com/state-alchemists/zrb
🐤 Follow us at: https://twitter.com/zarubastalchmst
🤖 ○ ◷ 2023-09-18 07:37:40.899 ❁ 47933 → 1/3 🍌            zrb hello • Completed in 0.052213191986083984 seconds
To run again: zrb hello --name "Go Frendi"
Hello Go Frendi

To learn more about this, you can visit our getting started guide.

🫰 Installation

⚙️ In local machine

Installing Zrb in your system is as easy as typing the following command in your terminal:

pip install zrb

Just like any other Python package, you can also install Zrb in your virtual environment. This will allow you to have many versions of Zrb on the same computer.

⚠️ If the command doesn't work, you probably don't have Pip/Python on your computer. See Main prerequisites subsection to install them.

🐋 With docker

If you prefer to work with Docker, you can create a file named docker-compose.yml

version: '3'
networks:
  zrb:
    name: zrb
services:

  zrb:
    build:
      dockerfile: Dockerfile
      context: .
    image: docker.io/stalchmst/zrb:latest
    container_name: zrb
    hostname: zrb
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./project:/project
    networks:
      - zrb
    ports:
      - 3001:3001 # or/and any other ports you want to expose.

Once your docker-compose file is created, you can invoke the following command:

docker compose up -d

You will be able to access Zrb by using docker exec:

docker exec -it zrb zsh

✅ Main prerequisites

Since Zrb is written in Python, you need to install a few things before installing Zrb:

  • 🐍 Python
  • 📦 Pip
  • 🏝️ Venv

If you are using 🐧 Ubuntu, the following command should work:

sudo apt install python3 python3-pip python3-venv python-is-python3

If you are using 🍎 Mac, the following command will work:

# Make sure you have homebrew installed, see: https://brew.sh/
brew install python3
ln -s venv/bin/pip3 /usr/local/bin/pip
ln -s venv/bin/python3 /usr/local/bin/python

If you prefer Python distribution like conda, that might work as well.

✔️ Other prerequisites

If you want to generate applications using Zrb and run them on your computer, you will also need:

  • 🐸 Node.Js and Npm.
    • You need Node.Js to modify/transpile frontend code into static files.
    • You can visit the Node.Js website for installation instructions.
  • 🐋 Docker and Docker-compose plugin.
    • You need Docker and Docker-compose plugin to
      • Run docker-compose-based tasks
      • Run some application prerequisites like RabbitMQ, Postgre, or Redpanda.
    • The easiest way to install Docker, Docker-compose plugin, and local Kubernetes is by using Docker Desktop.
    • You can also install Docker and Docker-compose plugin by following the Docker installation guide.
  • ☸️ Kubernetes cluster.
    • Zrb allows you to deploy your applications into Kubernetes.
    • To test it locally, you will need a Minikube or other alternatives. However, the easiest way is by enabling Kubernetes on your Docker Desktop.
  • 🦆 Pulumi
    • You need Pulumi to deploy your applications

🏁 Getting started

We have a nice getting started guide to help you cover the basics. Make sure to check it out😉.

📖 Documentation

You can visit Zrb documentation for more detailed information.

☕ Donation

Help Red Skull to click the donation button:

🎉 Fun fact

Madou Ring Zaruba (魔導輪ザルバ, Madōrin Zaruba) is a Madougu which supports bearers of the Garo Armor. (Garo Wiki | Fandom)

Madou Ring Zaruba on Kouga's Hand

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zrb-0.0.102.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zrb-0.0.102-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

Details for the file zrb-0.0.102.tar.gz.

File metadata

  • Download URL: zrb-0.0.102.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for zrb-0.0.102.tar.gz
Algorithm Hash digest
SHA256 1e4915b99d0ed19f7ddca946c34fdb0a7da20b0953543b1a71a17d109ae66f0b
MD5 85517b4a8df60575195275c81a21b144
BLAKE2b-256 5104545aa862f497bc0313ca15cd6780716c133cd23a12b938ee3ee45f07af06

See more details on using hashes here.

File details

Details for the file zrb-0.0.102-py3-none-any.whl.

File metadata

  • Download URL: zrb-0.0.102-py3-none-any.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for zrb-0.0.102-py3-none-any.whl
Algorithm Hash digest
SHA256 0ac772c049148400428853769f95c78112bcf3b752244c6af00d6fa07ff14468
MD5 1c4dda9c7837289ff7222f42c9ccae76
BLAKE2b-256 eb5e1806ecfbeba131f2d026138256a36c52356e890712d5f497d583580495b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page