├── README.md ├── backend ├── .editorconfig ├── .env.example ├── .eslintignore ├── .eslintrc.json ├── .gitignore ├── Procfile ├── babel.config.js ├── package.json ├── prettier.config.js ├── src │ ├── @types │ │ └── express.d.ts │ ├── app.ts │ ├── middlewares │ │ └── auth.ts │ ├── routes │ │ ├── artist.routes.ts │ │ ├── auth │ │ │ ├── callback.routes.ts │ │ │ └── sessions.routes.ts │ │ ├── index.ts │ │ ├── playlist.routes.ts │ │ └── user.routes.ts │ ├── server.ts │ ├── services │ │ └── api.ts │ └── utils │ │ └── GenerateRandomString.ts ├── tsconfig.json ├── yarn-error.log └── yarn.lock └── frontend ├── .editorconfig ├── .env.example ├── .eslintignore ├── .eslintrc.json ├── .gitignore ├── package.json ├── prettier.config.js ├── public ├── _redirects ├── favicon.ico ├── index.html └── robots.txt ├── setupTests.ts ├── src ├── App.tsx ├── assets │ ├── ball.svg │ ├── ed-sheeran.png │ ├── matheus.jpeg │ ├── paulo.png │ └── spotify-logo.svg ├── components │ ├── AnimatedVectors │ │ ├── BemConhecido.tsx │ │ ├── ChamandoAtencao.tsx │ │ ├── Estourando.tsx │ │ ├── Popular.tsx │ │ ├── PoucoEscutado.tsx │ │ ├── Seguidores.tsx │ │ └── data │ │ │ ├── eye.json │ │ │ ├── fire.json │ │ │ ├── ghost.json │ │ │ ├── heart.json │ │ │ ├── music.json │ │ │ └── star.json │ ├── Header │ │ ├── About │ │ │ ├── index.tsx │ │ │ └── styles.ts │ │ ├── Dropdown │ │ │ ├── index.tsx │ │ │ └── styles.ts │ │ ├── index.tsx │ │ └── styles.ts │ ├── LineGraphAnimated │ │ ├── index.tsx │ │ └── styles.ts │ ├── Modal │ │ ├── index.tsx │ │ └── styles.css │ ├── Scroll │ │ └── index.ts │ ├── Spinner │ │ ├── index.tsx │ │ └── styles.ts │ └── SpotifyButton │ │ ├── index.tsx │ │ └── styles.ts ├── hooks │ ├── auth.tsx │ └── index.tsx ├── index.tsx ├── pages │ ├── Artists │ │ ├── ModalArtist │ │ │ ├── index.tsx │ │ │ └── styles.ts │ │ ├── index.tsx │ │ └── styles.ts │ ├── Authenticate │ │ ├── index.tsx │ │ └── styles.ts │ ├── Error │ │ └── index.tsx │ ├── FavoriteTracks │ │ ├── index.tsx │ │ └── styles.ts │ ├── NotFound │ │ ├── index.tsx │ │ └── styles.ts │ ├── Playlists │ │ ├── ModalPlaylistTracks │ │ │ ├── index.tsx │ │ │ └── styles.ts │ │ ├── index.tsx │ │ └── styles.ts │ ├── SignIn │ │ ├── index.tsx │ │ └── styles.ts │ └── _layouts │ │ ├── auth │ │ ├── index.tsx │ │ └── styles.ts │ │ └── default │ │ ├── index.tsx │ │ └── styles.ts ├── react-app-env.d.ts ├── routes │ ├── Route.tsx │ └── index.tsx ├── services │ ├── api.ts │ └── history.ts ├── styles │ ├── animations.ts │ └── global.ts └── utils │ ├── audio.ts │ ├── formatValue.ts │ ├── getPopularity.ts │ └── toggleFullScreen.ts ├── tsconfig.json └── yarn.lock /README.md: -------------------------------------------------------------------------------- 1 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
17 | Sobre | 18 | Requisitos | 19 | Começando | 20 | Node.js | 21 | ReactJS 22 |
23 | 24 | ## :page_with_curl: Sobre 25 | Codify é uma aplicação criada a partir do [**Spotify’s Web API**](https://developer.spotify.com/documentation/web-api/) para coletar informações de sua conta Spotify. 26 | 27 | Nela o usuário tem acesso aos seus artistas mais escutados, músicas mais curtidas e suas playlists, dentre diversas outras curiosidades incríveis. 28 | 29 | Nesse projeto tivemos como principal objetivo aprender a consumir uma API externa e estudar toda a documentação por trás dela. Além disso, no processo tivemos que estudar sobre a biblioteca de Audio do JavaScript para podermos tocar músicas. 30 | 31 | **Node.js**: realiza todas as chamadas a API do Spotify e customizamos as respostas pra serem da forma que queremos. Serve todos os dados para o front-end. 32 | 33 | **ReactJS**: é uma página Web no qual o usuário terá acesso a informações da sua conta do Spotify. 34 | 35 | ## :books: Requisitos 36 | - Ter [**Git**](https://git-scm.com/) para clonar o projeto. 37 | - Ter [**Node.js**](https://nodejs.org/en/) instalado. 38 | - Ter [**Yarn**](https://classic.yarnpkg.com/pt-BR/docs/install/) instalado. 39 | - Ter credencias do Spotify. 40 | 41 | ## :lock: Credenciais do Spotify para rodar o projeto localmente 42 | 43 | Para você poder rodar o projeto localmente na sua máquina é preciso ter uma [**conta de desenvolvedor no Spotify**](https://developer.spotify.com/dashboard/) (para criar essa conta é totalmente gratuito e pode usar sua própria conta do Spotify). 44 | 45 | Com a conta criada basta clicar no botão **CREATE AN APP** e preencher os dados que forem pedidos. 46 | 47 | Após isso você terá acesso ao Dashboard da sua aplicação. No lado esquerdo estará suas credenciais, Client ID e Client Secret que serão usuadas para prencher o arquivo .env do backend. 48 | 49 | Por fim, no lado direito clique no botão **EDIT SETTINGS**. No modal que abrir haverá um compo chamado **Redirects URIs**, nele você irá preencher com a URL em que o seu backend estará rodando com a rota **/callback** (Ex: http://localhost:3333/callback). Após isso basta clicar em **SAVE**. 50 | 51 | ## :rocket: Começando 52 | ``` bash 53 | # Clonar o projeto: 54 | $ git clone https://github.com/TwoDevsForDevs/codify 55 | 56 | # Entrar no diretório: 57 | $ cd codify 58 | ``` 59 | 60 | ## :gear: Iniciando back-end 61 | ```bash 62 | # Entrar no diretório do back-end: 63 | $ cd backend 64 | 65 | # Instalar as dependências: 66 | $ yarn 67 | 68 | # Rodar a aplicação: 69 | $ yarn dev:server 70 | ``` 71 | 72 | ## :computer: Iniciando front-end 73 | ```bash 74 | # Entrar no diretório do front-end: 75 | $ cd frontend 76 | 77 | # Instalar as dependências: 78 | $ yarn 79 | 80 | # Rodar a aplicação: 81 | $ yarn start 82 | ``` 83 | 84 | Feito com ❤️ por [Matheus Pires](https://github.com/MatheusPires99) e [Paulo Henrique](https://github.com/paulohenriquepm) 👋🏻 85 | -------------------------------------------------------------------------------- /backend/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true -------------------------------------------------------------------------------- /backend/.env.example: -------------------------------------------------------------------------------- 1 | CLIENT_ID= 2 | CLIENT_SECRET= 3 | REDIRECT_URI= 4 | APP_URL=http://localhost:3000 -------------------------------------------------------------------------------- /backend/.eslintignore: -------------------------------------------------------------------------------- 1 | /*.js 2 | node_modules 3 | dist 4 | -------------------------------------------------------------------------------- /backend/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es6": true, 4 | "node": true 5 | }, 6 | "extends": [ 7 | "airbnb-base", 8 | "plugin:@typescript-eslint/recommended", 9 | "prettier/@typescript-eslint", 10 | "plugin:prettier/recommended" 11 | ], 12 | "globals": { 13 | "Atomics": "readonly", 14 | "SharedArrayBuffer": "readonly" 15 | }, 16 | "parser": "@typescript-eslint/parser", 17 | "parserOptions": { 18 | "ecmaVersion": 2018, 19 | "sourceType": "module" 20 | }, 21 | "plugins": [ 22 | "@typescript-eslint", 23 | "prettier" 24 | ], 25 | "rules": { 26 | "prettier/prettier": "error", 27 | "class-methods-use-this": "off", 28 | "@typescript-eslint/camelcase": "off", 29 | "no-useless-constructor": "off", 30 | "no-plusplus": "off", 31 | "@typescript-eslint/no-unused-vars": ["error", { 32 | "argsIgnorePattern": "_" 33 | }], 34 | "@typescript-eslint/interface-name-prefix": ["error", { "prefixWithI": "always" }], 35 | "import/extensions": [ 36 | "error", 37 | "ignorePackages", 38 | { 39 | "ts": "never" 40 | } 41 | ] 42 | }, 43 | "settings": { 44 | "import/resolver": { 45 | "typescript": {} 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /backend/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .vscode 3 | build 4 | .env 5 | dist -------------------------------------------------------------------------------- /backend/Procfile: -------------------------------------------------------------------------------- 1 | web:yarn start 2 | -------------------------------------------------------------------------------- /backend/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | ['@babel/preset-env', { targets: { node: 'current' } }], 4 | '@babel/preset-typescript' 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backend", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "scripts": { 7 | "build": "babel src --extensions \".js,.ts\" --out-dir dist --copy-files", 8 | "dev:server": "ts-node-dev --transpileOnly --ignore-watch node_modules src/server.ts", 9 | "start": "ts-node dist/server.js" 10 | }, 11 | "dependencies": { 12 | "axios": "^0.19.2", 13 | "cookie-parser": "^1.4.5", 14 | "cors": "^2.8.5", 15 | "dotenv": "^8.2.0", 16 | "express": "^4.17.1", 17 | "request": "^2.88.2", 18 | "spotify-web-api-node": "^4.0.0", 19 | "ts-node": "^8.10.2" 20 | }, 21 | "devDependencies": { 22 | "@babel/cli": "^7.10.3", 23 | "@babel/core": "^7.10.3", 24 | "@babel/node": "^7.10.3", 25 | "@babel/preset-env": "^7.10.3", 26 | "@babel/preset-typescript": "^7.10.1", 27 | "@types/cookie-parser": "^1.4.2", 28 | "@types/cors": "^2.8.6", 29 | "@types/express": "^4.17.6", 30 | "@types/request": "^2.48.4", 31 | "@types/spotify-web-api-node": "^4.0.1", 32 | "@typescript-eslint/eslint-plugin": "^2.31.0", 33 | "@typescript-eslint/parser": "^2.31.0", 34 | "eslint": "^6.8.0", 35 | "eslint-config-airbnb-base": "^14.1.0", 36 | "eslint-config-prettier": "^6.11.0", 37 | "eslint-import-resolver-typescript": "^2.0.0", 38 | "eslint-plugin-import": "^2.20.2", 39 | "eslint-plugin-prettier": "^3.1.3", 40 | "prettier": "^2.0.5", 41 | "ts-node-dev": "^1.0.0-pre.44", 42 | "typescript": "^3.8.3" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /backend/prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | singleQuote: true, 3 | trailingComma: "all", 4 | arrowParens: "avoid" 5 | }; 6 | -------------------------------------------------------------------------------- /backend/src/@types/express.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace Express { 2 | // eslint-disable-next-line @typescript-eslint/interface-name-prefix 3 | export interface Request { 4 | accessToken: string; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /backend/src/app.ts: -------------------------------------------------------------------------------- 1 | import 'dotenv/config'; 2 | 3 | import express from 'express'; 4 | import cors from 'cors'; 5 | import cookieParser from 'cookie-parser'; 6 | 7 | import routes from './routes'; 8 | 9 | const app = express(); 10 | 11 | app.use(cors()); 12 | app.use(cookieParser()); 13 | app.use(routes); 14 | 15 | export default app; 16 | -------------------------------------------------------------------------------- /backend/src/middlewares/auth.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response, NextFunction } from 'express'; 2 | 3 | import api from '../services/api'; 4 | 5 | export default function auth( 6 | request: Request, 7 | response: Response, 8 | next: NextFunction, 9 | ): void | Response