/create-yew-app

Set up a modern Yew web app by running one command.

Primary LanguageRustApache License 2.0Apache-2.0

Create Yew App

Create Yew apps with no build configuration.

  • Creating an App – How to create a new app.
  • Yew - Rust / Wasm framework for building client web apps.
  • Awesome Yew - A curated list of awesome things related to Yew / WebAssembly.

Check out a live demo powered by Create Yew App.

Quick Overview

npx create-yew-app my-app
cd my-app
npm start

(npx comes with npm 5.2+ and higher, see instructions for older npm versions)

Then open http://localhost:8000/ to see your app.
When you’re ready to deploy to production, create a minified bundle with npm run build.

(demo.svg is created by termtosvg)

Get Started Immediately

You don’t need to install or configure tools like Webpack or Parcel.
They are preconfigured and hidden so that you can focus on the code.

Create a project, and you’re good to go.

Creating an App

You’ll need to have Node 8.16.0 or Node 10.16.0 or later version on your local development machine (but it’s not required on the server). You can use nvm (macOS/Linux) or nvm-windows to switch Node versions between different projects.

To create a new app, you may choose one of the following methods:

npx

npx create-yew-app my-app

(npx is a package runner tool that comes with npm 5.2+ and higher, see instructions for older npm versions)

npm

npm init yew-app my-app

npm init <initializer> is available in npm 6+

Yarn

yarn create yew-app my-app

yarn create <starter-kit-package> is available in Yarn 0.25+

Project structure

It will create a directory called my-app inside the current folder.
Inside that directory, it will generate the initial project structure and install the transitive dependencies:

my-app
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── static
│   ├── favicon.ico
│   ├── index.html
│   ├── index.ts
│   ├── logo.svg
│   └── styles.css
└── src
    ├── lib.rs
    ├── app.rs
    ├── components
    │   ├── nav.rs
    │   └── mod.rs
    └── routes
        ├── about.rs
        ├── home.rs
        └── mod.rs

No configuration or complicated folder structures, only the files you need to build your app.
Once the installation is done, you can open your project folder:

cd my-app

Inside the newly created project, you can run some built-in commands:

npm start or yarn start

Runs the app in development mode.
Open http://localhost:8000 to view it in the browser.

The page will automatically reload if you make changes to the code.
You will see the build errors and lint warnings in the console.

npm test or yarn test

Runs the test watcher in an interactive mode.
By default, runs tests related to files changed since the last commit.

npm run build or yarn build

Builds the app for production to the dist folder.
It correctly bundles Yew in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Your app is ready to be deployed.

Contributing

Feel free to take a look at the current issues in this repo for anything that currently needs to be worked on.

You are also welcome to open a PR or a new issue if you see something is missing or could be improved upon.

License

Apache License (Version 2.0)

See LICENSE for details.