How dipikasgp/talkintunes works
Project type and purpose
• This is a full-stack, server-rendered web application (“TalkinTunes”) built with Flask on the backend and standard HTML/CSS/JS on the frontend.
• Purpose: end-to-end encrypted messaging; messages are encrypted/decrypted via RSA keys, then rendered as musical tunes (MIDI → WAV → MP3) for playback.
File structure
• Entry point: talkintunes.py (initializes Flask app, loads config).
• talkintunes/
• config.py (app settings, database URI, crypto configs)
• models.py (SQLAlchemy ORM: users, messages, key/meta tables)
• errors/handlers.py (Flask error pages)
• Blueprints:
– main/routes.py (home, about, account, password reset)
– users/routes.py + forms/utils (signup, login, profile)
– messages/routes.py + forms/note_mapping/utils (encrypt & send, decrypt & view)
• private_keys/ (server-side PEMs for each user)
• static/ (MP3 tunes & CSS)
• templates/ (Jinja2 HTML views)
• root snippets/ directory captures deployment configs (nginx, supervisor, certbot), plus example front-end snippets.
README
• Confirms Postgres for persistence of users, messages, public keys and MP3 paths.
• Describes cryptographic flow (RSA key pair generation on signup, public key in DB, private key in server folder).
• Outlines media conversion pipeline: music21 → MIDI, fluidsynth → WAV, pydub → MP3.
a. Main components
1. Client browser
2. Nginx reverse proxy (optional) / Supervisor process manager
3. Flask application
• Blueprint modules: main, users, messages
• Crypto module (cryptography RSA operations)
• Music conversion module (music21, fluidsynth, pydub)
4. Postgres database
5. File storage (static folder for MP3s, private_keys folder)
b. Relationships & interactions
• Browser ↔ Nginx/Flask: HTTP(S) requests for pages, form submissions, and MP3 playback.
• Flask ↔ Database: SQLAlchemy sessions to read/write user accounts, public keys, message records, MP3 file paths.
• Flask ↔ File system:
• read/write private_keys/*.pem
• write MP3 files to static/ on message send
• serve MP3 files statically
• Flask Crypto library: generate key pairs (on signup), encrypt message plaintext (sender’s browser → Flask), decrypt on “view message”.
• Flask Music pipeline: convert encrypted message to tune → store MP3.
c. Architectural patterns & design principles
• MVC-style separation:
• Models (ORM classes in models.py)
• Views (Jinja2 templates + static assets)
• Controllers (Blueprint routes)
• Modularization via Blueprints for user, message, and main flows.
• Single service monolith, but clear logical separation of concerns.
d. Key technologies & frameworks
• Python Flask
• SQLAlchemy (Postgres)
• cryptography library (RSA)
• music21, fluidsynth, pydub (media conversion)
• Nginx + Supervisor (deployment)
Elements
• Clear labels on each component (e.g., “Flask App: messages Blueprint”).
• Application service in another,
• Data stores (DB, file system) in a third,
• External infra (Nginx, Supervisor) in a fourth.