⚡Rust Serverless Framework

Overview

ZAPP

Follow @EpicsDAO

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.

Comments
  • Refactoring generate code method

    Refactoring generate code method

    @JonasCir made a great refactoring🎉 Let's update all the generation methods.

    Example:

    Old

    create_entity https://github.com/EpicsDAO/zapp/blob/main/src/g/entity.rs#L13

    Good create_migration https://github.com/EpicsDAO/zapp/blob/main/src/g/migration.rs#L16

    enhancement 
    opened by POPPIN-FUMI 4
  • Remove async/await for now

    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.

    enhancement 
    opened by JonasCir 3
  • Rafactor the generation module

    Rafactor the generation module

    Hey, this PR is a little bit bigger:

    • it splits the generation into its four parts: entity, mutation, graphql mutation, graphql query.
    • Each part has a function which takes care of file generation and registration to the corresponding mod.rs
    • Log output has been clarified
    • Most importantly: --path can now passed to the generation subcommand
    • ... which allows us to run integration tests against the g module now :)

    This way, you can rest assured that my refactoring does not break the generated files :smile:

    opened by JonasCir 3
  • Use `quote` to generate Rust code instead of string format

    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

    opened by JonasCir 3
  • Is there any way to include initial file in cargo package?

    Is there any way to include initial file in cargo package?

    opened by POPPIN-FUMI 2
  • Rewrite the new module such that nothing needs to be downloaded

    Rewrite the new module such that nothing needs to be downloaded

    Fixes #6

    @POPPIN-FUMI We now have a proper new command. PR features:

    1. No downloading of templates (you can remove the old Google storage now)
    2. The files we create are now stored as templates. We can easily tweak/improve them over time to our liking
    3. Generation of the migration is programmatically done through sea-orm-cli directly
    4. Integration testing has been become super convenient b/c of assert_directory_equality
    5. I cut down the files and content of the emitted to the bare minimum. I'm not a fan of feature-creep, if we notice that something is missing, we can simply add/improve it.

    Please note that generation (which would be the next step after running zapp new) is currently broken. This is due to the fact that a) the code we generate is not compatible with the sea-orm version we are pinning and b) sea-orm is migration based, so we need to switch this (gone file an issue about that later).

    opened by JonasCir 0
  • `zapp docker psql` does not work

    `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.

    opened by JonasCir 0
  • use quote for code generation

    use quote for code generation

    fixes #10

    all generation types (migration, entity, etc) are now in their dedicated module which is again split into creation and registration (i.e., write modules to mod.rs).

    Much cleaner now :rocket:

    opened by JonasCir 0
  • Need to add `migration/src/lib.rs` generation method

    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;
            ]
        }
    }
    
    opened by POPPIN-FUMI 0
  • [CLI] Investigate/cleanup help option

    [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

    opened by JonasCir 0
  • [GEN]  `sea-orm` uses migration based approach

    [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
    opened by JonasCir 0
  • [GEN] Rename `g` to `gen`

    [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,

    opened by JonasCir 0
  • [GEN] Do not depend on binaries, but invoke libraries directly

    [GEN] Do not depend on binaries, but invoke libraries directly

    I notice that we invoke binaries all over the place. Get rid of the invocation and use libraries instead.

    While this is a general problem, let's focus on the generation submodule first.

    There is an ongoing discussion in sea-orm how to use it functionally directly/programmatically.

    https://github.com/SeaQL/sea-orm/discussions/1036 https://github.com/SeaQL/sea-orm/issues/1047

    enhancement 
    opened by JonasCir 1
Owner
Epics
Buidl to Earn. $EPCT
Epics
A (flash) message framework for actix-web. A port to Rust of Django's message framework.

actix-web-flash-messages Flash messages for actix-web Web applications sometimes need to show a one-time notification to the user - e.g. an error mess

Luca Palmieri 31 Dec 29, 2022
A Rust web framework

cargonauts - a Rust web framework Documentation cargonauts is a Rust web framework intended for building maintainable, well-factored web apps. This pr

null 179 Dec 25, 2022
📮 An elegant Telegram bots framework for Rust

teloxide A full-featured framework that empowers you to easily build Telegram bots using the async/.await syntax in Rust. It handles all the difficult

teloxide 1.6k Jan 3, 2023
Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix 16.2k Jan 2, 2023
A rust web framework with safety and speed in mind.

darpi A web api framework with speed and safety in mind. One of the big goals is to catch all errors at compile time, if possible. The framework uses

null 32 Apr 11, 2022
A web framework for Rust.

Rocket Rocket is an async web framework for Rust with a focus on usability, security, extensibility, and speed. #[macro_use] extern crate rocket; #[g

Sergio Benitez 19.4k Jan 4, 2023
Rust / Wasm framework for building client web apps

Yew Rust / Wasm client web app framework Documentation (stable) | Documentation (latest) | Examples | Changelog | Roadmap | 简体中文文档 | 繁體中文文檔 | ドキュメント A

Yew Stack 25.8k Jan 2, 2023
Thruster - An fast and intuitive rust web framework

A fast, middleware based, web framework written in Rust

null 913 Dec 27, 2022
A full-featured and easy-to-use web framework with the Rust programming language.

Poem Framework A program is like a poem, you cannot write a poem without writing it. --- Dijkstra A full-featured and easy-to-use web framework with t

Poem Web 2.2k Jan 6, 2023
Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies

Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies, reactivity without a virtual DOM, and extreme customizability

arctic_hen7 1.2k Jan 8, 2023
Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.

Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.

null 3.6k Jan 6, 2023
Experiments with Rust CRDTs using Tokio web application framework Axum.

crdt-genome Synopsis Experiments with Rust CRDTs using Tokio web application framework Axum. Background Exploring some ideas of Martin Kleppmann, part

dougfort 3 Mar 18, 2022
A framework independent animation library for rust, works nicely with Iced and the others

anim A framework independent animation library for rust, works nicely with Iced and the others. Showcase How to install? Include anim in your Cargo.to

joylei 37 Nov 10, 2022
Implementation of the RealWorld backend API spec in Actix, Rust's powerful actor system and most fun web framework.

Actix codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API. ❗ (2021/05/13) This cod

Allen 475 Jan 2, 2023
Super Fast & High Performance minimalist web framework for rust

Super Fast & High Performance minimalist web framework for rust

null 6 Oct 12, 2022
A web framework for Rust programing language

kalgan A web framework for Rust programing language. Getting Started Create your project with cargo: cargo new project Add the dependency in Cargo.tom

Eduardo Casas 4 Jun 9, 2022
Demo of Rust and axum web framework

Demo of Rust and axum web framework Demonstration of: Rust: programming language that focuses on reliability and stability. axum: web framework that f

Joel Parker Henderson 115 Dec 29, 2022
JWT Authentication in Rust using Axum Framework

Are you interested in building a secure authentication system for your Rust web application? Look no further than the Axum framework and JSON Web Tokens (JWTs)! Axum is a fast and scalable Rust web framework that provides a reliable and efficient platform for developing microservices and APIs.

CODEVO 16 Jun 11, 2023
This is a simple Api template for Rust ( Axum framework )

Axum-Rust-Rest-Api-Template This project is an open source Rest Api Template built with Rust's Axum framework. Why this project? I have been learning

Thani 20 Jun 16, 2023