Skip to content

thenulldev/api

Repository files navigation

Contributors Forks Stargazers Issues AGPLv3 License LinkedIn


Logo

Null API

API For collecting data
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

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.

Project Structure

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

Recent Improvements

The project has been recently refactored to improve code organization and maintainability:

  • Separated Manager Logic: Manager implementations have been moved from mod.rs files into dedicated manager.rs files
  • Cleaner Module Structure: Each mod.rs now 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

(back to top)

Built With

  • 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

(back to top)

Getting Started

This is an example of how you can get started contributing.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • Postgres
  • Redis
  • Duolingo API Key
  • Spotify API Key
  • Github API Key

Installation

  1. Clone the repo
    git clone https://github.com/thenulldev/api.git && cd api
  2. Copy the .env.example
    cp .env.example .env
  3. Run the API
    cargo run

Benchmark

  1. Install Drill benchmarking suite
    cargo install drill
  2. Run the API
    cargo run
  3. Open a new terminal and run the benchmark
    drill --benchmark benchmark.yml --stats

(back to top)

Usage

This API is designed to collect and aggregate personal statistics from various services for dashboard visualization and analytics. Each module provides specific functionality:

Available Modules

  • 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

API Endpoints

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

Example Usage

# Get Spotify currently playing track
GET /spotify/current

# Get Duolingo user stats
GET /duolingo/stats/{username}

# Get GitHub runners status
GET /github/runners

(back to top)

Roadmap

  • 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).

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Stephen Freerking - @SnipeyDev - [email protected]

Project Link: https://github.com/thenulldev/api

(back to top)

About

An API to track various stats. Tracking Github, Wakatime, Spotify, and Duolingo

Topics

Resources

Stars

Watchers

Forks

Packages