This project implements a modern web application architecture leveraging Cloudflare's edge computing capabilities. The architecture consists of three primary components:
- React Frontend: A Single Page Application (SPA) built with Create React App
- Cloudflare Workers: Serverless functions handling API integrations
- Cloudflare Pages: Static site hosting with global CDN distribution
- Node.js (v16.0.0 or higher)
- npm (v7.0.0 or higher)
- Cloudflare account
- Spotify Developer account
- Git
- Clone the repository:
git clone https://github.com/EndofTimee/My-website
cd personal-website
- Create a
.env
file in the root directory:
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
SPOTIFY_REDIRECT_URI=your_redirect_uri
- Install dependencies:
npm install
# Start React development server
npm start
# In a separate terminal, start the Cloudflare Worker
npx wrangler dev spotify-worker.js
The application will be available at:
- Frontend: http://localhost:3000
- Worker: http://localhost:8787
The project follows a modular component structure:
src/
├── components/
│ ├── SpotifyList/ # Spotify integration
│ ├── GithubRepos/ # GitHub repository display
│ ├── LoadingAnimation/ # Loading states
│ └── ParallaxEffect/ # Visual effects
├── App.js # Main application component
└── index.js # Application entry point
The project includes a PowerShell deployment script that handles both frontend and worker deployment:
npm run deploy
This script:
- Loads environment variables
- Installs dependencies
- Builds the React application
- Deploys to Cloudflare Pages
- Deploys the Spotify Worker
- Sets up environment secrets
If you need to deploy components individually:
- Frontend Deployment:
npm run build
npx wrangler pages deploy ./build
- Worker Deployment:
npx wrangler deploy spotify-worker.js
-
Build settings:
- Build command:
npm run build
- Build output directory:
build
- Node.js version: 16 (or higher)
- Build command:
-
Environment variables:
- Production branch:
main
- Preview branches:
dev/*
- Production branch:
Required environment secrets:
SPOTIFY_CLIENT_ID
SPOTIFY_CLIENT_SECRET
SPOTIFY_REDIRECT_URI
-
Worker Deployment Failures:
# Verify wrangler.toml configuration npx wrangler config # Check worker status npx wrangler tail
-
Build Issues:
# Clear dependency cache rm -rf node_modules npm clean-cache --force npm install
-
Environment Variables:
# Verify environment variables npx wrangler secret list
- Cloudflare Workers Documentation
- Cloudflare Pages Documentation
- Spotify Web API Documentation
- React Documentation
- Fork the repository
- Create a feature branch
- Commit changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.