Redeyes is an extremely simple and compact url shortener in Python.
It is built with Flask and supports a wide range of different shortening styles and configuration methods. The primary and currently only database adapter is built using psycopg, for PostgreSQL, but redeyes is built in a way which it can be extended with many other adapters in the future.
Abilities and Features:
- Extensible design, but sane by default.
- Compact: it only requires a single server running Python and a database.
- Pure and pretty HTML UI; completely JavaScript-free!
- Simplistic— only two routes.
- Expiring links.
- Manage short links via a dashboard.
- Admin page and account system.
- Require password for links.
Tip
Redeyes can be accessed on the web at https://rdy.es.
The API can be accessed at the /api/v1/
prefix.
- Accepts:
application/json
,multipart/form-data
- Body Parameters:
link
:string
: The long form URL you wish to shorten
- Returns:
200 {"short":""}
: The random identifier for the shortened URL415 Unsupported Media Type
: Triggers when the Content-Type is notapplication/json
ormultipart/form-data
400 Bad Request
: Triggers whenlink
is missing or not a valid URL
- Query Parameters:
short
:string
: The shortened URL identifier
- Returns:
200 {"long":""}
: The long form URL400 Bad Request:
Missing requiredshort
parameter404 Not Found
: Could not find link for provided identifier
Redeyes is configurable via environment variables. All environment variables are prefixed with REDEYES_
. All variables have default values, but you will probably want to set a value for at least DSN
.
HOST
is the IP address/domain you wish to make the redeyes instance accessible on.
By default, 0.0.0.0
. This value is most likely good enough for your purposes, but feel free to change it.
PORT
is the port on which you wish to make the redeyes instance accessible.
By default, 80
.
SLUG_LENGTH
is the length of the ids redeyes will generate when shortening URLs. Note that by making this value too low, you may begin to run into issues as the maximum possible combinations may now be too few to function properly.
By default, 6
.
DSN
represents the connection string for the PostgreSQL database you wish to use. The format of these connection strings is available here, on the Postgres docs. Generally though, the format is as follows:
host=localhost port=5432 dbname= user=
By default, it uses redeyes
for the dbname and user fields.
- Implement database functionality
- API Routes
- Rate-limiting
- Error handling
- Logging
Redeyes is available under the GNU General Public License, v3.