Quecto is a universal, open-source solution that lets you create your own link shortening system.
- An open and self-hostable solution
- Customizable
- Utilisable dès maintenant, hébergé sur Quecto.
- Node JS 14.0.0 or higher
- NPM 6.0.0 or higher
- MongoDB 4.0.0 or higher (if you use MongoDB)
- Clone the repository
git clone https://github.com/oriionn/quecto.git
- Install dependencies
npm install
- Configure the file
config.js
module.exports = {
// The port of the website
PORT: 80,
// The domain name of the website
DOMAIN: "http://localhost",
SAFE_BROWSING_APIKEY: "", // Your Google Safe Browsing API key
// Database type: json, mongodb
DB_TYPE: "json",
// mongodb config (if DB_TYPE is mongodb)
DB_HOST: "127.0.0.1",
DB_PORT: 27017,
DB_NAME: "quecto",
DB_USER: "",
DB_PASS: "",
// json config (if DB_TYPE is json)
DB_JSON_PATH: "./db.json"
}
- Start the server
npm start
If you use JSON:
docker run -d \
-p [PORT]:3000 \
-e DOMAIN=http://localhost \
-e DB_TYPE=json \
-e DB_JSON_PATH=./db.json \
-e SAFE_BROWSING_APIKEY=YOUR_SAFEBROWSING_APIKEY \
--name quecto \
oriionn/quecto
If you use MongoDB: If you don't use username and password:
docker run -d \
-p [PORT]:3000 \
-e DOMAIN=http://localhost \
-e DB_TYPE=mongodb \
-e DB_HOST=127.0.0.1 \
-e DB_PORT=27017 \
-e DB_NAME=quecto \
-e SAFE_BROWSING_APIKEY=YOUR_SAFEBROWSING_APIKEY \
--name quecto \
oriionn/quecto
If you use username and password:
docker run -d \
-p [PORT]:3000 \
-e DOMAIN=http://localhost \
-e DB_TYPE=mongodb \
-e DB_HOST=127.0.0.1 \
-e DB_PORT=27017 \
-e DB_NAME=quecto \
-e DB_USER=username \
-e DB_PASS=password \
-e SAFE_BROWSING_APIKEY=YOUR_SAFEBROWSING_APIKEY \
--name quecto \
oriionn/quecto
⚠ Don't edit :3000
If you use JSON:
version: "3.8"
services:
quecto:
image: oriionn/quecto
container_name: quecto
ports:
- "[PORT]:3000"
environment:
- DOMAIN=http://localhost
- DB_TYPE=json
- DB_JSON_PATH=./db.json
- SAFE_BROWSING_APIKEY=YOUR_SAFEBROWSING_APIKEY
If you use MongoDB: If you don't use username and password:
version: "3.8"
services:
quecto:
image: oriionn/quecto
container_name: quecto
ports:
- "[PORT]:3000"
environment:
- DOMAIN=http://localhost
- DB_TYPE=mongodb
- DB_HOST=127.0.0.1
- DB_PORT=27017
- DB_NAME=quecto
- SAFE_BROWSING_APIKEY=YOUR_SAFEBROWSING_APIKEY
If you use username and password:
version: "3.8"
services:
quecto:
image: oriionn/quecto
container_name: quecto
ports:
- "[PORT]:3000"
environment:
- DOMAIN=http://localhost
- DB_TYPE=mongodb
- DB_HOST=127.0.0.1
- DB_PORT=27017
- DB_NAME=quecto
- DB_USER=username
- DB_PASS=password
- SAFE_BROWSING_APIKEY=YOUR_SAFEBROWSING_APIKEY
⚠ Don't edit :3000
POST /api/shorten
Name | Type | Description |
---|---|---|
link |
string |
Required. The URL to shorten. |
password |
string |
Optional. The password of the link. |
custom_code |
string |
Optional. The custom code of the link. |
{
"status": 200,
"data": {
"original": "https://google.com",
"shorten": "http://quecto.local/s/abc123"
}
}
(The type of the body is multipart/form-data
)
(Precise the domain name in the config.js
file)
{
"status": [STATUS],
"data": {},
"message": "Error: [ERROR]"
}
GET /api/s/:code
Name | Type | Description |
---|---|---|
password |
string |
Optional. The password of the link. |
{
"status": 200,
"data": {
"original": "https://google.com",
"shorten": "http://quecto.local/s/abc123",
"safe": true
}
}
{
"status": [STATUS],
"data": {},
"message": "Error: [ERROR]"
}
GET /api/quectoCheck
{
"status": 200,
"data": {
"quecto": true
}
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.