A modern, interactive portfolio website built with SvelteKit, featuring real-time Discord presence, Spotify integration, and dynamic background effects.
Before you begin, ensure you have:
Clone the repository
git clone https://github.com/PHPxCODER/svelte-portfolio.git
cd svelte-portfolio
Install dependencies
npm install
# or
yarn install
# or
pnpm install
Set up environment variables
cp env.example .env
http://localhost:3000/callback (for development)Replace YOUR_CLIENT_ID in this URL and visit it:
https://accounts.spotify.com/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=http://localhost:3000/callback&scope=user-read-currently-playing%20user-read-recently-played%20user-top-read
Authorize the app and copy the code from the redirect URL
Get your refresh token by running this curl command (replace the values):
curl -H "Authorization: Basic BASE64_ENCODED_CLIENT_ID:CLIENT_SECRET" \
-d grant_type=authorization_code \
-d code=YOUR_CODE \
-d redirect_uri=http://localhost:3000/callback \
https://accounts.spotify.com/api/token
To encode your credentials to Base64:
echo -n "CLIENT_ID:CLIENT_SECRET" | base64
The response will contain your refresh_token
This project supports multiple Lanyard instances for Discord presence tracking. For new users, we recommend using the official public API.
.env file:LANYARD_ENDPOINT=https://api.lanyard.rest/v1/users
This project uses a self-hosted Lanyard instance running at https://api.phpxcoder.in by default.
.env:LANYARD_ENDPOINT=https://api.phpxcoder.in/v1/users
LANYARD_ENDPOINT in your .env file to point to your instanceThe weather feature uses a dynamic city value stored in Lanyard's KV (Key-Value) store:
For Public Lanyard API users: Join discord.gg/lanyard and use the bot command:
.set city YourCityName
Example: .set city Delhi
For Self-Hosted Instance users: Join the self-hosted server and use:
.set city YourCityName
Example: .set city Delhi
Available anywhere: You can update your city anytime using the bot command, and the weather will automatically update to your new location.
Note: The city KV value is used by the weather API to fetch location-specific weather data. Make sure to set it to a city name that OpenWeatherMap recognizes.
The weather feature dynamically fetches your location from Lanyard's KV store, so you don't need to hardcode your city.
.env fileThe weather will automatically update based on the city value you set in Lanyard's KV store.
Fill in your .env file with all the required values:
# Spotify Configuration
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
SPOTIFY_REFRESH_TOKEN=your_spotify_refresh_token
# Weather API
WEATHER_API_KEY=your_openweathermap_api_key
# Discord Configuration
DISCORD_USER_ID=your_discord_user_id
# Lanyard Configuration
# Option A: Public Lanyard API (Recommended for new users)
LANYARD_ENDPOINT=https://api.lanyard.rest/v1/users
# Option B: PHPxCODER's Self-Hosted Instance
# LANYARD_ENDPOINT=https://api.phpxcoder.in/v1/users
# Option C: Your own self-hosted instance
# LANYARD_ENDPOINT=https://your-lanyard-instance.com/v1/users
Update the following files with your information:
src/routes/(home)/+page.svelte:
src/routes/projects/+page.svelte:
src/lib/components/Meta.svelte:
src/app.postcsstailwind.config.cjssrc/fonts.postcssThe interactive particle background can be customized in src/routes/BackgroundEffect.svelte:
Start the development server
npm run dev
Open your browser
Navigate to http://localhost:5173
Make changes The app will automatically reload when you save files
Build the application
npm run build
Preview the build
npm run preview
This project uses @sveltejs/adapter-vercel by default. For other platforms:
svelte.config.js.set city YourCityName in the Lanyard Discord servernpm install to ensure all dependencies are installedtsconfig.jsonThis project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)If you encounter any issues or have questions:
Made with ❤️ by PHPxCODER