This project provides a Go-based API server to access historical Bitcoin events stored in SQLite databases. It supports multiple languages for event data.
- API Server (
main.go): A Fiber-based Go application that serves event data.- Supports language selection via the
langquery parameter (e.g.,lang=en,lang=ru). - Connects to
events.db(for English, default) andevents_ru.db(for Russian). - Requires an API key (
X-API-KEYheader) for authentication. - Uses environment variables for configuration (API key, database paths, port).
- Supports language selection via the
- Databases (
data/events.db,data/events_ru.db): SQLite files containing event information.- Schema managed by GORM (see
database.go).
- Schema managed by GORM (see
- Docker Support: Includes a
Dockerfileanddocker-compose.ymlfor containerized deployment.
- Paginated event listings.
- Filtering events by month/day.
- Fetching individual events by ID.
- Listing unique event tags and their counts.
- Fetching events by specific tags.
- Language support for event content (English and Russian).
- Rate limiting and API key authentication.
- Full-text search functionality on event titles, descriptions, and tags.
A brief overview of the main endpoints. For detailed information, see docs/APIDocumentation.md.
GET /api/events: Lists all events with pagination.GET /api/events/:id: Fetches a single event by its ID.GET /api/search?q={query}: Performs a full-text search on events.GET /api/tags: Retrieves a list of all unique tags and their usage counts.GET /api/events/tags/:tag: Gets events associated with a specific tag.
Detailed documentation for the API, database schema, and deployment can be found in the /docs directory:
docs/APIDocumentation.mddocs/DatabaseDocumentation.mddocs/Deployment.md
Refer to docs/Deployment.md for instructions on building and running the API using Docker.
The API server uses the following environment variables:
API_KEYS: (Required) A comma-separated list of secret keys for API authentication. For example:key1,key2,anotherkeyDB_PATH_EN: Path to the English SQLite database. Defaults to./data/events.db.DB_PATH_RU: Path to the Russian SQLite database. Defaults to./data/events_ru.db.PORT: Port for the API server. Defaults to3000.CORS_ALLOWED_ORIGINS: Comma-separated list of allowed origins for CORS. Defaults tohttp://localhost:3000.
API will be publicly available in Q3 2025, if you want to test API now, DM @Tony on Nostr – I'll be happy to share a key with you.