2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00
2026-03-27 16:46:03 +08:00

nano_io

nano_io is a tiny single-bucket object storage service in Go.

It provides:

  • minimal S3 compatibility for mc (SigV4 auth + object PUT/GET/DELETE + list buckets/objects)
  • PUT /{bucket}/{key} to upload objects
  • DELETE /{bucket}/{key} to delete objects
  • POST /presign to generate a legacy signed download URL
  • GET /{bucket}/{key} to download via SigV4 auth, or via legacy pre-signed URL
  • .env loading at startup
  • SQLite metadata storage

Quick start

  1. Copy env file:
cp .env.example .env
  1. Edit .env and set either:

    • AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY (recommended, for mc), or
    • AUTH_TOKEN (legacy bearer mode)
  2. Run:

go run .

API examples

Upload object

curl -X PUT "http://127.0.0.1:8080/nano-bucket/hello.txt" \
  -H "Authorization: Bearer replace-with-api-token" \
  -H "Content-Type: text/plain" \
  --data-binary "hello nano_io"

Create pre-signed URL

curl -X POST "http://127.0.0.1:8080/presign" \
  -H "Authorization: Bearer replace-with-api-token" \
  -H "Content-Type: application/json" \
  -d '{"key":"hello.txt","expires_in":300}'

Response:

{"url":"/nano-bucket/hello.txt?expires=1710000000&signature=...","expires_at":1710000000}

Delete object

curl -X DELETE "http://127.0.0.1:8080/nano-bucket/hello.txt" -i \
  -H "Authorization: Bearer replace-with-api-token"

Download with signed URL

curl "http://127.0.0.1:8080/nano-bucket/hello.txt?expires=...&signature=..."

Use with MinIO client (mc)

mc alias set nano http://127.0.0.1:8080 minioadmin minioadmin --api s3v4
mc ls nano
mc cp ./README.md nano/nano-bucket/readme.txt
mc cat nano/nano-bucket/readme.txt
mc rm nano/nano-bucket/readme.txt

Notes

  • Only one bucket is supported (BUCKET_NAME).
  • mc compatibility is intentionally minimal (single bucket, no multipart, no ACL, no versioning).
  • Legacy PUT/DELETE/POST /presign can still use Authorization: Bearer <AUTH_TOKEN>.
  • Legacy pre-signed download requires expires and signature.
Description
No description provided
Readme 56 KiB
Languages
Go 100%