98 lines
1.7 KiB
Markdown
98 lines
1.7 KiB
Markdown
# Music Portfolio
|
||
|
||
This project hosts a music portfolio with a **Node.js backend** serving music files and a **React frontend** displaying tracks. This guide explains how to run everything locally, convert music files to MP3, transfer files to your server, and set up the server with Nginx and SSL.
|
||
|
||
---
|
||
|
||
## Table of Contents
|
||
|
||
1. [Prerequisites](#prerequisites)
|
||
2. [Local Setup](#local-setup)
|
||
3. [Convert Music to MP3](#convert-music-to-mp3)
|
||
4. [Deploy to Server](#deploy-to-server)
|
||
5. [Server Setup](#server-setup)
|
||
6. [Nginx Configuration](#nginx-configuration)
|
||
|
||
---
|
||
|
||
## Prerequisites
|
||
|
||
* Node.js (v18+ recommended)
|
||
* npm / yarn
|
||
* Python3 + pip
|
||
* `pydub` Python library (for conversion)
|
||
* `ffmpeg` installed on both local and server machines
|
||
|
||
Install Python dependencies:
|
||
|
||
```bash
|
||
pip install pydub
|
||
```
|
||
|
||
Install Node dependencies in backend and frontend:
|
||
|
||
```bash
|
||
cd backend
|
||
npm install
|
||
|
||
cd ../frontend
|
||
npm install
|
||
npm run build
|
||
```
|
||
|
||
---
|
||
|
||
## Local Setup
|
||
|
||
### Backend
|
||
|
||
```bash
|
||
cd backend
|
||
node server.js
|
||
```
|
||
|
||
By default, the backend runs at:
|
||
|
||
```
|
||
http://localhost:3001
|
||
```
|
||
|
||
### Frontend
|
||
|
||
```bash
|
||
cd frontend
|
||
npm start
|
||
```
|
||
|
||
By default, the frontend runs at:
|
||
|
||
```
|
||
http://localhost:3000
|
||
```
|
||
|
||
---
|
||
|
||
## Convert Music to MP3
|
||
|
||
All music files must be in the `backend/music` folder. The project includes a Python script:
|
||
|
||
```bash
|
||
cd backend
|
||
python3 convert-to-mp3.py
|
||
```
|
||
|
||
This will:
|
||
|
||
* Convert `.flac`, `.wav`, `.m4a`, `.ogg` files to `.mp3`
|
||
* Delete the original files
|
||
* Keep the same filename but with `.mp3` extension
|
||
|
||
---
|
||
|
||
## Notes
|
||
|
||
* Make sure the backend is running before loading the frontend.
|
||
* Frontend calls `/api/tracks` to fetch metadata.
|
||
* All music files must be in `.mp3` format for consistent browser support.
|
||
* Clear browser cache if changes aren’t reflected immediately.
|