File size: 2,501 Bytes
25f22bf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# Backend Structure Plan
## Directory Structure
```
backend/
βββ app.py # Flask application entry point
βββ config.py # Configuration settings
βββ requirements.txt # Python dependencies
βββ .env # Environment variables
βββ models/ # Database models
β βββ __init__.py
β βββ user.py # User model
β βββ social_account.py # Social media account model
β βββ source.py # RSS source model
β βββ post.py # Post content model
β βββ schedule.py # Scheduling model
βββ api/ # API endpoints
β βββ __init__.py
β βββ auth.py # Authentication endpoints
β βββ sources.py # Source management endpoints
β βββ accounts.py # Social account endpoints
β βββ posts.py # Post management endpoints
β βββ schedules.py # Scheduling endpoints
βββ services/ # Business logic
β βββ __init__.py
β βββ auth_service.py # Authentication service
β βββ linkedin_service.py# LinkedIn integration service
β βββ content_service.py # Content generation service
β βββ schedule_service.py# Scheduling service
βββ utils/ # Utility functions
β βββ __init__.py
β βββ database.py # Database connection
β βββ helpers.py # Helper functions
βββ scheduler/ # Task scheduling
βββ __init__.py
βββ task_scheduler.py # Scheduling implementation
```
## Key Components
### app.py
- Flask application initialization
- Configuration loading
- Blueprint registration
- CORS setup
- Error handlers
### config.py
- Environment-based configuration
- Database settings
- API keys and secrets
- Scheduler settings
### models/
- SQLAlchemy models for all database entities
- Relationship definitions
- Validation logic
### api/
- RESTful endpoints for all features
- Request validation
- Response formatting
- Authentication middleware
### services/
- Business logic implementation
- External API integrations
- Data processing and transformation
### utils/
- Database connection management
- Helper functions for common operations
- Error handling utilities
### scheduler/
- APScheduler implementation
- Task scheduling and execution
- Conflict resolution |