Giter Club home page Giter Club logo

zapp's Introduction

ZAPP

Follow @EpicsDAO2

Zapp

Rust Serverless Framework

The Zapp project was launched with the goal of reducing software development, operation and maintenance costs.

Build Serverless Apps faster. Powered by Rust, Aysnc-GraphQL, SeaORM, Axum, and Google Cloud.

  • Focus on business logic in serverless environment
  • Maximize development efficiency with CI / CD standard schema-driven Scaffold
  • Achieve global scale with lower management costs

Dependency

Cloud Infrastructure

Document

Installation

$ cargo install zapp
$ zapp --help
zapp 0.5.6
EpicsDAO
Rust Serverless Framework

USAGE:
    zapp <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    compute    
    db         
    docker     
    g          
    gcloud     
    gh         
    help       Print this message or the help of the given subcommand(s)
    iam        
    init       
    new        
    run        
    sql        

QuickStart

Create your application with zapp CLI.

$ zapp new YOURAPP

  ███████╗ █████╗ ██████╗ ██████╗ 
  ╚══███╔╝██╔══██╗██╔══██╗██╔══██╗
    ███╔╝ ███████║██████╔╝██████╔╝
   ███╔╝  ██╔══██║██╔═══╝ ██╔═══╝ 
  ███████╗██║  ██║██║     ██║     
  ╚══════╝╚═╝  ╚═╝╚═╝     ╚═╝     
💃 💃 💃 💃 💃 💃 💃 💃 💃 💃 💃 💃 
Rust Serverless Framework
$ cd YOURAPP
$ zapp docker psql
$ cargo run

Go to : http://localhost:3000/api/graphql

Create Docker PostgreSQL

$ zapp docker psql
✅ PostgreSQL Container Created: 4619cfc047f3cad6c9db8d255aff841fbfe34bbef0e2661fa3a02db5d5ec5d91

Run GraphQL Local Server

$ cargo run

Now go to

http://localhost:3000/api/graphql

GraphQL Mutation/Query Scaffold

Create Model

$ zapp g model user
✅ Successfully created migration file: migration/src/m20220613_102512_create_user_table.rs
✅ Successfully added route to `migration/src/lib.rs`
✅ Successfully created entity file: entity/src/user.rs
✅ Successfully created mutation file: src/graphql/mutation/user.rs
✅ Successfully created query file: src/graphql/query/user.rs
✅ Successfully added route to `entity/src/lib.rs`
✅ Successfully added mutation route: src/graphql/mutation/mod.rs
✅ Successfully added mutation route: src/graphql/query/mod.rs

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/EpicsDao/zapp. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the Apache-2.0 License.

Code of Conduct

Everyone interacting in the EpicsDAO project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

zapp's People

Contributors

jonascir avatar poppin-fumi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

zapp's Issues

Add test for zapp command

currently, there's no test command.

It's time to add a test for zapp command

zapp --help shows each command.

[GEN] `sea-orm` uses migration based approach

General

seo-orm in general uses a migration based approach, which means that migrations provided by the developer are used to generate the entity code.

Since we are completely based on sea-orm we should follow this approach.

Proposed change

Introduce the following new gen commands:

  1. gen migration: Use sea-orm-cli migrate generate my_new_table -u programmatically
  2. gen model: Use sea-orm-cli migrate fresh programatically (we probably want a dedicated DB for generation and one DB for the user to tests its app)
  3. gen graphql: Use templating of GraphQL, later switch to Seaography

`zapp docker psql` does not work

Currently, running zapp docker psql throws an error. This is because the gcp config is parsed (and not present if you do not create it by hand). However, since this is creates a purely local container, forcing the devs to create such a config does not make sense.

Use `quote` to generate Rust code instead of string format

Hi there,
thank you for creating this project, it looks super useful!

While going through the code generation done in g, I noticed that the Rust code generation is done through plain string formatting. I also worked on a small project where I needed to generate Rust code and I resorted to this approach at first as well. However, I quickly ran into problems like code generation being dependent on conditionals quickly resulting in annoying string concatenations.

I decided to use the popular quote library to template Rust code in a clean manner, making my life a lot easier and the code cleaner to read (I also used prettyplease to auto-format the generated code).

Maybe this is helpful, but feel free to close if this project goes with the format approach.

My project is here for reference: https://github.com/JonasCir/java2rs

Format the repo

Currently, the repository is not correctly formatted:

  1. run cargo fmt
  2. introduce github action to reject unformatted PRs

[GEN] Rename `g` to `gen`

Currently, we abbreviate the generation command with g which is

  1. not intuitive
  2. the only command we abbreviate with one letter
  3. reads strange

I think we should be consistent and rename the command the gen throughout the code base,

Separate development and production env

Graphql Playground is only for development.

So we need to add ZAPP_ENV and separate the environment.

development: show graphql playground
production: rm graphql playground

Need to add `migration/src/lib.rs` generation method

pub use sea_orm_migration::prelude::*;

// Load module here;

pub struct Migrator;

#[async_trait::async_trait]
impl MigratorTrait for Migrator {
    fn migrations() -> Vec<Box<dyn MigrationTrait>> {
        vec![
            // Define migration file here;
        ]
    }
}

[CLI] Investigate/cleanup help option

Not certain how this is supposed to work: We always define the Help variant in commands in src/cli/mod.rs but do not match it in main.rs. I would assume that we can get rid of this variant and just let do clap its magic when an unknown command is encountered.

Probably something along these lines.


Edit: I just found #[clap(arg_required_else_help = true)].
Edit 2: we should bump clap to the most recent version

Remove async/await for now

Currently, async/await is used all over the place, however, it does not provide any advantage b/c we do not submit any task to an executor or used any concurrency.

I argue that we should selectively re-introduce it properly in parts where it actually makes sense.

You can refer to this resource to learn more.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.