How gonzalopontnau/crypto-price-pyhon works
Main components
• Web Client – Representing the browser, which displays HTML pages (e.g., index.html, noticias.html, mercado.html) and static assets (CSS, images).
• Flask Application Server – The core of your system (app.py). This serves the HTML templates, handles routing, and coordinates interactions.
• External API – CoinMarketCap’s API that the application calls to fetch real-time price data. This component is external but essential.
• Static Assets – The “static” directory (CSS, images) used to style and support your UI.
• Deployment Components – Although not part of the runtime application logic, elements like the Procfile and vercel.json show that the app can be deployed on platforms such as Heroku and Vercel. You might also illustrate how environment variables (via the .env file) are used for configuration.
Relationships and interactions
• The Web Client (browser) makes HTTP requests to the Flask Application Server.
• The Flask server processes these requests and based on the route (e.g., home page, noticias, or mercado), it renders a template from the “templates” directory.
• When real-time cryptocurrency data is needed, app.py makes a request to the external CoinMarketCap API using the provided API key from the .env file.
• Data retrieved from the API is integrated into the web pages before being sent back to the Web Client.
• Static Assets are served by Flask to ensure the browser has the necessary styling and images.
• Deployment configurations (Procfile for Heroku, vercel.json for Vercel) guide how the application is hosted in production.
Important architectural patterns
• MVC (ish) Approach – Although Flask doesn’t enforce strict MVC, there is a separation between view (templates & static assets), controller (Flask routes in app.py), and the external model (data from the CoinMarketCap API).
• Environment Configuration – By using a .env file, configuration details (like your API key) are abstracted from the code, which is a good security and flexibility practice.
Relevant technologies and frameworks
• Python and Flask for server-side logic.
• HTML/CSS for client-side rendering (in the templates and static files).
• CoinMarketCap API for sourcing cryptocurrency price data.
• Optional deployment tools like Heroku and Vercel (as indicated by Procfile and vercel.json).
Instructing the Principal Software Engineer
• The user’s browser is at the top.
• This to a node labeled "Flask Application Server (app.py)".
• Inside or adjacent to this node, show internal routing logic, pointing out that HTML templates and static files form the view.
• Annotations for environment configuration (.env) that ensures API keys are securely used within the Flask app.
• Around the perimeter, include deployment symbols (e.g., Heroku/Vercel) indicating production setup.
• Data flow:
→ Browser sends requests to Flask routes.
→ Flask handles the request, consults the external API as needed.
→ Flask assembles the data into templates.
→ Rendered HTML along with static assets is sent back to the browser.