opentwig
v1.1.2
Published
opentwig πΏ is an open source link in bio page generator.
Maintainers
Readme
OpenTwig πΏ
OpenTwig is an open source personal link page generator that creates beautiful, customizable "link in bio" pages. Instead of relying on third-party services, users can define their configuration and instantly create a fully functional static site they own and control.
β¨ Features
- π¨ Multiple Themes: Choose from 4 built-in themes (default, dark, minimal, colorful)
- π± Mobile Responsive: Optimized for all devices with mobile-first design
- π Fast & Lightweight: Generates static HTML/CSS with minimal dependencies
- π Easy Link Management: Simple JSON configuration for all your links
- πΌοΈ Optional Avatar Support: Custom profile pictures with automatic processing (completely optional)
- π Open Graph Images: Auto-generated social media preview images
- π± QR Code Generation: Built-in QR codes for easy mobile sharing
- π Modal Dialogs: Support for rich content in footer links
- π€ Share Functionality: Native Web Share API integration
- β‘ CSS Optimization: Automatic CSS minification and autoprefixing
- π οΈ CLI Interface: Simple command-line interface with helpful commands
π Quick Start
Installation & Usage
# Create a new project
npx opentwig --init
# Edit the generated config.json with your information
# Then generate your page
npx opentwig
# Or use live preview with interactive editor
npx opentwig --livePrerequisites
- Node.js (v14 or higher)
- npm or yarn
π₯ Live Preview Mode (NEW!)
OpenTwig now includes a powerful live preview mode with an interactive configuration editor!
# Start live preview with config editor
npx opentwig --live
# Or using npm script
npm run liveFeatures:
- π¨ Interactive Sidebar Editor - Edit all config options in a beautiful UI
- π Real-time Preview - See changes instantly as you edit
- πΎ Auto-save - Changes automatically save to config.json
- π± Responsive Layout - Preview on the left, editor on the right
- πΌοΈ Avatar Upload - Upload and preview avatar images directly
- π Theme Switcher - Switch between themes instantly
- π Drag & Drop Links - Easily manage your links
- π Status Indicator - Connection status and auto-save status
- π₯ Export Config - Download your config as JSON
How it works:
- Run
npx opentwig --liveto start the development server - The browser opens automatically showing your page preview
- Use the sidebar editor to modify configuration
- Changes are auto-saved to
config.json - Preview updates in real-time
- Press
Ctrl+Cto stop the server - Your
dist/folder is ready for deployment!
π Configuration
OpenTwig uses a simple JSON configuration file (config.json) to define your page. Here's the complete configuration structure:
With Avatar (Optional)
{
"theme": "default",
"url": "https://links.yourwebsite.com",
"title": "Your Name - opentwig πΏ",
"name": "Your Name",
"content": "Hello World! Here is my bio.",
"minify": true,
"avatar": {
"path": "./avatar.png"
},
"links": [
{
"url": "https://twitter.com",
"title": "Twitter"
},
{
"url": "https://instagram.com",
"title": "Instagram"
}
],
"footerLinks": [
{
"title": "Contact",
"url": "mailto:[email protected]"
},
{
"title": "Privacy",
"content": "Your privacy policy content here..."
}
],
"share": {
"title": "Your Name - opentwig πΏ",
"url": "https://links.yourwebsite.com",
"text": "Share"
}
}Without Avatar (Minimal Configuration)
{
"theme": "default",
"url": "https://links.yourwebsite.com",
"title": "Your Name - opentwig πΏ",
"name": "Your Name",
"content": "Hello World! Here is my bio.",
"minify": true,
"links": [
{
"url": "https://twitter.com",
"title": "Twitter"
},
{
"url": "https://instagram.com",
"title": "Instagram"
}
],
"footerLinks": [
{
"title": "Contact",
"url": "mailto:[email protected]"
}
],
"share": {
"title": "Your Name - opentwig πΏ",
"url": "https://links.yourwebsite.com",
"text": "Share"
}
}Configuration Options
| Option | Type | Description |
|--------|------|-------------|
| theme | string | Theme name (default, dark, minimal, colorful) |
| url | string | Your page URL (for Open Graph and QR codes) |
| title | string | Page title (appears in browser tab) |
| name | string | Your display name |
| content | string | Bio/description text |
| minify | boolean | Enable CSS minification (default: true) |
| avatar | object | Optional Avatar image configuration |
| avatar.path | string | Optional Path to your avatar image (supports PNG, JPG, JPEG, WebP) |
| links | array | Array of link objects with url and title |
| footerLinks | array | Footer links (can be URLs or modal dialogs) |
| share | object | Web Share API configuration |
πΌοΈ Avatar Configuration
The avatar feature is completely optional. If you don't include the avatar object in your configuration, no avatar will be displayed on your page.
Supported image formats:
- PNG
- JPG/JPEG
- WebP
- SVG
Avatar processing:
- Images are automatically optimized and resized
- Processed avatar is saved as
avatar.pngin the output directory - Original aspect ratio is preserved
- Images are compressed for optimal web performance
Example avatar configuration:
{
"avatar": {
"path": "./my-photo.jpg"
}
}Note: If you don't want an avatar, simply omit the avatar object from your configuration entirely.
π¨ Themes
OpenTwig includes 4 beautiful themes:
- Default: Clean, modern design with subtle shadows and rounded corners
- Dark: Dark mode variant of the default theme with gradient backgrounds and glassmorphism effects
- Minimal: Simplified, minimalist design with flat styling
- Colorful: Vibrant color scheme with animated gradients and shimmer effects
All themes are mobile-responsive and include:
- Optional custom avatar display
- Link buttons with hover effects
- Modal dialogs for rich content
- QR code integration
- Share button functionality
π οΈ CLI Commands
# Show help information
npx opentwig --help
# Create sample config.json
npx opentwig --init
# Generate page from config.json
npx opentwig
# Start live preview with config editor
npx opentwig --live
# Validate config.json
npx opentwig --validate-configπ Output Files
OpenTwig generates the following files in the dist/ directory:
index.html- Main HTML pagestyle.css- Processed and optimized CSSavatar.png- Processed avatar image (only generated if avatar is configured)og-image.jpg- Open Graph image for social sharingqr.svg- QR code for mobile sharing
π§ Development
Development Setup
If you want to contribute to OpenTwig or customize it locally:
# Clone the repository
git clone https://github.com/tufantunc/opentwig.git
cd opentwig
# Install dependencies
npm install
# Test the CLI
npm start -- --help
# Create a sample config for testing
npm start -- --init
# Test the build process
npm start
# Start live preview mode
npm run liveProject Structure
opentwig/
βββ src/
β βββ index.js # Main CLI entry point
β βββ constants.js # Application constants
β βββ live-ui/ # Live preview UI
β β βββ index.html # Live editor page
β β βββ styles.css # Live editor styles
β β βββ preview.js # Preview management
β β βββ editor.js # Config editor logic
β β βββ sidebar.js # Sidebar components
β βββ utils/ # Core utilities
β βββ buildPage.js # Page building logic
β βββ generateHTML.js # HTML generation
β βββ generateOGImage.js # Open Graph image creation
β βββ generateQR.js # QR code generation
β βββ processCSS.js # CSS processing and optimization
β βββ startLiveServer.js # Live preview server
β βββ websocketServer.js # WebSocket handling
β βββ setupWatcher.js # Config file watcher
β βββ ...
βββ theme/
β βββ default/ # Default theme
β β βββ index.js # Theme template
β β βββ style.css # Theme styles
β β βββ components/ # Reusable components
β βββ dark/ # Dark theme
β βββ minimal/ # Minimal theme
β βββ colorful/ # Colorful theme
βββ .github/ # GitHub templates
β βββ ISSUE_TEMPLATE/ # Issue templates
β βββ pull_request_template.md # PR template
βββ dist/ # Generated output (gitignored)Key Features Implementation
- Image Processing: Uses Sharp for avatar and OG image processing
- QR Code Generation: Uses qrcode library for SVG QR codes
- CSS Processing: PostCSS with autoprefixer and minification
- HTML Generation: Component-based template system
- Theme System: Modular theme architecture with component support
π Deployment
Since OpenTwig generates static files, you can deploy to any static hosting service:
- GitHub Pages: Push
dist/folder to a repository - Netlify: Drag and drop the
dist/folder - Vercel: Connect your repository
- AWS S3: Upload files to an S3 bucket
- Any web server: Upload the
dist/folder to your server
π Showcase
Check out these amazing websites created with OpenTwig! These examples showcase sites made with OpenTwig:
Featured Sites
- Tufan TunΓ§ - My Social Links - My social links, used default theme with avatar
Submit Your Site
Have you created a website with OpenTwig? We'd love to showcase it! You can add your site to our showcase in two ways:
- Create an Issue - Use our showcase submission template
- Submit a Pull Request - Add your site directly to the showcase section in this README
Guidelines for Showcase Submissions
- β Your site must be live and accessible
- β Use OpenTwig to generate the site
- β Keep descriptions concise (1-2 sentences max)
What We Look For
- Creative use of themes and customization
- Different use cases (personal, business, portfolio, etc.)
- Good examples of various configuration options
- Sites that inspire other users
π License
MIT License - see LICENSE file for details
π€ Contributing
OpenTwig is open source and welcomes contributions from the community! π
Ways to Contribute
- π Report bugs using our bug report template
- β¨ Suggest features through our feature request template
- π Improve documentation using our documentation improvement template
- π Submit to showcase using our showcase submission template
- π¨ Create themes - add new visual styles and layouts
- π§ Fix issues - tackle open issues and improve the codebase
- π Translate - help translate documentation and content
Getting Started
- Read our Contributing Guide - Complete guide for contributors
- Check our Code of Conduct - Community guidelines
- Look for
good first issuelabels - Perfect for newcomers - Fork, code, and submit a PR - Standard open source workflow
Hacktoberfest 2025
π This repository participates in Hacktoberfest 2025!
- Look for issues with
hacktoberfestandgood first issuelabels - Follow our issue and PR templates
- Make meaningful contributions that benefit the project
- Review our Contributing Guide before starting
Contributors
We appreciate all contributors! Contributors will be:
- Listed here (if desired)
- Mentioned in release notes for significant contributions
- Given priority for code reviews and feedback
π Links
π§ Config.json Validation
You can validate your configuration file using the CLI option:
npx opentwig --validate-configAvailable Commands
--help- Show usage information--init- Create a sample config.json--validate-config- Validate the config.json filebuild- Compile the project filesstart- Run the projecttest- Execute the project tests
