Giter Club home page Giter Club logo

beats-app's Introduction

pwa-starter

Please use our main repository for any issues/bugs/features suggestion.

Documentation

The PWABuilder pwa-starter is our opinionated, best practices, production tested starter that we use to build all of our PWAs, including PWABuilder itself. The pwa-starter is a starter codebase, just like create-react-app or the Angular CLI can generate, that uses the PWABuilder team's preferred front-end tech stack:

  • lit: Our framework of choice. Lit gives us a way to write code that feels remarkably familiar to popular frameworks like React but that compiles down to browser native Web Components with a tiny runtime that provides things such as performant asynchronous rendering. Put plainly, Lit provides that great developer experience that we may be used to but without any sacrifice in either load-time performance or runtime performance.
  • @fluent/web-components: The Fluent Web Components are a set of UI components, just like Ionic, or the Material Design Web Components. These components help your app achieve the Fluent look and feel, ensuring your PWA feels native on Windows!
  • Vaadin Router: For routing, we use the Vaadin router. It is built with web components, has a tiny package size and all the features you expect from modern routers.
  • Shadow DOM, CSS Variables, Shadow Parts: Modern CSS is incredibly powerful, especially when combining the Shadow DOM, CSS variables and the Shadow Parts APIs. This provides a lot of the features we normally use a CSS pre-processor for, but without the extra complication that a CSS pre-processor adds to your build steps!
  • Rollup: Rollup is a "bundler" or build tool that will make working with NPM modules easy while also helping ensure our code is ready for production. Bundlers allows us to both optimize our app for production, such as minfiying our code for a faster load time, and to do things such as compile our TypeScript during development.
  • Workbox: Workbox is a tool that makes working with Service Workers easy! Service workers enable awesome capabilities such as enabling your PWA to work completely offline, to do push notifications and even sync data in the background when your app is not open!
  • TypeScript: TypeScript gives us features such as auto complete in our editors that helps make the development process easier, along with being perfect for working in a team because you can provide types for your APIs, making your code almost self-documenting.

You can find more details about it here.

Getting Started

First, you will need to install Git and a NodeJS environment on your device. Luckily, Windows makes it very easy to install and setup these tools Set up NodeJS on native Windows | Microsoft Docs.

Once you have Git and Node installed, you are now ready to grab a copy of the starter! First, you will need a Github account as we did above, which you can create at GitHub . Once you have a Github account you can then visit the code repository for the PWABuilder pwa-starter here .

Now, tap the green "Use this template" button and follow the directions on the local option:

A screenshot that shows the Local button on the pwa-starter Github repo

Development

The PWABuilder pwa-starter supports two different developer workflows:

In a browser tab

Run npm install and then run npm run dev, the starter should open in your default browser. From here you can start developing, your changes will be rebuilt and reloaded in the browser as you develop.

App-First workflow

Our app-first development workflow enables you to build your PWA while its running in its own app window, just like if a user has installed that app to their Windows device.

  • With your app open in VSCode, tap the Run button in the title bar and then tap Start Debugging. You can also click F5 on your keyboard.
  • This will run the development build and will open your PWA in its own window.
  • You can then start developing how your normally would, live reloads will simply reload the app in its own window.

Building for Production

Run npm run build, the dist/ folder will contain your built PWA. The production build will also generate a pre-caching service worker using Workbox.

Deployment and Packaging

Deployment

Once your PWA is ready to deploy we recommend Azure static website hosting for deploying your PWA.

Packaging

Many app stores, including the Microsoft Store and the Google Play Store support PWAs. To package your PWA for deployment to these app stores head back to https://pwabuilder.com/, put in your URL and hit Build My PWA.

Dual Screen support

The default layout of this starter is dual screen friendly. We do this here by using the CSS Spanning API to adjust the layout when the app is spanned on a dual screen device. As you start to build your PWA you can use these CSS features to ensure that your PWA looks good in all of the dual screen postures. For more info on developing PWAs for dual screen devices you can check out the Microsoft docs here.

Extensibility

NPM Modules

Any NPM module should work with the pwa-starter! Feel free top open an issue if a critical package you use does not work in the starter.

UI Libraries

Any UI library can be used with the PWABuilder pwa-starter! It is important to remember however that your choice of UI toolkit / components will have an effect on overall performance. Because of this, the team recommends choosing UI libraries that are built mainly as CSS classes (such as Bootstrap) or libraries built with Web Components such as the default UI toolkit for this starter, fluent-components. Other UI libraries that we recommend checking out:

Microsoft Graph Toolkit

The Microsoft Graph Toolkit is a collection of reusable, framework-agnostic web components and helpers for accessing and working with Microsoft Graph. The components are fully functional right of out of the box, with built in providers that authenticate with and fetch data from Microsoft Graph.

Authentication

For Authentication you can use the PWABuilder pwa-auth web component. This component lets your users sign-in/sign-up using their Microsoft, Google, or Facebook account. Your app receives their email address, name, and profile picture. Built with ❀ by the PWABuilder team.

😎 Bonus: It's super lightweight, pulling in the authentication libraries only when the user tries to sign-in with one.

😎😎 Double bonus: It uses the new Credential Management APIs to speed through sign-ins without bulky pop-ups or redirects.

Sample PWAs built with the starter!

More Resources

Folder Structure

pwa-starter
β”‚   README.md (docs)
β”‚   rollup.config.js (bundler config https://rollupjs.org/)
|   tsconfig.json (TypeScript config https://www.typescriptlang.org/)
|   pwabuilder-sw.js (Service Worker https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API)
|   package.json (https://docs.npmjs.com/creating-a-package-json-file)
|   package-lock.json (https://docs.npmjs.com/files/package-lock.json)
|   manifest.json (web manifest https://developer.mozilla.org/en-US/docs/Web/Manifest)
|   index.prod.html (index.html file used for production builds)
|   index.html (index.html for dev builds)
|   *note*: The index.prod.html registers a service worker which caches assets, so index.html is used for dev builds
|   .gitignore (git config file https://git-scm.com/docs/gitignore)
β”‚
└───src (most of your development will happen here)
β”‚   β”‚   global.css (used for global CSS styles and CSS variables)
β”‚   β”‚
β”‚   └───script
β”‚       β”‚
β”‚       |
|       └───components
|           |   header.ts (header component)
|       |
|       |
|       └───pages
|           |   app-index.ts (app-index component)
|           |   app-home.ts (app-home component)
|           |   app-about.ts (app-about component)

beats-app's People

Contributors

jgw96 avatar

Watchers

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