How ujitkumar1/blogwave works
Project type and purpose
• BlogWave is a full-stack blogging platform.
• The backend is a Flask-based REST API server that handles user and post CRUD operations, background export tasks (via Celery + Redis), and persisting data in a SQLite database.
• The frontend is a Vue.js single-page application (SPA) that provides views for login, signup, dashboard, post management, user profile, and search.
File structure
• Top-level directories:
• backend/ – Flask app, Celery worker & beat config, static exports, Jinja2 templates, SQLite DB
• ui/ – Vue.js SPA with components, views, router, API wrapper
• database/ – holds the SQLite file for persistence
• Key files in backend/:
• app.py – Flask app + Celery initialization
• celery_system.py – Celery tasks definitions
• APIs.yaml – API spec
• requirements.txt – Python dependencies
• dump.rdb – Redis snapshot (if used)
• Key files in ui/:
• main.js, App.vue, router.js – app bootstrap and routing
• api.js – centralizes HTTP requests to Flask APIs
• components/ and views/ – UI building blocks
• package.json/package-lock.json, vue.config.js – build config
• Deployment/Dev indicators:
• Backend run commands (Flask dev server, Redis, Celery worker & beat)
• Frontend dev server (npm run serve)
README for additional insights
• Describes commands to run Flask, Vue.js, Redis, and Celery.
• Implies a development setup where the Vue.js dev server proxies API calls to the Flask server.
Components
a. User (Browser)
• Initiates HTTP(S) requests to frontend (Vue.js)
• Views rendered in browser, interacts via API calls
b. Frontend (Vue.js SPA)
• Serves static assets (or via webpack dev server)
• router.js handles view transitions
• api.js performs AJAX calls to Flask endpoints
c. Backend (Flask)
• app.py exposes RESTful endpoints (e.g., /posts, /users, /export)
• Business logic layer handles requests, validation, authentication
• Triggers Celery tasks for long-running jobs (static export of blogs)
d. Celery subsystem
• Redis acting as broker and result backend
• Celery worker processes tasks defined in celery_system.py
• Celery beat scheduler enqueues periodic jobs (e.g., cleanup or timed exports)
e. Database (SQLite)
• database/database.db holds application data (users, posts)
• Accessed via an ORM or raw SQL in Flask
f. Static artifacts store
• backend/static/exportJob – holds CSV exports of blog data
• Served by Flask’s static file handler
g. External Services (if any)
• Redis server (broker for Celery)
• Optional: Email service, if used (not shown but could be extended)
Relationships and Data Flows
• Browser → HTTP → Vue.js SPA
• Vue.js → AJAX → Flask API
• Flask → SQL queries → SQLite DB
• Flask → enqueue → Redis broker → Celery worker
• Celery worker → read/write → SQLite DB (if tasks update data)
• Celery worker → generate files → backend/static
• Browser → HTTP → download export files
• Celery beat → schedules tasks → enqueue in Redis
Architectural patterns and design principles
• Separation of concerns: UI (Vue) vs API (Flask) vs background tasks (Celery) vs storage (SQLite/Redis).
• Asynchronous processing: offload heavy or periodic jobs via Celery workers.
• SPA routing and component-based UI in Vue.js.
• RESTful API design in Flask with clear endpoints (as per APIs.yaml).
Summary of elements
• Clear component labels
• Brief notes on deployment (e.g., “npm run serve → Vue dev server on localhost:8080”, “python app.py → Flask on port 5000”, “redis-server”, “celery worker & beat”)