Table of Contents
This is a Rust-based API for collecting and tracking personal statistics from various services including Spotify, Duolingo, and GitHub. The API provides endpoints to retrieve real-time data and analytics for dashboard visualization.
The API follows a clean modular architecture with each service having its own dedicated module:
src/modules/
├── duolingo/
│ ├── entity.rs # Data structures for Duolingo API responses
│ ├── handler.rs # HTTP request handlers and endpoints
│ ├── manager.rs # Business logic and API interactions
│ └── mod.rs # Module exports and public API
├── spotify/
│ ├── entity.rs # Data structures for Spotify API responses
│ ├── handler.rs # HTTP request handlers and endpoints
│ ├── manager.rs # Business logic and API interactions
│ └── mod.rs # Module exports and public API
└── github/
├── entity.rs # Data structures for GitHub API responses
├── handler.rs # HTTP request handlers and endpoints
├── manager.rs # Business logic and API interactions
└── mod.rs # Module exports and public API
Each module follows a consistent pattern:
- Entity: Defines data structures and types for API responses
- Handler: Contains HTTP route handlers and request/response logic
- Manager: Implements business logic, API calls, and data management
- Mod: Provides clean module exports and public API surface
The project has been recently refactored to improve code organization and maintainability:
- Separated Manager Logic: Manager implementations have been moved from
mod.rsfiles into dedicatedmanager.rsfiles - Cleaner Module Structure: Each
mod.rsnow only contains module declarations and re-exports, making them much more readable - Better Separation of Concerns: Business logic is now clearly separated from module organization
- Improved Maintainability: Each manager's implementation is now in its own focused file, making it easier to maintain and extend
- Rust - Systems programming language for performance and safety
- Actix-Web - High-performance web framework for Rust
- SQLx - Async SQL toolkit with compile-time checked queries
- Redis - In-memory data structure store for caching
- Reqwest - HTTP client library for making API requests
- Serde - Serialization framework for converting data structures
This is an example of how you can get started contributing.
This is an example of how to list things you need to use the software and how to install them.
- Clone the repo
git clone https://github.com/thenulldev/api.git && cd api
- Copy the
.env.examplecp .env.example .env
- Run the API
cargo run
- Install Drill benchmarking suite
cargo install drill
- Run the API
cargo run
- Open a new terminal and run the benchmark
drill --benchmark benchmark.yml --stats
This API is designed to collect and aggregate personal statistics from various services for dashboard visualization and analytics. Each module provides specific functionality:
- Duolingo Module: Tracks language learning progress, streak data, and user statistics
- Spotify Module: Retrieves currently playing tracks, user playlists, top artists/tracks, and listening analytics
- GitHub Module: Monitors repository activity, GitHub Actions runners, and organization statistics
The API provides RESTful endpoints for each service module, allowing you to:
- Retrieve real-time data from external APIs
- Cache frequently accessed data using Redis
- Aggregate statistics for dashboard visualization
- Monitor service health and availability
# Get Spotify currently playing track
GET /spotify/current
# Get Duolingo user stats
GET /duolingo/stats/{username}
# Get GitHub runners status
GET /github/runners- Spotify Stats
- Duolingo Stats
- Github Stats
- Modular Architecture Refactoring
- Waka Stats
- Enhanced Error Handling
- API Documentation with OpenAPI/Swagger
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt for more information.
Stephen Freerking - @SnipeyDev - [email protected]
Project Link: https://github.com/thenulldev/api