Foliox is an AI-powered portfolio generator that automatically creates beautiful developer portfolios from GitHub profiles. It fetches your GitHub data, uses AI to generate professional summaries and highlights, and presents everything in a modern, responsive portfolio website.
- Automatic Portfolio Generation: Enter any GitHub username and get a fully-featured portfolio instantly
- AI-Powered Content: Uses Groq AI to generate professional summaries, highlights, and SEO-optimized descriptions
- GitHub Integration: Fetches profile data, repositories, contribution graphs, and project statistics via GitHub GraphQL API
- Custom Share URLs: Create memorable custom URLs for your portfolio (e.g.,
yoursite.com/john-doeinstead ofyoursite.com/github-username) - Smart Caching: Database-backed caching system for fast portfolio generation and reduced API calls
- SEO Optimized: Dynamic metadata generation for better search engine visibility
- Responsive Design: Works perfectly on all devices with dark mode support
- LinkedIn Integration: Optional LinkedIn profile data fetching
- Live Project Screenshots: Automatically captures and displays live screenshots of project homepages using Screenshot API
- User Input: Visit the landing page and enter a GitHub username
- Data Fetching: The system fetches profile, repositories, and contribution data from GitHub
- AI Processing: Groq AI analyzes the profile and generates professional summaries and highlights
- Portfolio Generation: A complete portfolio page is generated with all sections
- Custom URLs: Users can create custom share URLs for easier sharing
- Node.js 20 or higher
- PostgreSQL database
- Groq API key (get one at groq.com)
- GitHub personal access token (optional, for higher rate limits)
- Clone the repository:
git clone https://github.com/KartikLabhshetwar/foliox
cd foliox- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env.localEdit .env.local with your configuration:
# Required
GROQ_API_KEY=your_groq_api_key_here
API_KEYS=key1,key2,key3
DATABASE_URL=postgresql://user:password@host:port/database
# Optional
GITHUB_TOKEN=your_github_token
GITHUB_CLIENT_ID=your_github_oauth_client_id
GITHUB_CLIENT_SECRET=your_github_oauth_client_secret
NEXT_PUBLIC_SITE_URL=http://localhost:3000
CACHE_ENABLED=true
DEFAULT_CACHE_TTL=3600
DEBUG=false
NODE_ENV=development- Set up the database:
npx prisma migrate dev
npx prisma generate- Run the development server:
npm run dev- Open your browser:
http://localhost:3000
Enter a GitHub username on the landing page to generate a portfolio.
foliox/
βββ app/
β βββ (portfolio)/
β β βββ [username]/
β β βββ page.tsx # Dynamic portfolio pages
β βββ api/
β β βββ custom-url/ # Custom URL endpoints
β β β βββ check/ # Check URL availability
β β β βββ register/ # Register custom URL
β β βββ user/
β β β βββ [username]/
β β β βββ profile/ # GitHub profile with AI content
β β β βββ projects/ # Featured projects
β β β βββ about/ # About section
β β β βββ contributions/ # Contribution graph data
β β βββ linkedin/
β β βββ [username]/ # LinkedIn profile data
β β βββ screenshot/
β β βββ route.ts # Screenshot API endpoint
β βββ layout.tsx # Root layout
β βββ page.tsx # Landing page
βββ components/
β βββ portfolio/ # Portfolio-specific components
β β βββ hero-section.tsx
β β βββ share-button.tsx # Share with custom URL creation
β β βββ projects-section.tsx
β β βββ project-image.tsx # Project screenshot component with fallback
β β βββ ...
β βββ ui/ # Reusable UI components (Shadcn)
βββ lib/
β βββ config/
β β βββ settings.ts # Environment configuration
β βββ modules/
β β βββ github/ # GitHub API integration
β β β βββ fetcher.ts # Profile and data fetching
β β β βββ projects.ts # Project ranking algorithm
β β β βββ contributions.ts # Contribution graph
β β βββ ai/
β β β βββ generator.ts # AI content generation
β β βββ linkedin/
β β βββ fetcher.ts # LinkedIn integration
β βββ utils/
β βββ cache.ts # Database-backed caching
β βββ custom-url.ts # Custom URL utilities
β βββ user.ts # Username validation
β βββ api-client.ts # API client wrapper
βββ prisma/
β βββ schema.prisma # Database schema
βββ types/ # TypeScript type definitions
GET /api/user/[username]/profile- Fetch GitHub profile with AI-generated bio and SEO metadataGET /api/user/[username]/projects- Get featured projects and language statisticsGET /api/user/[username]/about- Get AI-generated about sectionGET /api/user/[username]/contributions- Get contribution graph dataGET /api/user/[username]/prs-by-org- Get pull requests grouped by organization
POST /api/custom-url/check- Check if a custom URL slug is availablePOST /api/custom-url/register- Register a custom URL for a GitHub username
GET /api/linkedin/[username]- Fetch LinkedIn profile data
GET /api/screenshot- Capture screenshots of websites for project previews- Query parameters:
url(required): The URL to capturewidth(optional): Viewport width in pixels (default: 1280)height(optional): Viewport height in pixels (default: 800)format(optional): Output format - png, jpeg, or pdf (default: png)quality(optional): Image quality for JPEG, 1-100 (default: 80)fullPage(optional): Capture full page height (default: false)
- Query parameters:
All API endpoints require an X-API-Key header (except when DEBUG=true). The API key must match one of the keys in the API_KEYS environment variable.
Users can create custom URLs for their portfolios instead of using their GitHub username. For example, instead of yoursite.com/github-username, they can use yoursite.com/john-doe.
- User clicks the Share button on their portfolio
- They can enter a custom slug (e.g., "john-doe")
- The system validates the slug format and checks availability
- If available, the user can register it
- The custom URL is stored in the database and mapped to their GitHub username
- Visiting the custom URL resolves to the GitHub username and displays the portfolio
- 3-40 characters
- Lowercase letters, numbers, and hyphens only
- Cannot start or end with a hyphen
- Reserved words are blocked (api, admin, www, etc.)
- Must be unique
The application uses PostgreSQL with Prisma ORM. The main models are:
- Cache: Stores cached API responses with expiration times
- CustomUrl: Maps custom URL slugs to GitHub usernames
Run migrations to set up the database:
npx prisma migrate devGROQ_API_KEY: Your Groq API key for AI generationAPI_KEYS: Comma-separated list of API keys for authenticationDATABASE_URL: PostgreSQL connection string
GITHUB_TOKEN: GitHub personal access token (increases rate limits and enables private repository access)CACHE_ENABLED: Enable/disable caching (default: true)DEFAULT_CACHE_TTL: Cache time-to-live in seconds (default: 3600)DEBUG: Bypass API key authentication (default: false)NODE_ENV: Environment mode (development/production/test)SCREENSHOT_API_URL: URL of the Screenshot API service (e.g.,https://your-worker.workers.dev) - Required for live project screenshots
- Framework: Next.js 16 with App Router
- Language: TypeScript
- UI: Tailwind CSS + Shadcn/ui components
- AI: Vercel AI SDK with Groq provider (Llama 3.1 8B)
- Database: PostgreSQL with Prisma ORM
- API: GitHub GraphQL API
- Caching: Database-backed caching with Prisma
- Authentication: API key-based middleware
The application uses a database-backed caching system for most endpoints:
- Cache entries are stored in PostgreSQL with expiration times
- Default TTL is 3600 seconds (1 hour)
- Automatic cleanup of expired entries (1% chance on each write)
- Tag-based cache organization for easy invalidation
- Cache is checked before making external API calls
- Most portfolio endpoints use caching to reduce API calls and improve performance
- Push your code to GitHub
- Import the project in Vercel
- Set all environment variables in the Vercel dashboard
- Deploy
The application will automatically run database migrations on first deployment.
The application can be deployed to any platform that supports Next.js:
- Set up a PostgreSQL database
- Configure all environment variables
- Run
npm run buildto build the application - Run
npx prisma migrate deployto apply migrations - Start the application with
npm start
npm run devnpm run build
npm startCreate a new migration:
npx prisma migrate dev --name migration_nameApply migrations in production:
npx prisma migrate deploynpm run lintEnsure all required environment variables are set in .env.local and that GROQ_API_KEY, API_KEYS, and DATABASE_URL are not empty.
Verify that the X-API-Key header matches one of the keys in the API_KEYS environment variable. Set DEBUG=true to bypass authentication during development.
Check the username spelling and ensure the GitHub user exists and is public. If you're rate-limited, add a GITHUB_TOKEN to increase your rate limit.
To enable users to access their private repositories:
-
Create a GitHub OAuth App:
- Go to GitHub Settings β Developer settings β OAuth Apps
- Click "New OAuth App"
- Set Application name: "Foliox" (or your app name)
- Set Homepage URL:
http://localhost:3000(or your production URL) - Set Authorization callback URL:
http://localhost:3000/api/auth/callback/github(or your production callback URL) - Click "Register application"
- Copy the Client ID and generate a Client Secret
-
Set OAuth credentials in your environment:
GITHUB_CLIENT_ID=your_client_id_here GITHUB_CLIENT_SECRET=your_client_secret_here NEXT_PUBLIC_SITE_URL=http://localhost:3000
-
How it works:
- Users can click "Sign in with GitHub" on the landing page
- After authentication, their GitHub access token is securely stored
- When viewing their own portfolio, private repositories are automatically included
- The system uses the user's token to fetch both public and private repos
- Other users' portfolios will only show public repositories (as expected)
-
Server-side token (optional):
- You can still set
GITHUB_TOKENfor server-side operations - This is used as a fallback when no user is authenticated
- Useful for public portfolio generation without user login
- You can still set
Verify your DATABASE_URL is correct and that the database is accessible. Ensure migrations have been run with npx prisma migrate dev.
- IMPLEMENTATION.md - Detailed architecture and implementation details
- LICENSE - GNU General Public License v3.0
Contributions are welcome. Please feel free to submit a Pull Request.
GNU General Public License v3.0 - see LICENSE file for details