|
# 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 |