Tiddy is self hosted image server written in Go
Go to https://tiddi.kunalsin9h.com to see a demo of the project.
- Upload images
- View images
- Delete images
- Update images
- Get image details
Important
If you want to run the server inside a docker container, you can follow these Docker Instructions
Important
If you want to run the server using Meltcd then you can follow these Meltcd Instructions
- Clone the repo
git clone https://github.com/kunalsin9h/tiddi.git
- Change the working directory
cd tiddi
- Run the server
go run cmd/main.go
- Open http://localhost:5656 in your browser
You can set the following environment variables to change the default settings of the server.
Environment Variable | Default Value | Description |
---|---|---|
PORT |
5656 |
Port on which the server will run |
DB |
file:./database/dev.db |
URL to the database file |
HOST |
localhost |
Host on which the server will run |
export PORT=8080
# DB can be sqlite file or libsql url
export DB=file:./database/prod.db
# alternatively for libsql
export DB=libsql://my-db.tarso.io?authToken=autotoken
export HOST=https://tiddi.kunalsin9h.com
go run cmd/main.go
The
HOST
environment variable is used to generate theunique image id
of the image, it is recommended to set it to the domain name of the server.HOST
is also used in the sample frontend to fetch the image from the server.
The Sample Frontend is available at ./cmd/frontend
directory, it is served by the server at /
route.
GET /
POST /image/
Request:
{
"image": [23, 112, 2,...34],
"title": "Image Title"
}
Parameter | Type | Description |
---|---|---|
image |
[]byte |
Required. Image bytes to upload |
title |
string |
Optional. Title of the image |
Response:
{
"url": "Unique URL of the image"
}
GET /{uiid}
Image with
uiid
is served at this route
GET /get-image/{uuid}
Parameter | Type | Description |
---|---|---|
uiid |
string |
Required. UIID of the image |
Response:
{
"title": "Image Title",
"image": "Base64 Encoded Image"
}
UIID is the
unique image id
of the image, it is generated by the server and is returned when the image is uploaded.
DELETE /delete-image/
Parameter | Type | Description |
---|---|---|
uiid |
string |
Required. UIID of the image |
PUT /update-image/
Parameter | Type | Description |
---|---|---|
uiid |
string |
Required. UIID of the image |
image |
[]byte |
Optional. Image bytes to upload |
title |
string |
Optional. Title of the image |
Client: HTML, CSS, JavaScript
Server: Go, SQLite
For support, email kunal@kunalsin9h.com
If you have any feedback, please reach out to us at kunal@kunalsin9h.com
Contributions are always welcome!
Enjoy! 🚀