Coder Social home page Coder Social logo

vugar005 / youtube-webapp-turborepo Goto Github PK

View Code? Open in Web Editor NEW
218.0 5.0 47.0 3.37 MB

Angular Youtube clone with Module Federation. Turborepo edition.

Home Page: http://youtube.vugar.app

TypeScript 68.94% JavaScript 4.95% HTML 13.26% SCSS 12.83% Shell 0.02%
angular module-federation microfrontend turborepo ngrx angular-material

youtube-webapp-turborepo's Introduction

Youtube microfrontend using Angular, Module Federation. Turborepo edition.

Youtube Angular brand

About Project


Disclaimer:

This is project is for education purpose only and was made to illustrate example of building microfrontend using Angular, Module Federation.


NOTE:

For version 14 with standalone components use 14.x branch
For version 13 without standalone components use 13.x branch

There is 1 host (shell) and 3 remote apps (watch-app, likes-app, history-app). Each app is deployed to different hosting storage.

There are 4 versions of source codes available:
๐Ÿ„ Turborepo (Current Repo)
๐Ÿ„Nx
๐Ÿ„Lerna
๐Ÿ„NextJs (without microfrontend)


NOTE:

Server side rendering is implemented only on Lerna and Turborepo edition


Features:

โœ… Multiple Angular applications on different domains
โœ… Shared UI components and utils
โœ… NgRx Store state management on each application
โœ… Communication between angular applications
โœ… Routing between applications
โœ… Server Side Rendering

And others:
โœ… Theming
โœ… Keyboard shortcuts

Mission:

My mission is to make complex microfrontend app to have many use cases for developers.

Demo: โ–ถ

NOTE:

Hosted application is using Turborepo edition repo


Getting Started ๐Ÿš€

Prerequisites

NodeJs: v18+

1- Install turbo globally:

npm install [email protected] -g

2- On root project install dependencies:

npm install

3- Start project and navigate to localhost:4200:

npm run serve

Or you can start in SSR mode:

npm run serve:ssr

Other commands: please see package.json for other commands.


NOTE:

In case of error that components are not exported from youtube/common-ui, on project root run command npm run clean:cache and then npm run serve


Tech Stack:

Angular Angular Material Angular Universal Angular Universal NgRx store NgRx store Turborepo

Tooling Tradeoffs

Here is my experience working with Lerna, Nx, and Turborepo. This can be inaccurate.

Lerna Nx Turborepo
Library support โœ…
Both same and different versions of libraries (such as Angular, RxJs)
โŒ
Monorepo only
โŒ
Monorepo only
Native (Angular CLI) โœ… โŒ
Uses Nx CLI
โœ…
Development efficiency โŒ
Slow. Rebuild on any changes to common packages such as UI
โœ…
Very fast
โœ…
Dependency graph โŒ
No graph
โœ…
Powerful
โœ…
Application configuration โŒ
  • Required change to angular.json
  • Switched to ngx-build-plus builders to support custom webpack config
โŒ
  • Required change to angular.json
  • Switched to Nx officially-supported builders to support custom webpack config
โŒ
  • Required change to angular.json
  • Switched to ngx-build-plus builders to support custom webpack config

Upgrade Guide

To upgrade angular applications. Example:

On root:

npx @angular/cli@13 update @angular/core@13 @angular/cli@13 --force

On each remote app:

ng update @angular/core --migrate-only=true --from=13 --to=14
ng update @angular/cli --migrate-only=true --from=13 --to=14

Common Questions

1- Why I pass data via Input to remote apps?
The microfrontends apps(such as history or likes app) are NOT meant to be dependent on shell app.The reason I put inputs there is that I did not want to create additional Rest API for this(or signals such as socketjs) since I waslazy. Nevertheless, there are some cases where putting data via Input is very useful such as the current app state(ex: current playing videoId). For example, in my case, I deliberately inform Shell app from video-app that that I click on Like button(in real life we would do this via API of course). Sole purpose of this to provide example for communication between apps.So I strongly agree that remote apps should not be dependent on shell app for Data and the only reason I put Input is to give example how can we pass data to remotes which could be done without Signals(socketjs) APIs. The rest cases should be done via APIs.

What is next?

Currently, the unit tests were not aded since the project was focused on main features such as module federation, managing state, intercommucation and so on. It can be started soon.

Backlog

  1. Add I18n translations
  2. Add secondary entry points for common-ui

Contribution guide ๐ŸŒด

Want to contribute to improve community app? Looking forward for pull requests. Let's get started :)

Supporting guide

Found repo useful? :) Let's star it โญ

References

Book: https://www.angulararchitects.io/en/book/
My blog: https://medium.com/p/258f331bc11e
Big thanks to https://github.com/manfredsteyer for his contribution for a lot of useful blogs + book for building microfrontend.

About author ๐ŸŒด๐ŸŒ๏ธ

Xtreme Junior Front end developer focused on nice architecture and long term webapps.

youtube-webapp-turborepo's People

Contributors

coly010 avatar vphilipnyc avatar vugar005 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

youtube-webapp-turborepo's Issues

Search error with empty value

Steps to reproduce:

  1. Open youtube.vugar.app
  2. Click on search input and type something without doing search
  3. Remove all what you typed
  4. Open console

Environment:
Google Chrome Stable/Dev 99

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.