Skip to content

ISEP-Projects-JH/TodoAPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✅ TodoAPP – Minimalistic C++20 HTTP Todo Service

C++20 Boost jh-toolkit CMake Clang Docker


📌 Project Summary

This is a minimalistic but highly extensible HTTP-based Todo management server written in modern C++20, emphasizing simplicity, testability, and performance.

It follows a practical Hexagonal Architecture without relying on verbose virtual interface hierarchies — making it ideal for both education and small-scale system design.


📄 Third-Party Components

This project uses the following external dependencies:

  • Boost – Boost 1.88 (json, system, asio, beast)
  • jh-toolkit – POD types and memory-safe wrappers (Apache 2.0)

All are statically linked, and no runtime dependencies are required.


✨ Features

  • ✅ RESTful API with more than 10 routes
  • ✅ Dual-indexed in-memory repository (name & timestamp)
  • ✅ CSV import/export (bulk insertion & backup)
  • ✅ Modern build system with CMake + Ninja + Clang + libc++
  • ✅ Docker multi-arch support (amd64/arm64)

🚀 How to Build and Run

🛠 Native (macOS/Linux)

mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
./TodoAPP

Clang + libc++ only tested (fully supported on macOS and most Linux distributions) ⚠️ GCC is not tested, and may fail due to header lookup or ABI quirks ❌ Windows is unsupported due to POSIX usage (sigaction, timegm, etc.)


🐳 Docker (Multi-Arch)

docker buildx build --platform linux/amd64 -t todo-app:amd64 --load .
docker run -p 8080:8080 todo-app:amd64

See build.md for complete Dockerfile and buildx instructions.


🔁 API Usage

See urls.md for full list of routes and example curl usage.


🧱 Architecture Highlights

✅ Minimal HTTP Layer

  • Custom router built over Boost.Beast
  • Routes self-register via REGISTER_VIEW(...) macros
  • Handlers are regular C++ functions — readable and testable

✅ Practical Hexagonal Design

  • No virtual interfaces or DI frameworks
  • Application logic is separate from I/O (e.g., CSV / HTTP / persistence)
  • Can be extended to SQLite or external databases easily

✅ Fast Lookup: POD Key + Dual Index

  • jh::pod::array<char, 64> used as hashmap key — stack-allocated, transparent lookup

  • Memory-local and avoids dynamic allocation like std::string

  • Dual index:

    • by_name_: O(1) lookup by name
    • by_time_: log(N) range-scan by timestamp

🔚 Graceful Shutdown

To shut down the server:

curl -X POST http://localhost:8080/shutdown_server

⚠️ Do not force-close (docker stop) — the server handles cleanup only via this route.


💡 Notes

About

Minimal C++20 HTTP-based Todo service using Boost.Beast and a hexagonal architecture with dual-indexed in-memory storage.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors