Blogify is a high-performance, developer-first, and highly decoupled digital publishing platform. Crafted with a premium multi-package workspace architecture, it leverages a high-throughput FastAPI backend integrated with Google Gemini AI and a reactive, beautiful Flutter Web client.
The workspace is structured into highly decoupled, specialized packages to separate concerns and ensure scalable maintenance:
Blogify/
├── packages/
│ ├── api/ # 🐍 Backend Service Layer (FastAPI)
│ │ ├── app/
│ │ │ ├── core/ # Configuration (Pydantic Settings), DB Engine, JWT Auth
│ │ │ ├── api/ # Routers (REST Endpoints for Auth, Articles, AI, Search)
│ │ │ ├── models/ # Database Schemas (SQLAlchemy ORM)
│ │ │ └── schemas/ # Contract Validation Models (Pydantic v2)
│ │ └── Dockerfile # Container Build Specification
│ │
│ └── web/ # 💙 Frontend Client Layer (Flutter Web)
│ ├── lib/
│ │ ├── core/ # Type-Safe ApiClient, Extensions, Theme Controllers
│ │ └── features/ # Feature Modules (Auth, Editor, Feed, Profile, Search)
│ └── pubspec.yaml
│
├── docker-compose.yml # 🐳 Orchestration Blueprint
└── .env # 🔑 Workspace Environment Configurations
- Layered Architecture: Divided into strict routers, service handlers, model schemas, and data access layers.
- Contract First: Enforces type safety and request/response integrity using Pydantic v2 validation.
- Standardized REST Communication: Wraps all API payloads in a unified
ResponseEnvelope<T>schema for consistent frontend serialization. - Secure Authentication Pipeline: Multi-tier authentication supporting stateless JWT tokens (with customizable refresh-expire lifecycles) alongside secure Google OAuth token validation.
- Reactive MVC Pattern: Fully reactive state flows built using GetX Controllers to bind model modifications instantly to active UI components.
- Type-Safe Network Engine: Features a custom HTTP network client based on Dio with global interception to automatically inject authentication headers and gracefully handle telemetry errors.
- Responsive Editorial UI: Designed with fully adaptive layout constraints supporting responsive drawer navigations, collapsible sidebars, and fluid screen transitions.
- Cognitive Writing Suite: The backend proxy routes requests directly to the state-of-the-art
gemini-2.5-flashmodel. - NLP Text Modification AST: Enables context-aware structural edits on articles. Users can perform advanced prompt execution to lengthen, condense, check grammar, or dynamically adjust styling and tone.
- Cursor-Aware Formatting UX: Features sophisticated selection-capturing logic. Applying inline formatting automatically selects placeholders or places the active cursor outside the Markdown delimiters, providing an optimal editing experience.
- Premium Visual Stacking: Interactive authorization layouts render multiple glowing color-blending neon blobs overlaid with a
130px BackdropFilterand custom dark gradient shaders to achieve sleek glassmorphism. - Dynamic Article Teaser Cards: Homepage article cards dynamically clamp titles to
2lines and mute previews to1line, formatting the grid feed into a distraction-free layout.
- Direct In-Place Updating: Profile views automatically detect session owner relationships (
isOwnProfile) and inject premium action overlays on the author's own articles. - Controller Synchronization: Triggers GetX
initForEdit(article)to pre-populate text fields, tags, and cover images from database models. - Draft Cleansing: The global navigation bar triggers
editorCtrl.reset()when initiating fresh draft sessions, protecting the state controller from cache pollution.
- API Rate-Limiting: Incorporates a
600mstyping throttle (debounce) inside the frontend SearchController to shield database instances from rapid keyboard input spikes.
A Docker-based local development environment builds, runs, and monitors services cleanly without host machine dependency conflicts.
graph TD
subgraph Net ["Container Networking (medium-network)"]
Client["Browser / Flutter Client"] -->|"Port 8000"| FastAPI["FastAPI App Container (medium-api)"]
FastAPI -->|"Port 5432"| DB[("PostgreSQL Database (medium-db)")]
Admin["Developer / Admin"] -->|"Port 5050"| pgAdmin["pgAdmin Container (medium-pgadmin)"]
pgAdmin --> DB
end
DB_Volume[("postgres_data (Persistent Volume)")] --- DB
API_Volume["packages/api (Local Volume Mount)"] --- FastAPI
- FastAPI Application Service (
medium-api):- Port Mapping: Maps local host port
8000to internal container port8000. - Hot-Reload Developer Experience (DX): Mounts
./packages/api:/appas a local host volume. Any backend python updates instantly trigger an internal live-reload without rebuilding the container. - Startup Health Checking: Pings
http://localhost:8000/healthto block downstream routing until the ASGI server is ready.
- Port Mapping: Maps local host port
- PostgreSQL 16 Engine (
medium-db):- Port Mapping: Exposes port
5432. - Persistent Storage: Links named volume
postgres_datato/var/lib/postgresql/dataensuring database data survives restarts.
- Port Mapping: Exposes port
- pgAdmin 4 Administration Interface (
medium-pgadmin):- Port Mapping: Visualizes databases on port
5050. Use the PGADMIN credentials configured in your.env(defaulting toadmin@admin.com/admin123) to query PostgreSQL schemas visually.
- Port Mapping: Visualizes databases on port
Initialize a root-level .env file with the following specifications:
# Gemini AI Platform Credentials
GEMINI_API_KEY=your_gemini_api_key_here
# OAuth Identification
GOOGLE_CLIENT_ID=your_google_oauth_client_id_here
# PostgreSQL Container Credentials
POSTGRES_USER=your_postgres_user
POSTGRES_PASSWORD=your_postgres_password
POSTGRES_DB=your_postgres_db
# Custom database connection URL (for running outside Docker)
# DATABASE_URL=postgresql+asyncpg://your_postgres_user:your_postgres_password@localhost:5432/your_postgres_dbInitiate and build backend service nodes in detached mode:
docker compose up --build -d- Interactive API documentation (Swagger UI): Accessible at
http://localhost:8000/docs. - Database Panel (pgAdmin): Accessible at
http://localhost:5050.
# Navigate to the frontend directory
cd packages/web
# Pull dependencies
flutter pub get
# Launch the reactive web client locally in Google Chrome
flutter run -d chrome| Command | Action |
|---|---|
docker compose up --build -d |
Compiles modifications and launches backend infrastructure. |
docker compose down |
Stops and gracefully cleans up active containers. |
docker compose logs -f api |
Follows stdout/stderr streams from the FastAPI server. |
docker compose exec db psql -U postgres -d medium_db |
Connects directly to the PostgreSQL console. |
docker compose down -v |
Deletes persistent database storage volumes. |