A small, production-ready backend to log activity updates and expose current status (building, learning) over HTTP. Designed for long-term personal use as a single source of truth for activity logs and current status.
Live URL: https://activity-api.mohitgauniyal.workers.dev
- Activity Logs: Append-only logs for tracking progress.
- Status Tracking: Manage active
buildingandlearningitems. - Secure Admin: Protected endpoints using
x-admin-token. - D1 Database: Powered by Cloudflare D1 for high availability.
Run the API locally for testing:
npm run devPush the current code live to Cloudflare Workers:
npm run deployNote
This is the only command that updates the live API. Editing files alone does not affect production.
Admin-only endpoints require an admin token. Set it once using:
wrangler secret put ADMIN_TOKENSecrets are stored securely and persist across deployments.
- Activity logs are append-only.
- Status items are soft-deleted (
is_active = 0). - Schema changes must be applied manually.
Local Database:
wrangler d1 execute DB --local --file=db/schema.sqlProduction Database:
wrangler d1 execute DB --remote --file=db/schema.sqlReturns active building and learning items.
- GET
/status - Example:
curl https://activity-api.mohitgauniyal.workers.dev/status
Returns recent logs (newest first).
- GET
/logs?limit=10 - Example:
curl https://activity-api.mohitgauniyal.workers.dev/logs
(All require x-admin-token header)
- POST
/logs - Body:
{"type":"tech","message":"..."}
- POST
/status - Body (Create):
{"section":"building","title":"..."} - Body (Update):
{"id":1,"section":"building","title":"..."}
- DELETE
/status/:id
- POST
/status/reorder - Body:
{"section":"building","ids":[3,1,2]}
This project is licensed under the MIT License.