How safal-gautamm/pwdmanager_api works
Project Type & Purpose
• A monolithic RESTful API for encrypted password storage, written in C++ using the Drogon framework.
• No external database—uses a JSON file for persistence. Educational/demo focus.
File Structure
• main.cc – application entry point, starts Drogon server
• controllers/pwdmanager.{cc,h} – HTTP endpoint handlers (create, add, view, delete)
• models/model.json – JSON schema or model definition
• passwords.json – runtime storage of encrypted passwords
• config.json & config.yaml – server settings (port, file paths, encryption parameters)
• index.html – static instruction page served at “/”
Extract Key Components
A. Client / Browser (HTTP client or curl)
B. Drogon Web Server
C. Router & Controllers
– pwdmanagerController: dispatches endpoints (/create, /add, /view, /delete)
D. Service & Business Logic
– Account/API-key management
– XOR encryption/decryption module
E. Data Layer
– JSON file I/O (passwords.json)
– Model definitions (models/model.json)
F. Configuration Loader
G. Static File Handler (serving index.html)
Relationships & Data Flows
1) Client → HTTP request → Drogon Router
2) Router → Specific Controller method
3) Controller → Calls Service functions (encrypt/decrypt, validation)
4) Service → Reads/writes passwords.json (via JSON library)
5) Controller → Builds JSON HTTP response → Client
6) Client GET “/” → Server returns index.html
Patterns & Principles
• MVC-inspired layering: controllers separate from business logic and data I/O
• Configuration-driven startup (JSON/YAML)
• Single-process design—no external services or microservices