Skip to content

Commit fd1c874

Browse files
committed
rules done correctly.
1 parent e1cece3 commit fd1c874

File tree

7 files changed

+695
-164
lines changed

7 files changed

+695
-164
lines changed

.cursor/.DS_Store

0 Bytes
Binary file not shown.

.cursor/rules/backend-overview.mdc

Lines changed: 0 additions & 102 deletions
This file was deleted.

.cursor/rules/backend-technical-stack.mdc

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ description: Technical Stack Specification for the /backend.
33
globs: backend/*
44
alwaysApply: false
55
---
6-
# Technical Stack Specification - FastAPI Backend Template
7-
86
## 1. Technology Stack Overview
97

108
| Component | Technology | Version | Purpose |
119
|-----------|------------|---------|---------|
1210
| Framework | FastAPI | 0.114.2+ | Web API framework |
1311
| ORM | SQLModel | 0.0.21+ | Database ORM |
14-
| Database | PostgreSQL | 13+ | Relational database |
12+
| Primary Database | PostgreSQL | 13+ | Relational database |
13+
| Document Database | MongoDB | 6.0+ | Social media content storage |
14+
| In-memory Database | Redis | 7.0+ | Caching and real-time operations |
15+
| Vector Database | Pinecone | Latest | Semantic content analysis |
1516
| Authentication | JWT | 2.8.0+ | User authentication |
1617
| Password Hashing | Passlib + Bcrypt | 1.7.4+ | Secure password storage |
1718
| Dependency Management | uv | 0.5.11+ | Package management |
@@ -22,6 +23,10 @@ alwaysApply: false
2223
| Testing | pytest | 7.4.3+ | Unit and integration testing |
2324
| Linting | ruff | 0.2.2+ | Code quality |
2425
| Type Checking | mypy | 1.8.0+ | Static type checking |
26+
| Task Queue | Celery | 5.3.0+ | Asynchronous task processing |
27+
| Message Broker | RabbitMQ | 3.12+ | Task distribution |
28+
| Stream Processing | Apache Kafka | 3.4+ | Real-time data streaming |
29+
| NLP Processing | spaCy + Transformers | 3.6+ / 4.28+ | Content analysis |
2530

2631
## 2. Architecture
2732

@@ -63,26 +68,58 @@ Client Request → API Layer → Service Layer → Repository Layer → Database
6368
├── schemas/ # Pydantic models for API
6469
├── services/ # Business logic
6570
│ └── repositories/ # Data access layer
71+
├── tasks/ # Celery tasks for background processing
72+
│ ├── scraping/ # Social media scraping tasks
73+
│ ├── analysis/ # Content analysis tasks
74+
│ └── notifications/ # Alert and notification tasks
75+
├── processing/ # Data processing components
76+
│ ├── models/ # ML model wrappers
77+
│ ├── streams/ # Kafka stream processors
78+
│ └── embeddings/ # Vector embedding generators
79+
├── worker.py # Celery worker configuration
6680
└── main.py # Application entry point
6781
```
6882

6983
## 3. Database Design
7084

71-
### 3.1 Database Technology
85+
### 3.1 Hybrid Database Technology
86+
87+
The application employs a hybrid database architecture to address the diverse data requirements of political social media analysis:
88+
89+
| Component | Technology | Version | Purpose |
90+
|-----------|------------|---------|---------|
91+
| Relational Database | PostgreSQL | 13+ | Entity data and relationships |
92+
| Document Database | MongoDB | 6.0+ | Social media content and engagement |
93+
| In-memory Database | Redis | 7.0+ | Caching and real-time operations |
94+
| Vector Database | Pinecone | Latest | Semantic similarity analysis |
95+
96+
Refer to `database-architecture.mdc` for detailed implementation specifications.
97+
98+
### 3.2 Primary Domain Models
7299

73-
PostgreSQL with SQLModel ORM (SQLAlchemy + Pydantic integration)
100+
- **User**: Authentication and user profile data
101+
- **PoliticalEntity**: Political figures, organizations, and campaigns
102+
- **SocialMediaAccount**: Platform account connections
103+
- **EntityRelationship**: Relationships between political entities
74104

75-
### 3.2 Key Design Decisions
105+
### 3.3 Key Design Decisions
76106

77107
- **UUID Primary Keys**: All entities use UUID primary keys for security and distributed system compatibility
108+
- **Cross-database References**: Consistent reference patterns between databases
78109
- **Relationship Management**: Proper foreign key constraints with cascade delete
79110
- **String Field Constraints**: Appropriate length limits on all VARCHAR fields
80111
- **Migration Strategy**: Alembic for version-controlled schema changes
81112

82-
### 3.3 Primary Domain Models
113+
### 3.4 Additional Dependencies
83114

84-
- **User**: Authentication and user profile data
85-
- **Item**: Example resource with owner relationship to User
115+
| Dependency | Version | Purpose |
116+
|------------|---------|---------|
117+
| motor | 3.2.0+ | Async MongoDB driver |
118+
| redis | 4.6.0+ | Redis client |
119+
| pinecone-client | 2.2.1+ | Pinecone Vector DB client |
120+
| pymongo | 4.5.0+ | MongoDB client |
121+
122+
Refer to `data-processing-architecture.mdc` for details on processing pipelines and analysis components.
86123

87124
## 4. API Design
88125

0 commit comments

Comments
 (0)