Skip to content
smartcompanion-appPublic

About

Self-hosted smart link for your app: redirects to the App Store or Google Play by device, with a landing page fallback. One Docker image.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

applink

One shareable link to all your app market listings: it opens the App Store on iPhones and iPads, Google Play on Android, and a landing page everywhere else.

CI release image platforms PHP license

applink: connect your apps, everywhere

✨ Features

  • πŸ“± Automatic device detection: sends users straight to the right store (Google Play or Apple App Store) based on their device, including iPads that identify as a Mac
  • πŸ–₯️ Landing page fallback: desktop browsers and other devices get a clean page with your app icon, title, description and store badges
  • πŸ’¬ Rich link previews: Open Graph and Twitter Card tags give your link a proper preview in messengers and social media
  • πŸ—‚οΈ Many apps, one service: one YAML file per app, no database, no admin UI
  • 🐳 Easy deployment: a single Docker image for amd64 and arm64 that runs as non-root and has a health check
  • πŸ”’ Secure by default: strict Content Security Policy, escaped output and validated configuration, with caching headers that keep CDNs from mixing up devices

πŸ’‘ Use cases

  • Marketing campaigns: share a single link in emails, social media posts or ads
  • Print materials: one QR code for brochures, posters and flyers that works on every phone
  • In-app recommendations: let users share your app via messengers with a link that works for their friends, whatever phone they use

Maintainers

Maintainer GitHub Social
Stefan Huber stefanhuber Linkedin

πŸš€ Quick start

Run the service with the example configuration from this repository:

git clone https://github.com/smartcompanion-app/applink.git && cd applink
docker run --rm -p 9080:80 -v "$(pwd)/docs/example_storage:/applink/storage:ro" ghcr.io/smartcompanion-app/applink

Open http://localhost:9080/atlas-trails. A desktop browser shows the landing page; a phone is redirected to its app store.

applink landing page of the example app Atlas Trails

The image is published to the GitHub Container Registry as ghcr.io/smartcompanion-app/applink. Tags follow the release version: 0.2.0 (exact), 0.2 (latest patch) and latest.

Moving from Docker Hub? The image stefanhuber332/applink is no longer updated. Replace it with ghcr.io/smartcompanion-app/applink; the volume path, port and configuration format are unchanged.

Verify the image

Every image comes with a signed SLSA build provenance attestation, which proves that it was built from this repository by its release workflow, and an SBOM. Check it with the GitHub CLI before deploying:

gh attestation verify oci://ghcr.io/smartcompanion-app/applink:0.2 -R smartcompanion-app/applink

Docker Compose

services:
  applink:
    image: ghcr.io/smartcompanion-app/applink:0.2
    ports:
      - "9080:80"
    volumes:
      - ./storage:/applink/storage:ro
    restart: unless-stopped

Configuration

All configuration lives in a storage directory that is mounted into the container at /applink/storage:

storage/
β”œβ”€β”€ configuration/
β”‚   β”œβ”€β”€ myapp.yml        β†’ https://applink.example.com/myapp
β”‚   └── otherapp.yml     β†’ https://applink.example.com/otherapp
└── icons/
    β”œβ”€β”€ myapp.png        β†’ https://applink.example.com/icons/myapp.png
    └── otherapp.png

Each .yml file in configuration/ is one app, and its filename is the path of the link. Identifiers may contain letters, digits, - and _. The query form https://applink.example.com/?app=myapp works too. Images in icons/ are served as they are. Changes take effect immediately, without a restart.

Example

A full example, the fictitious Atlas Trails app, is available in docs/example_storage:

links:
  ios: https://apps.apple.com/app/atlas-trails/id6450123456
  android: https://play.google.com/store/apps/details?id=app.atlastrails
page:
  base-url: http://localhost:9080
  title: Atlas Trails
  description: Discover 20,000 hiking trails with offline maps, live navigation and summit stories.
  background-color: 'radial-gradient(circle at 15% 20%, #34d399 0%, transparent 45%), radial-gradient(circle at 85% 85%, #0ea5e9 0%, transparent 50%), linear-gradient(135deg, #064e3b 0%, #0f172a 100%)'
  app-icon: atlas-trails.png

Options

Option Required Description
links.ios one of both App Store link. iPhones, iPads and iPods are redirected here.
links.android one of both Google Play link. Android devices are redirected here.
page.title yes App name, shown on the landing page and in link previews.
page.description no Short description for the landing page, search engines and link previews.
page.app-icon no Filename of the icon in icons/, used on the landing page, as favicon and as preview image.
page.background-color no Any CSS background value: a color, gradient or image, e.g. url(https://example.com/bg.jpg) center / cover. Images must be served over https (or from icons/).
page.base-url no Public URL of the service, e.g. https://applink.example.com. Link previews need absolute URLs, so set it if requests do not reach applink with the public host name. Without it, the URL is derived from the request (Host and X-Forwarded-Proto).

Links have to be absolute https, http, itms-apps or market URLs. An invalid configuration is reported in the container log, and the link responds with an error page instead of a broken one.

Environment variables

Variable Default Description
APPLINK_STORAGE /applink/storage Path of the storage directory inside the container.

How it works

Request Response
iPhone, iPad (iOS ≀ 12) or iPod with an ios link 302 redirect to the App Store
Android device with an android link 302 redirect to Google Play
iPad on iPadOS 13+ Landing page, which forwards to the App Store with JavaScript, since these iPads identify as a Mac and can only be detected by their touch screen
Anything else, or no link for the platform 200 landing page with store badges
Unknown app 404 error page
Invalid configuration 500 error page, details in the container log
/healthz 200 ok, used by the Docker health check

Deployment

applink serves plain HTTP on port 80 and expects a reverse proxy or load balancer in front of it for TLS, for example Traefik, Caddy, nginx or a cloud load balancer. Forward the Host header and set X-Forwarded-Proto, or set page.base-url per app.

App responses send Vary: User-Agent and Cache-Control: no-store. If you put a CDN in front of applink, keep those headers intact. Otherwise the CDN may send every visitor to the store of whoever opened the link first.

Development

Requires PHP 8.4+ and Composer:

composer install
composer serve    # http://localhost:8080/atlas-trails with docs/example_storage
composer check    # code style, PHPStan and tests

See CONTRIBUTING.md for the project layout, testing and the release process.

License

BSD 2-Clause Β© SmartCompanion

About

Self-hosted smart link for your app: redirects to the App Store or Google Play by device, with a landing page fallback. One Docker image.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages