@@ -79,6 +79,14 @@ It's built for developers who want to grow their professional presence without s
7979
8080## 🆕 Recent Updates (December 2025)
8181
82+ ### Clean Architecture Refactor
83+
84+ - ** Modular Backend** : ` app.py ` refactored from 1832 → ~ 200 lines
85+ - ** SQLAlchemy Schema** : Type-safe table definitions in ` backend/database/schema.py `
86+ - ** Alembic Migrations** : Professional schema versioning replaces ` init_tables() `
87+ - ** Repository Pattern** : ` BaseRepository ` enforces user_id filtering for multi-tenant isolation
88+ - ** Dependency Injection** : ` get_post_repository() ` and ` get_settings_repository() ` helpers
89+
8290### Security Hardening
8391
8492- ** JWT Authentication** : All 23+ API endpoints now require Clerk JWT verification
@@ -744,20 +752,39 @@ curl https://your-backend.railway.app/openapi.json > openapi.json
744752
745753```
746754linkedin-post-bot/
747- ├── web/ # Next.js Frontend
748- │ ├── src/pages/ # Dashboard, Settings, Onboarding
749- │ ├── src/components/ # UI Components
750- │ └── src/hooks/ # Custom React hooks
751- ├── backend/ # FastAPI Backend
752- │ ├── app.py # API server
753- │ └── middleware/ # Auth middleware
754- ├── services/ # Core Business Logic
755- │ ├── ai_service.py # Groq AI integration
756- │ ├── github_activity.py # GitHub API client
757- │ ├── linkedin_service.py # LinkedIn posting
758- │ └── user_settings.py # Settings storage
759- ├── bot.py # Standalone CLI bot
760- └── auth.py # OAuth helper
755+ ├── web/ # Next.js Frontend
756+ │ ├── src/pages/ # Dashboard, Settings, Onboarding
757+ │ ├── src/components/ # UI Components
758+ │ └── src/hooks/ # Custom React hooks
759+ ├── backend/ # FastAPI Backend (Clean Architecture)
760+ │ ├── app.py # Slim entry point (~200 lines)
761+ │ ├── core/ # Configuration & logging
762+ │ │ └── config.py # Environment, CORS, templates
763+ │ ├── database/ # SQLAlchemy schema
764+ │ │ └── schema.py # Table definitions
765+ │ ├── migrations/ # Alembic migrations
766+ │ │ ├── env.py # Async migration env
767+ │ │ └── versions/ # Migration files
768+ │ ├── repositories/ # Data access layer
769+ │ │ ├── base.py # BaseRepository (user_id filtering)
770+ │ │ ├── posts.py # PostRepository
771+ │ │ └── settings.py # SettingsRepository
772+ │ ├── routes/ # API routers
773+ │ │ ├── github.py # GitHub OAuth + scan
774+ │ │ ├── linkedin.py # LinkedIn OAuth
775+ │ │ └── posts.py # Post generation
776+ │ ├── schemas/ # Pydantic models
777+ │ │ └── requests.py # Request/response models
778+ │ ├── middleware/ # Auth middleware
779+ │ └── dependencies.py # DI helpers
780+ ├── services/ # Core Business Logic
781+ │ ├── ai_service.py # Groq AI integration
782+ │ ├── github_activity.py # GitHub API client
783+ │ ├── linkedin_service.py # LinkedIn posting
784+ │ ├── db.py # Database connection
785+ │ └── user_settings.py # Settings storage
786+ ├── bot.py # Standalone CLI bot
787+ └── auth.py # OAuth helper
761788```
762789
763790---
@@ -998,10 +1025,17 @@ docker run -p 8000:8000 \
9981025## Development
9991026
10001027``` bash
1001- # Run with hot-reload
1002- cd backend && uvicorn app:app --reload --port 8000
1028+ # Run backend with hot-reload (from project root)
1029+ python -m uvicorn backend.app:app --reload --port 8000
1030+
1031+ # Run frontend
10031032cd web && npm run dev
10041033
1034+ # Database migrations (from backend directory)
1035+ cd backend && alembic upgrade head # Apply migrations
1036+ cd backend && alembic revision --autogenerate -m " description" # New migration
1037+ cd backend && alembic downgrade -1 # Rollback one
1038+
10051039# Run tests
10061040cd backend && pytest tests/ -v
10071041cd web && npm test
0 commit comments