How khalily/oreader works
1. Overall shape
- oReader is a two-tier app: a Flask backend exposing page routes and JSON APIs, plus an AngularJS single-page frontend that runs in the browser.
- The app is designed as an RSS reader/aggregator: users authenticate, subscribe to feeds, and browse stories fetched from external RSS sources.
2. Primary entry points
- manage.py is the local run entry point used by the README (python manage.py runserver).
- Procfile and Procfile.windows indicate deployment/run conventions for Heroku and Windows.
- config.py centralizes environment/app configuration, likely including Flask, database, and session settings.
3. Backend application layout
- The Flask app lives under app/ and is split into feature areas:
- app/main for top-level pages and error handling.
- app/auth for login/registration-related server views and forms.
- app/api for the JSON API consumed by the Angular client.
- app/feedparser for RSS ingestion/parsing logic.
- app/models.py contains the persistent domain model and is the main shared data layer.
4. API boundary
- app/api/resource/* is the clearest backend interface boundary. It appears to expose resources for:
- user
- session
- feed
- story
- app/api/common/schema.py suggests request/response validation or serialization schemas.
- app/api/authentication.py and app/api/errors.py indicate API-level auth and structured error handling separate from page views.
5. Authentication and session flow
- app/auth/forms.py and app/auth/views.py handle browser-facing authentication pages and form processing.
- On the API side, app/api/resource/session.py likely manages login/logout/session state for the Angular app.
- This split suggests both traditional Flask form flows and API-backed session control, with the browser UI relying heavily on the JSON layer.
6. RSS ingestion and content model
- app/feedparser/feedparser.py is the external-content integration layer. It likely fetches and parses RSS/Atom feeds from third-party URLs.
- Parsed feed metadata and story items are then persisted through models.py and exposed via the API.
- This is the main data-ingestion boundary: external RSS sources → parser module → database → API/UI.
7. Frontend architecture
- The browser UI is built from AngularJS assets in app/static/js/:
- app.js bootstraps the Angular app.
- controllers.js, services.js, directives.js, and filters.js split client behavior by responsibility.
- Libraries such as Angular, Restangular, angular-route, angular-cookies, lodash, jQuery, Bootstrap, and sortable.js show a classic Angular 1.x SPA stack.
8. Client views and navigation
- Angular templates live in app/static/partials/ and cover key screens:
- login.html
- welcome.html
- feeds.html
- add_subscription.html
- about.html
- Server-side templates in app/templates/ (base.html, index.html, 404.html) provide the host page and fallback/error rendering.
- The likely flow is: Flask serves the shell page, Angular loads partials and calls the API for data.
9. Static assets and UI presentation
- Styling is bundled locally under app/static/css/ and app/static/lib/bootstrap/, with Font Awesome assets for icons.
- Because the repo vendors frontend libraries instead of pulling them from a CDN, the UI is self-contained and deployment-friendly.
- app/static/preview.png in the README hints the UI is presentation-heavy and modeled after GoRead.
10. Data persistence and environment
- dev-data.sqlite indicates a SQLite-backed development database.
- The architecture likely uses Flask + SQLAlchemy-style persistence through models.py, with data stored locally in dev and a different configured database in production.
- Since Heroku deployment is mentioned, the runtime is expected to be a standard Python web process with environment-based configuration.
11. Error handling boundaries
- There are separate error modules for API and main app routes: app/api/errors.py and app/main/errors.py.
- This suggests distinct handling for browser page failures versus JSON API failures, which is important for diagramming the two response types.
12. What to emphasize in an architecture diagram
- Show three main zones:
- Browser SPA: AngularJS app, partials, static assets.
- Flask backend: auth, main pages, REST resources, error handling.
- External RSS sources + database: feed parser ingests remote feeds into persistent models.
- The core data flow is: user action in Angular → API call → Flask resource → models/database → response back to UI, with a separate RSS fetch/parse pipeline feeding the same persistence layer.
Main entry points: __init__.py App init · app.js Angular app · session.py Session API · models.py Models
Components 21
Browser SPA
AngularJS client, templates, and bundled assets.
- Angular app · Client-side application bootstrap and behavior modules.
app/static/js/app.js - Views · Angular partials for login, feeds, subscriptions, and welcome screens.
- Shell pages · Flask host page and fallback HTML templates.
app/templates/base.html - UI libs · Bundled Angular, jQuery, Bootstrap, and related client libraries.
app/static/lib/angular.js
Flask backend
Server routes, API resources, auth, and error handling.
- Manage · Local run entry point for the Flask app.
manage.py - Config · Central application and environment configuration.
config.py - App init · Flask application bootstrap and wiring.
app/__init__.py - Main views · Top-level browser routes and page rendering.
app/main/views.py - Page errors · Browser-facing error handling.
app/main/errors.py - Auth views · Login and registration page flow.
app/auth/views.py - Auth forms · Server-side authentication forms and validation.
app/auth/forms.py - API auth · JSON API authentication boundary.
app/api/authentication.py - Schemas · Shared API request and response schema definitions.
app/api/common/schema.py - User API · User resource exposed through the JSON API.
app/api/resource/user.py - Session API · Login and logout session state for the SPA.
app/api/resource/session.py - Feed API · Feed subscription resource for the client.
app/api/resource/feed.py - Story API · Story listing and story item resource.
app/api/resource/story.py - API errors · Structured error handling for API responses.
app/api/errors.py
Data layer
RSS ingestion and persistent models.
- Models · Shared domain model and database layer.
app/models.py - RSS parser · Fetches and parses external RSS or Atom feeds.
app/feedparser/feedparser.py - RSS bridge · RSS-facing helper or adapter layer.
app/api/rss.py
Connections 29
- Manage → App init: runs · Local and deployed entry points start the Flask app.
- Config → App init: configures · Application settings are loaded during bootstrap.
- App init → Main views: registers · Flask wires top-level page routes.
- App init → Auth views: registers · Browser authentication routes are part of the app.
- App init → API auth: registers · API authentication boundary is initialized by the app.
- App init → User API: registers · API resources are mounted under the Flask app.
- App init → Session API: registers · Session endpoints are mounted under the Flask app.
- App init → Feed API: registers · Feed endpoints are mounted under the Flask app.
- App init → Story API: registers · Story endpoints are mounted under the Flask app.
- Main views → Shell pages: renders · Page routes serve the host HTML shell.
- Page errors → Shell pages: renders · Browser errors are rendered through server templates.
- Auth views → Auth forms: uses · Auth pages validate requests with server-side forms.
- Auth views → Shell pages: renders · Authentication pages are delivered in the HTML shell.
- API auth → Session API: guards · API auth behavior is centered on session handling.
- User API → Schemas: validates · User payloads use shared schema definitions.
- Session API → Schemas: validates · Session payloads use shared schema definitions.
- Feed API → Models: persists · Feed resources read and write the shared model layer.
- Story API → Models: persists · Story resources read and write the shared model layer.
- User API → Models: persists · User resources are backed by persistent models.
- Session API → Models: persists · Session state is backed by persistent models.
- RSS bridge → RSS parser: delegates · RSS-facing helper code forwards ingestion work to the parser.
- RSS parser → Models: loads · Parsed feeds and stories are stored through the model layer.
- Angular app → Views: loads · Client bootstrap routes the SPA to partial views.
- Angular app → UI libs: depends on · Angular app behavior relies on bundled third-party libraries.
- Angular app → Session API: calls · The SPA uses JSON session endpoints for login state.
- Angular app → Feed API: calls · Feed management is driven through the API.
- Angular app → Story API: calls · Story browsing is driven through the API.
- Angular app → User API: calls · User data and profile actions flow through the API.
- Shell pages → Angular app: hosts · Server templates provide the HTML container for the SPA.