Skip to content

About

A self-hosted, open-source Linktree-style bio-link site with multi-language pages, themes, analytics, and QR codes.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Personal Links Tree

A self-hosted, open-source Linktree-style bio-link site. Build a customizable link-in-bio page — or several, in multiple languages — with your own database, on your own hosting. No subscription, no third-party tracking, no vendor lock-in.

Built with plain PHP 8 + MySQL + Bootstrap 5 + vanilla JS. No framework, no build step, no Node — upload the files, run the installer, done.

Features

  • Multiple pages, one install. Run more than one bio-link page from a single database — a personal page and a business page, for example — each with its own slug, links and appearance.
  • Multi-language pages (English + Arabic, RTL-ready). Pair a page with a translated version of itself in the other language. The translated page's style stays in sync with its primary automatically; only its content (name, bio, SEO, and each link's title/description) is edited independently. A language switcher appears automatically on paired pages.
  • Link management. Drag-and-drop reordering, 16 link types (website, phone, email, socials, WhatsApp, Telegram, custom, etc.), an icon library or your own uploaded icon, optional thumbnails, per-link colors, scheduling (appear/expire at a set time), enable/disable, duplicate.
  • Appearance editor with a live preview: background (solid, gradient, image, or video — YouTube or an uploaded MP4), colors, fonts, button and icon styles, spacing, custom CSS, and 10 built-in themes you can also save/export/import your own versions of.
  • Analytics, self-hosted: profile visits, link clicks, QR scans and shares, broken down by device/browser/country/referrer/date, with CSV export — no Google Analytics, no external service. An optional "show visit count" toggle displays a page's total visits publicly.
  • QR codes per page, with custom colors and an optional logo overlay.
  • SEO controls per page: title, meta description/keywords, Open Graph/Twitter card, canonical URL, favicon.
  • Backups: one-click full database export, plus a settings-only JSON export/import.
  • Security by default: CSRF protection and a strict CSP with per-request nonces on every admin form, bcrypt password hashing, DB-backed login rate limiting/lockout, MIME-sniffed upload validation (rejects disguised file types), parameterized queries everywhere.

Requirements

  • PHP 8.0 or newer, with the pdo_mysql extension
  • MySQL 5.7+ or MariaDB 10.3+
  • Apache with mod_rewrite (for pretty page URLs like yoursite.com/mypage)

Installation

  1. Upload everything in this repository to your web host (the project is meant to be deployed at your domain's web root).
  2. Create an empty MySQL database and a database user with access to it.
  3. Visit https://yourdomain.com/install.php in your browser and follow the setup wizard — it asks for your database details and the admin account you want to log in with, then sets everything up for you.
  4. Delete install.php once setup finishes (the installer refuses to run again once it's set up anyway, but removing the file is the safer option).
  5. Log in at https://yourdomain.com/login.php with the admin account you just created.

That's it — a demo page with a few sample links is ready to customize from the admin dashboard.

Manual installation

If you'd rather not use the wizard: copy includes/config.sample.php to includes/config.php and fill in your database details, import database.sql into your database, then create your own admin account:

php -r "echo password_hash('yourpassword', PASSWORD_DEFAULT);"
INSERT INTO admins (username, email, password_hash) VALUES ('youruser', 'you@example.com', 'PASTE_THE_HASH_HERE');

Multi-language pages

  1. In Pages, use Add Translation on an existing page to create its paired page in the other language (its own title and slug).
  2. Edit any link on the primary page — a Translation section appears letting you set that link's title/description in the other language. Leave it blank and it falls back to the original text.
  3. The translated page's colors, fonts, background and layout always mirror its primary automatically; only content (profile text, SEO, link text) is edited on the translated page itself.
  4. A language switcher link appears on both pages automatically (toggle it off per page in Pages if you don't want it shown).

Project structure

index.php              Public page router (serves the main page at "/", others at "/<slug>")
login.php               Admin sign-in
install.php              Setup wizard (delete after first use)
admin/                  Admin dashboard (pages, links, appearance, themes, QR, analytics, settings)
api/                    Public endpoints used by the front end (click/visit/share tracking, QR image, backups)
includes/               Shared PHP: auth, DB, security, uploads, helper functions
assets/                 CSS, JS, uploaded media
database.sql            Full database schema + seed data (used by install.php)

Analytics: country/city lookup

Country and city in analytics come only from Cloudflare's edge headers (CF-IPCountry, CF-IPCity) — there's no local GeoIP database and no third-party geolocation API call. This keeps tracking dependency-free and fast, but it also means:

  • Geolocation only works if the site is actually proxied through Cloudflare. Without it, country and city just stay blank — everything else in analytics still works normally.
  • City requires a Cloudflare plan with city-level geolocation (Enterprise, or the equivalent on Workers); on lower tiers it's commonly empty even with Cloudflare active.
  • Headers are only trusted when the request verifiably came through Cloudflare (checked via the CF-Ray header) — otherwise a visitor could just send a fake CF-IPCountry header themselves.

Visitor IPs themselves are never stored in plain text by default: every tracked event stores a one-way HMAC hash of the IP (APP_SECRET in includes/config.php is the hash key — the installer generates this for you automatically), which can't be reversed back to a real IP. Storing the actual IP address alongside it is optional, off by default, and toggled from Settings → Privacy ("Store full IP addresses"), with an "Anonymize" option alongside it.

Security notes

  • includes/config.php holds your real database credentials and APP_SECRET (used to hash visitor IPs for analytics) — keep it out of version control (already covered by .gitignore).
  • includes/, assets/uploads/, and vendor/ each carry a deny-all .htaccess; uploads are additionally blocked from executing as scripts regardless of extension.
  • Change your admin password from Admin Profile if you ever suspect it's been exposed.

License

Licensed under a permissive MIT-style license with one added condition — see LICENSE.md. In short: you're free to use, modify, and redistribute this code for any purpose, including commercial use, but the "Built by Mansoour" credit in the public page footer and admin sidebar must stay visible and unmodified.

Credits

Built by Mansoour

About

A self-hosted, open-source Linktree-style bio-link site with multi-language pages, themes, analytics, and QR codes.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages