A modern, performant portfolio website showcasing data engineering expertise, built with SvelteKit and deployed on Cloudflare Pages with Server-Side Rendering (SSR).
Live Site: https://krishnanandanil.com
@sveltejs/adapter-cloudflaremy-portfolio/
āāā src/
ā āāā lib/
ā ā āāā components/
ā ā ā āāā home/ # Homepage components
ā ā ā ā āāā HeroSection.svelte
ā ā ā ā āāā MetricsGrid.svelte
ā ā ā ā āāā FeaturedProjects.svelte
ā ā ā ā āāā ProjectFilter.svelte
ā ā ā ā āāā TechStack.svelte
ā ā ā ā āāā ContactCTA.svelte
ā ā ā āāā ui/ # Reusable UI components
ā ā ā āāā SEO.svelte
ā ā ā āāā StructuredData.svelte
ā ā ā āāā ThemeToggle.svelte
ā ā āāā stores/
ā ā ā āāā theme.ts # Theme management
ā ā āāā data/
ā ā āāā portfolio-data.ts # Personal data configuration
ā āāā routes/
ā ā āāā +page.svelte # Homepage (prerendered)
ā ā āāā +page.ts # Page load function
ā ā āāā +layout.svelte # Root layout with SEO
ā ā āāā api/
ā ā ā āāā github/
ā ā ā āāā projects/+server.ts # SSR API
ā ā ā āāā stats/+server.ts # SSR API
ā ā āāā sitemap.xml/
ā ā āāā +server.ts # Dynamic sitemap (prerendered)
ā āāā app.html # HTML template
ā āāā app.css # Global styles
ā āāā app.d.ts # TypeScript definitions
āāā static/
ā āāā favicon.png # 192x192 favicon
ā āāā apple-icon.png # 180x180 Apple touch icon
ā āāā manifest.json # PWA manifest
ā āāā robots.txt # SEO robots file
ā āāā humans.txt # Credits file
ā āāā llms.txt # LLM context file
ā āāā screenshots/ # PWA screenshots
āāā svelte.config.js # SvelteKit configuration
āāā tailwind.config.js # Tailwind configuration
āāā tsconfig.json # TypeScript configuration
āāā vite.config.ts # Vite configuration
āāā package.json
Clone the repository:
git clone https://github.com/sudo-krish/my-portfolio.git
cd my-portfolio
Install dependencies:
npm install
Create environment file:
cp .env.example .env
Configure .env:
VITE_GITHUB_TOKEN=ghp_your_github_personal_access_token_here
PUBLIC_SITE_URL=https://krishnanandanil.com
Get GitHub Token: GitHub Settings ā Developer Settings ā Personal Access Tokens
Update personal data:
// Edit src/lib/data/portfolio-data.ts
export const portfolioData = {
personal: {
name: 'Your Name',
title: 'Your Title',
// ... update all fields
}
}
# Start dev server
npm run dev
# Open in browser
# http://localhost:5173
# Build for production
npm run build
# Preview production build
npm run preview
Install Wrangler:
npm install -g wrangler
Login to Cloudflare:
wrangler login
Build the project:
npm run build
Deploy:
wrangler pages deploy .svelte-kit/cloudflare --project-name krishnanandanil-portfolio
Set environment variable:
wrangler pages secret put GITHUB_TOKEN --project-name krishnanandanil-portfolio
# Paste your GitHub token when prompted
Push to GitHub:
git add .
git commit -m "Initial commit"
git push origin main
Connect to Cloudflare Pages:
Configure Build Settings:
Framework preset: SvelteKit
Build command: npm run build
Build output directory: .svelte-kit/cloudflare
Root directory: /
Add Environment Variables:
GITHUB_TOKEN (encrypted)Custom Domain (Optional):
krishnanandanil.com// svelte.config.js
import adapter from '@sveltejs/adapter-cloudflare';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
const config = {
preprocess: vitePreprocess(),
kit: {
adapter: adapter(),
prerender: {
entries: ['/', '/sitemap.xml'],
crawl: false,
handleHttpError: ({ path, message }) => {
if (path.startsWith('/api/')) return;
console.warn(`Prerender warning: ${path} - ${message}`);
},
origin: 'https://krishnanandanil.com'
}
}
};
export default config;
Local Development (.env):
VITE_GITHUB_TOKEN=ghp_xxxxx
PUBLIC_SITE_URL=https://krishnanandanil.com
Production (Cloudflare Dashboard):
GITHUB_TOKEN=ghp_xxxxx (Encrypted)
// src/app.d.ts
declare global {
namespace App {
interface Platform {
env?: {
GITHUB_TOKEN?: string;
};
}
}
}
export {};
Endpoint: /api/github/projects
Endpoint: /api/github/stats
// src/lib/stores/theme.ts
// Default: Dark mode
// Toggle: Light/Dark with localStorage persistence
// tailwind.config.js
theme: {
extend: {
colors: {
border: 'hsl(var(--border))',
background: 'hsl(var(--background))',
foreground: 'hsl(var(--foreground))',
primary: 'hsl(var(--primary))',
// ... customize as needed
}
}
}
// src/lib/data/portfolio-data.ts
export const portfolioData = {
personal: { /* ... */ },
experience: [ /* ... */ ],
projects: [ /* ... */ ],
skills: [ /* ... */ ],
certifications: [ /* ... */ ]
};
# Development
npm run dev # Start dev server
npm run build # Build for production
npm run preview # Preview production build
npm run check # Type checking
npm run check:watch # Type checking (watch mode)
npm run lint # Lint code
# Deployment
wrangler login # Login to Cloudflare
wrangler pages deploy .svelte-kit/cloudflare --project-name krishnanandanil-portfolio
Issue: Property 'env' does not exist on type 'Platform'
src/app.d.ts has proper type definitionsIssue: GitHub API rate limits
GITHUB_TOKEN environment variableIssue: 404 on API routes
adapter-cloudflare is installed and configuredIssue: Environment variables not working
platform?.env?.GITHUB_TOKEN in API routesMIT License - feel free to use this for your own portfolio!
Krishnanand Anil
For inquiries or collaboration opportunities, reach out via:
Made with ā¤ļø using SvelteKit and Cloudflare Pages
```Save this as README.md in your project root. It covers everything about your portfolio including setup, deployment, configuration, and troubleshooting! šāØ