Building a Personal API with Hono and Cloudflare Workers
Written by Jeff on December 24, 2024Building a Personal API with Hono and Cloudflare Workers
As a software engineer and open-source contributor, I believe in the power of structured data and accessible information. That’s why I created the Honolife API — a personal API that acts as a programmatic interface to my professional profile, skills, and real-time activities.
Why Build a Personal API?
In today’s interconnected world, our digital presence spans multiple platforms. While social media profiles and personal websites serve their purpose, I wanted something more:
- Structured Data: A standardized way to access my professional information.
- Real-Time Updates: Live integration with the services I use daily.
- Developer-First: An API that other developers can easily integrate with.
- Automation: Programmatic updates to my information.
Creating a personal API bridges these needs, providing a developer-friendly and dynamic representation of my professional identity.
Technical Implementation
Tech Stack
The API is built with modern and efficient technologies:
- Hono: A lightweight, fast web framework designed for edge computing.
- TypeScript: Ensures type safety and a better developer experience.
- Cloudflare Workers: A serverless platform with global distribution.
- Spotify Web API: For real-time music integration.
Key Features
1. Profile Information
- A comprehensive professional profile.
- Details on current and past work experience.
- Education history.
- Skills and interests.
- Real-time location and timezone.
2. Dynamic Job History
The API keeps an up-to-date record of my professional journey:
- Current Role: Open Source Contributor at Skiddle ID.
- Previous Roles: Experience in technology and digital transformation.
- Detailed Descriptions: Highlighting technologies and tools used.
3. Spotify Integration
Real-time integration with Spotify to share:
- Currently playing tracks.
- Recent listening history.
- Top tracks and artists.
4. Interactive Documentation
The API includes built-in documentation available at /docs
, featuring:
- A comprehensive endpoint listing.
- Example requests and responses.
- Interactive code snippets with copy functionality.
- A clean, modern UI with syntax highlighting.
5. Modular Architecture
The project adheres to a clean, modular structure for scalability and maintainability:
src/
├── data/ # Structured data files
├── routes/ # API endpoints
├── services/ # External integrations
└── types/ # TypeScript definitions
API Design
The API follows RESTful principles, offering clear and intuitive endpoints:
# Profile Information
GET /profile # Basic profile information
GET /profile/jobs # Current job positions
GET /profile/experience # Complete work history
GET /profile/education # Education history
GET /profile/interests # Personal interests
# Skills and Projects
GET /skills # All skills by category
GET /skills/:category # Skills in a specific category
GET /projects # All projects
GET /projects/featured # Featured projects
# Blog Integration
GET /blog # Latest blog posts
GET /blog/all # All posts with pagination
GET /blog/search # Search functionality
# Spotify Integration
GET /spotify/now # Currently playing track
GET /spotify/recent # Recently played tracks
GET /spotify/top # Top tracks and artists
# Documentation
GET /docs # Interactive API documentation
All endpoints return JSON responses and follow consistent patterns for error handling and data structure.
Deployment and Access
The API is deployed globally using Cloudflare Workers, ensuring fast and secure access:
https://api.skiddle.id
With features like automatic SSL, global CDN, and edge computing, Cloudflare’s infrastructure provides robust performance and reliability.
Future Enhancements
I’m continuously working to improve the API and have exciting plans for future features:
- Enhanced Blog Integration: Aggregating my writing from multiple platforms.
- Project Showcase: Providing detailed information on open-source contributions.
- Activity Stream: A real-time feed of my developer activities.
- Analytics Integration: Adding metrics to showcase my coding patterns and productivity.
Conclusion
Building a personal API has been more than just a technical project — it’s a way to structure and share my professional journey programmatically. It serves as both a practical tool for managing my digital presence and a demonstration of my approach to software development.
This project is open source and available on GitHub. Feel free to explore it and use it as inspiration for building your own personal API!
For more examples and detailed documentation, visit api.skiddle.id/docs.