Check out the live application -> https://spotify.trungk18.com
Spotify premium is required for the Web Playback SDK to play music. If you are using a free account, you can still browse the app, but it couldnβt play the music. Sorry about that π€£
If you like my work, feel free to:
Thanks a bunch for stopping by and supporting me!
I still remember Window Media Player on windows has the visualization when you start to play the music, and I wanted to have the same experience when listening to Spotify. That is the reason I started this project.
I found that there werenβt many resources on building a proper real-world scale application, and thatβs my focus for sharing. I made a Jira clone application as the first one for that purpose. Nx workspace is getting more and more attention from the Angular community, but people are always confused about how to architect and set up a Nx project. I hope Angular Spotify will give you more insight on that despite the fact that it is my first project using Nx π€£
You know I am one of the moderators of Angular Vietnam. Recently, I also started Angular Singapore. This piece of work is my another long-term plan to bring Angular knowledge to more people. I desire to advocate and grow the Angular developer community in Singapore and Vietnam :)
ngneat/svg-icon
and ngneat/until-destroy
tooltip
, modal
, slider
, switch
and more.I experimented with the ngrx/component store for AuthStore
and UIStore
. It might not be a best practice and I will refactor it very soon. Just FYI π€£
See my original notes on Nx workspace structure for NestJS and Angular
All components are following:
libs
folder. New modules, new models, new configurations, new components etcβ¦ are in libs. libs should be separated into different directories based on existing apps. We wonβt put them inside the apps folder. For example in an Angular, contains the main.ts
, app.component.ts
and app.module.ts
I followed the structure recommended by my friend @nartc. Below is the simplified version of the application structure.
.
βββ root
βββ apps
β βββ angular-spotify
βββ libs
βββ web (dir)
βββ shell (dir)
β βββ feature (angular:lib) - for configure any forRoot modules
β βββ ui
β βββ layout (angular:lib)
βββ playlist (dir)
β βββ data-access (angular:lib, service, state management)
β βββ features
β β βββ list (angular:lib PlaylistsComponent)
β β βββ detail (angular:lib PlaylistDetailComopnent)
β βββ ui (dir)
β βββ playlist-track (angular:lib, SCAM for Component)
βββ visualizer (dir)
β βββ data-access (angular:lib)
β βββ feature
βββ home (dir)
β βββ data-access (angular:lib)
β βββ feature (angular:lib)
β βββ ui (dir)
β βββ featured-playlists (angular:lib, SCAM for Component)
β βββ greeting (angular:lib, SCAM for Component)
β βββ recent-played (angular:lib, SCAM for Component)
βββ shared (dir)
βββ app-config (injection token for environment)
βββ data-access (angular:lib, API call, Service or State management to share across the Client app)
βββ ui (dir)
βββ pipes (dir)
βββ directives (dir)
βββ utils (angular:lib, usually shared Guards, Interceptors, Validators...)
I follow Implicit Grant Flow
that Spotify recommended for client-side only application and does not involve secret keys. The access tokens that are issued are short-lived, and there are no refresh tokens to extend them when they expire.
View the Spotify Authorization Guide
Angular Spotify Web Player
Nx provides an dependency graph out of the box. To view it on your browser, clone my repository and run:
npm run dep-graph
A simplified graph looks like the following. It gives you insightful information for your mono repo and especially helpful when multiple projects are depending on each other.
Having Nx Cloud configured shorten the deployment time quite a lot.
Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly. Visit Nx Cloud to learn more.
I set the tentative deadline for motivating myself to finish the work on time. Otherwise, It will take forever to complete :)
March 01 - 28, 2021
Let work on it together!
I scheduled a few live stream sessions to show you how I continue developing Angular Spotify. Follow my twitter for the latest updates. See the scheduled events.
# | Time | Description/Link |
---|---|---|
1 | Sat, 3rd April 2021, 10AM | Structure your Angular application with Nx workspace |
2 | Sat, 10th April 2021, 10AM | Build the album list page |
3 | Sat, 17th April 2021, 10AM | Build the album detail page |
4 | Sat, 24th April 2021, 10AM | Build the artist detail page |
5 | Sat, 1st May 2021, 10AM | Build the track list page |
6 | TBD | Setup i18n and support new language |
7 | TBD | Config Nx build:affected with Github action |
I will also do some refactoring with @nartc for Angular Vietnam Office Hours. More detail is coming soon.
It is a side project that I only spent time outside of the office hours to work on. I initially planned to complete the project within two weeks, but the first two weekends were not very productive, maybe because of the holiday mood from Lunar New Year :) But once the lego blocks are getting together, I feel the rhythm, and I know it has to be finished by the end of March.
I couldnβt get the full-time report from waka time because it only shows me the latest two weeks. π€£
I have spent approximately 50 hours working on this project, which is almost the same amount that I worked on the first version of jira.trungk18.com.
The visualizer was the most exciting feature, and I decided to start this project because of that single component.
Not all components have properly defined aria attributes, visual focus indicators, etc.
git clone https://github.com/trungvose/angular-spotify.git
cd angular-spotify
npm start
for starting Angular web applicationhttp://localhost:4200/
I skipped writing test for this project.
Web Playback SDK provided supports for Chrome, Firefox, Edge, IE 11, or above running on Mac/Windows/Linux.
It doesnβt support Safari or any mobile browser on Android or iOS
View completed list of supported browsers
If you have any ideas, just open an issue and tell me what you think.
If youβd like to contribute, please fork the repository and make changes as youβd like. Pull requests are warmly welcome.
Special thanks to my friend @nartc, who helped me review the code early.
Resource | Description |
---|---|
@koel/koel | A cool player made by @phanan, I reused the visualizer code from this repo with my additional customization |
beeman/component-store-playground | A nice example of using Nx with ngrx/component-store, I refer to the project structure from this repo |
Start using ngrx/effects for this | An excellent write up by Tim Deschryver |
Feel free to use my code on your project. Please put a reference to this repository.