chore: simplify docs structure
This commit is contained in:
@@ -2,30 +2,92 @@
|
|||||||
[](https://hub.docker.com/r/sjdonado/bit)
|
[](https://hub.docker.com/r/sjdonado/bit)
|
||||||
[](https://hub.docker.com/r/sjdonado/bit)
|
[](https://hub.docker.com/r/sjdonado/bit)
|
||||||
|
|
||||||
Lightweight URL shortener (API-only) with minimal resource requirements.
|
## Features
|
||||||
|
|
||||||
Highly performant: **11k req/sec**, latency 11ms, 40MiB avg memory usage (100k requests using 125 connections, [benchmark](docs/SETUP.md#benchmark)).
|
|
||||||
|
|
||||||
Self-hosted: [Dokku](docs/SETUP.md#dokku), [Docker Compose](docs/SETUP.md#docker-compose).
|
|
||||||
|
|
||||||
Images available on [Docker Hub](https://hub.docker.com/r/sjdonado/bit/tags).
|
|
||||||
|
|
||||||
## Why bit?
|
|
||||||
It is feature-complete by design: simple and reliable without unnecessary bloat. Bug fixes will continue, but new features aren't planned.
|
|
||||||
|
|
||||||
- Minimal tracking setup: Country, browser, OS, referer. No cookies or persistent tracking mechanisms are used beyond what's available from a basic client's request.
|
- Minimal tracking setup: Country, browser, OS, referer. No cookies or persistent tracking mechanisms are used beyond what's available from a basic client's request.
|
||||||
- Includes `X-Forwarded-For` header.
|
- Includes `X-Forwarded-For` header.
|
||||||
- Multiple users are supported via API key authentication. Users can create, list and delete keys via the [CLI](docs/SETUP.md#cli).
|
- Multiple users are supported via API key authentication. Create, list and delete keys via the [CLI](docs/SETUP.md#cli).
|
||||||
- Easy to extend, Ruby on Rails-inspired setup.
|
- Easy to extend, Ruby on Rails-inspired setup.
|
||||||
|
|
||||||
## Recommented requirements
|
## Why bit?
|
||||||
- 100MB disk space
|
|
||||||
- 100MiB RAM
|
**Fast:** **11k req/sec**, latency 11ms, 40MiB avg memory usage (100k requests using 125 connections, [benchmark](docs/SETUP.md#benchmark)).
|
||||||
- x86_64 or ARM64
|
|
||||||
|
**Lightweight:** <100MB disk space, <100MiB RAM.
|
||||||
|
|
||||||
|
**Self-hosted:** [Dokku](docs/SETUP.md#dokku), [Docker Compose](docs/SETUP.md#docker-compose).
|
||||||
|
|
||||||
|
**Production ready:** Feature-complete by design, simple and reliable without unnecessary bloat. Bug fixes will continue, but new features aren't planned.
|
||||||
|
|
||||||
|
## Run It Anywhere
|
||||||
|
|
||||||
|
Images available on [Docker Hub](https://hub.docker.com/r/sjdonado/bit/tags).
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run \
|
||||||
|
--name bit \
|
||||||
|
-p 4000:4000 \
|
||||||
|
-e ENV="production" \
|
||||||
|
-e DATABASE_URL="sqlite3://./sqlite/data.db" \
|
||||||
|
-e APP_URL="http://localhost:4000" \
|
||||||
|
-e ADMIN_NAME="Admin" \
|
||||||
|
-e ADMIN_API_KEY=$(openssl rand -base64 32) \
|
||||||
|
sjdonado/bit
|
||||||
|
|
||||||
|
# Create a new user
|
||||||
|
# docker exec -it bit cli --create-user=Admin
|
||||||
|
```
|
||||||
|
|
||||||
|
### Docker Compose
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up
|
||||||
|
|
||||||
|
# Optional: Generate an api key
|
||||||
|
# docker-compose exec -it app cli --create-user=Admin
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dokku
|
||||||
|
|
||||||
|
- Dockerfile
|
||||||
|
```dockerfile
|
||||||
|
FROM sjdonado/bit
|
||||||
|
```
|
||||||
|
|
||||||
|
- Over ssh
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dokku apps:create bit
|
||||||
|
|
||||||
|
dokku domains:set bit bit.yourdomain.com
|
||||||
|
dokku letsencrypt:enable bit
|
||||||
|
|
||||||
|
dokku storage:ensure-directory bit-sqlite
|
||||||
|
dokku storage:mount bit /var/lib/dokku/data/storage/bit-sqlite:/usr/src/app/sqlite/
|
||||||
|
|
||||||
|
dokku config:set bit DATABASE_URL="sqlite3://./sqlite/data.db" APP_URL=https://bit.yourdomain.com ADMIN_NAME=Admin ADMIN_API_KEY=$(openssl rand -base64 32)
|
||||||
|
|
||||||
|
dokku ports:add bit http:80:4000
|
||||||
|
dokku ports:add bit https:443:4000
|
||||||
|
|
||||||
|
# Create a new user
|
||||||
|
# dokku run bit cli --create-user=Admin
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dokku (subnetwork)
|
||||||
|
Recommended for lower latency communication (no host network traversal)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dokku network:create bit-net
|
||||||
|
dokku network:set bit attach-post-create bit-net
|
||||||
|
dokku network:set myapp attach-post-create bit-net
|
||||||
|
```
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
- [API Reference](docs/API.md)
|
- [API Reference](https://sjdonado.github.io/bit/)
|
||||||
- [Setup](docs/SETUP.md)
|
- [Local Development](docs/SETUP.md)
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
Found an issue or have a suggestion? Please follow our [contribution guidelines](CONTRIBUTING.md).
|
Found an issue or have a suggestion? Please follow our [contribution guidelines](CONTRIBUTING.md).
|
||||||
|
|||||||
@@ -9,67 +9,6 @@ Options:
|
|||||||
--update-parsers Download all required data files
|
--update-parsers Download all required data files
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run It Anywhere
|
|
||||||
|
|
||||||
### Docker Compose
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose up
|
|
||||||
|
|
||||||
# Optional: Generate an api key
|
|
||||||
# docker-compose exec -it app cli --create-user=Admin
|
|
||||||
```
|
|
||||||
|
|
||||||
### Docker CLI
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run \
|
|
||||||
--name bit \
|
|
||||||
-p 4000:4000 \
|
|
||||||
-e ENV="production" \
|
|
||||||
-e DATABASE_URL="sqlite3://./sqlite/data.db" \
|
|
||||||
-e APP_URL="http://localhost:4000" \
|
|
||||||
-e ADMIN_NAME="Admin" \
|
|
||||||
-e ADMIN_API_KEY=$(openssl rand -base64 32) \
|
|
||||||
sjdonado/bit
|
|
||||||
|
|
||||||
# Create a new user
|
|
||||||
# docker exec -it bit cli --create-user=Admin
|
|
||||||
```
|
|
||||||
|
|
||||||
### Dokku
|
|
||||||
|
|
||||||
```dockerfile
|
|
||||||
FROM sjdonado/bit
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
dokku apps:create bit
|
|
||||||
|
|
||||||
dokku domains:set bit bit.donado.co
|
|
||||||
dokku letsencrypt:enable bit
|
|
||||||
|
|
||||||
dokku storage:ensure-directory bit-sqlite
|
|
||||||
dokku storage:mount bit /var/lib/dokku/data/storage/bit-sqlite:/usr/src/app/sqlite/
|
|
||||||
|
|
||||||
dokku config:set bit DATABASE_URL="sqlite3://./sqlite/data.db" APP_URL=https://bit.donado.co ADMIN_NAME=Admin ADMIN_API_KEY=$(openssl rand -base64 32)
|
|
||||||
|
|
||||||
dokku ports:add bit http:80:4000
|
|
||||||
dokku ports:add bit https:443:4000
|
|
||||||
|
|
||||||
# Create a new user
|
|
||||||
# dokku run bit cli --create-user=Admin
|
|
||||||
```
|
|
||||||
|
|
||||||
### Dokku (same network)
|
|
||||||
Recommended for lower latency communication (no host network traversal)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
dokku network:create bit-net
|
|
||||||
dokku network:set bit attach-post-create bit-net
|
|
||||||
dokku network:set myapp attach-post-create bit-net
|
|
||||||
```
|
|
||||||
|
|
||||||
## Local Development
|
## Local Development
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|||||||
+16
-7
@@ -1,7 +1,16 @@
|
|||||||
openapi: 3.1.0
|
openapi: 3.0.3
|
||||||
info:
|
info:
|
||||||
title: Bit - URL Shortener API
|
title: Bit - URL Shortener API
|
||||||
description: A high-performance URL shortener service with click tracking and analytics
|
description: |
|
||||||
|
Fast, lightweight, self-hosted URL shortener service with minimal click tracking.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
For setup instructions, please check the [README](https://github.com/sjdonado/bit/blob/master/README.md).
|
||||||
|
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
Multiple users are supported via `X-Api-Key` headers. Create, list and delete keys via the [CLI](https://github.com/sjdonado/bit/blob/master/SETUP.md#cli).
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
contact:
|
contact:
|
||||||
name: API Support
|
name: API Support
|
||||||
@@ -423,24 +432,24 @@ components:
|
|||||||
example: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0
|
example: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0
|
||||||
country:
|
country:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
|
||||||
description: Country code (ISO 3166-1 alpha-2)
|
description: Country code (ISO 3166-1 alpha-2)
|
||||||
example: US
|
example: US
|
||||||
|
nullable: true
|
||||||
browser:
|
browser:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
|
||||||
description: Browser name
|
description: Browser name
|
||||||
example: Firefox
|
example: Firefox
|
||||||
|
nullable: true
|
||||||
os:
|
os:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
|
||||||
description: Operating system
|
description: Operating system
|
||||||
example: Mac OS X
|
example: Mac OS X
|
||||||
|
nullable: true
|
||||||
referer:
|
referer:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
|
||||||
description: Referer domain or utm_source
|
description: Referer domain or utm_source
|
||||||
example: Direct
|
example: Direct
|
||||||
|
nullable: true
|
||||||
created_at:
|
created_at:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
@@ -457,9 +466,9 @@ components:
|
|||||||
next:
|
next:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
nullable: true
|
|
||||||
description: Cursor for next page (link/click ID)
|
description: Cursor for next page (link/click ID)
|
||||||
example: 12
|
example: 12
|
||||||
|
nullable: true
|
||||||
|
|
||||||
Error:
|
Error:
|
||||||
type: object
|
type: object
|
||||||
|
|||||||
Reference in New Issue
Block a user