Git Product home page Git Product logo

cookbook's Introduction

Vaadin Cookbook

A collection of solutions to common use cases you run into when developing business web applications.

All solutions should be of the type "The user of my app wants to ..." and focus on functionality.

Solutions are implemented using Java, TS or a mix that is appropriate. The focus is on the solution, not how it is implemented.

The project is deployed at https://cookbook.vaadin.com/

General guidelines for recipes

Try to keep recipes short and show one thing. The focus is on the functionality which can be copy pasted to another project.

Try to keep recipes in one file. Use a few files if really needed. Use common sense.

Recipes cannot be wrong if they work but all recipes can be improved. It is better to improve an existing recipe than create another one which is almost the same.

Recipes are written in TS or Java. The Java version should be compatible with Vaadin 14. The TS version requires Vaadin 16+.

Contributing a Java UI based recipe

  1. If you want to avoid problems with other people contributing the same idea at the same time, create or find an issue describing the intent (one sentence is typically enough) and accept the issue
  2. Fork and clone the project
  3. Create a Java package for your recipe
mkdir src/main/java/com/vaadin/recipes/recipe/recipenamegoeshere/
  1. Create a Java file in the folder with the following
import com.vaadin.flow.router.Route;
import com.vaadin.recipes.recipe.Metadata;
import com.vaadin.recipes.recipe.Recipe;

@Route("recipe-name-goes-here")
@Metadata(
  howdoI = "Short (< 50) character explanation",
  description = "150-160 character description that is shown on the listing page and Google search results."
)
public class RecipeNameGoesHere extends Recipe {
}
  1. Code the recipe and test it. Start the project using mvn and you find your recipe at http://localhost:8080/recipe-name-goes-here

  2. If you created multiple files (Java or CSS), refer to them using the sourceFiles attribute of @Metadata

  3. If your recipe needs push, add tag={Tag.PUSH} to @Metadata. Add any other suitable tags also.

  4. Commit and create a PR

  5. Wait for 1-2 days for somebody to react to the PR

  6. Fix any potential comments

  7. ๐ŸŽ‰

Contributing a TS based recipe

  1. If you want to avoid problems with other people contributing the same idea at the same time, create or find an issue describing the intent (one sentence is typically enough) and accept the issue
  2. Fork and clone the project
  3. Create a TS folder for your recipe
mkdir frontend/recipe/recipe-name-goes-here/
  1. Create a TS file in the folder with the following
import { customElement, html } from "lit-element";
import { Recipe, recipeInfo } from "../recipe";

@recipeInfo({
  url: "recipe-name-goes-here",
  howDoI: "Short (< 50) character explanation",
  description: "150-160 character description that is shown on the listing page and Google search results."
})
@customElement("recipe-name-goes-here")
export class RecipeNameGoesHere extends Recipe {
  render() {
    return html`
      <div>Template goes here</div>
      `;
  }
}
  1. Code the recipe and test it. Start the project using mvn and you find your recipe at http://localhost:8080/recipe-name-goes-here

  2. If you created multiple files (TS or CSS), refer to them using the sourceFiles attribute of @recipeInfo

  3. Add any suitable tags to the tags part of @recipeInfo

  4. Commit and create a PR

  5. Wait for 1-2 days for somebody to react to the PR

  6. Fix any potential comments

  7. ๐ŸŽ‰

Running the project

In most cases you can run the project using

mvn

or by launching the Application class from an IDE.

If you want to run the project on a different port than 8080, you can do

PORT=9090 mvn

cookbook's People

Contributors

alvarezguille avatar anezthes avatar ansku avatar artur- avatar avec112 avatar benwilsoni avatar emarc avatar enver-haase avatar haijian-vaadin avatar hawksk avatar jcgueriaud1 avatar johannest avatar jouni avatar legioth avatar marcushellberg avatar mhosio avatar olafj avatar ollitietavainenvaadin avatar peppe avatar petrixh avatar samie avatar sebastiankuehnau avatar tarekoraby avatar tatulund avatar tomivirkki avatar vaadin-miki avatar

Watchers

 avatar

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.