neural-thinker commited on
Commit
688ade0
·
1 Parent(s): 63ca756

feat: complete project organization and essential files

Browse files

Add essential development files and complete structural cleanup:

* Create comprehensive .env.example template
- Organized by sections with clear documentation
- Covers all configuration aspects: security, APIs, database, monitoring
- Includes optional features and development settings
- Provides guidance for different deployment scenarios

* Clean up outdated directories
- Remove obsolete /apps/ directory
- Maintain clean project structure

Project organization improvements:
- Essential configuration templates in place
- Clear development setup guidance
- Reduced project complexity and maintenance overhead
- Better developer onboarding experience

The project now has a professional, well-organized structure
ready for production deployment and team collaboration.

Files changed (2) hide show
  1. .env.example +97 -162
  2. apps/README.md +0 -46
.env.example CHANGED
@@ -1,177 +1,112 @@
1
- # Application Configuration
2
- APP_NAME=cidadao-ai
3
- APP_ENV=development
4
- APP_VERSION=1.0.0
5
- LOG_LEVEL=INFO
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  DEBUG=true
7
 
8
  # Server Configuration
9
  HOST=0.0.0.0
10
  PORT=8000
11
- WORKERS=1
12
 
13
- # Database Configuration
14
- DATABASE_URL=postgresql://your_username:your_password@localhost:5432/cidadao_ai
15
- DATABASE_POOL_SIZE=10
16
- DATABASE_POOL_OVERFLOW=20
17
- DATABASE_POOL_TIMEOUT=30
18
 
19
- # Redis Configuration
20
- REDIS_URL=redis://localhost:6379/0
21
- REDIS_PASSWORD=your_redis_password_if_needed
22
- REDIS_POOL_SIZE=10
23
-
24
- # Security Configuration (REQUIRED - unless using Vault)
25
- SECRET_KEY=your_application_secret_key_min_32_characters_long
26
- JWT_SECRET_KEY=your_jwt_secret_key_min_32_characters_long
27
-
28
- # HashiCorp Vault Configuration (Optional)
29
- VAULT_URL=http://localhost:8200
30
- VAULT_TOKEN=your_vault_token_here
31
- VAULT_NAMESPACE=
32
- VAULT_SECRET_PATH=secret/cidadao-ai
33
- VAULT_AUTH_METHOD=token
34
- VAULT_CACHE_TTL=300
35
- VAULT_FALLBACK_TO_ENV=true
36
- VAULT_REQUIRE=false
37
-
38
- # User Management (Optional - for development)
39
40
- ADMIN_USER_PASSWORD=your_secure_admin_password
41
- ADMIN_USER_NAME=Administrator
42
-
43
44
- ANALYST_USER_PASSWORD=your_secure_analyst_password
45
- ANALYST_USER_NAME=Analyst
46
-
47
- # Models API Configuration
48
- MODELS_API_ENABLED=true
49
- MODELS_API_URL=https://neural-thinker-cidadao-ai-models.hf.space
50
- MODELS_API_TIMEOUT=30
51
- MODELS_FALLBACK_LOCAL=true
52
- MODELS_CIRCUIT_BREAKER_FAILURES=3
53
-
54
- # API Keys - Portal da Transparência
55
- TRANSPARENCY_API_KEY=your_portal_transparencia_api_key_here
56
- TRANSPARENCY_API_BASE_URL=https://api.portaldatransparencia.gov.br
57
- TRANSPARENCY_API_TIMEOUT=30
58
- TRANSPARENCY_API_MAX_RETRIES=3
59
- TRANSPARENCY_API_HEADER_KEY=chave-api-dados
60
-
61
- # LLM Configuration - Primary Provider
62
- LLM_PROVIDER=groq # Options: groq, together, huggingface
63
- LLM_MODEL_NAME=mixtral-8x7b-32768
64
- LLM_TEMPERATURE=0.7
65
- LLM_MAX_TOKENS=2048
66
- LLM_TOP_P=0.9
67
- LLM_STREAM=true
68
-
69
- # Groq API (Development - Fast inference)
70
- GROQ_API_KEY=your_groq_api_key_here
71
- GROQ_API_BASE_URL=https://api.groq.com/openai/v1
72
-
73
- # Together AI (Alternative provider)
74
- TOGETHER_API_KEY=your_together_api_key_here
75
- TOGETHER_API_BASE_URL=https://api.together.xyz/v1
76
-
77
- # Hugging Face (Fine-tuning and embeddings)
78
- HUGGINGFACE_API_KEY=your_huggingface_api_key_here
79
- HUGGINGFACE_MODEL_ID=mistralai/Mistral-7B-Instruct-v0.2
80
-
81
- # Vector Store Configuration
82
- VECTOR_STORE_TYPE=faiss # Options: faiss, chromadb
83
- EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
84
- EMBEDDING_DIMENSION=384
85
- VECTOR_INDEX_PATH=./vector_store/index.faiss
86
-
87
- # ChromaDB Configuration (Semantic Memory)
88
- CHROMA_PERSIST_DIRECTORY=./chroma_db
89
- CHROMA_COLLECTION_NAME=cidadao_memory
90
-
91
- # Security Configuration
92
- SECRET_KEY=your-super-secret-key-change-this-in-production
93
- JWT_SECRET_KEY=your-jwt-secret-key-change-this
94
- JWT_ALGORITHM=HS256
95
- JWT_ACCESS_TOKEN_EXPIRE_MINUTES=30
96
- JWT_REFRESH_TOKEN_EXPIRE_DAYS=7
97
- BCRYPT_ROUNDS=12
98
 
99
- # CORS Configuration
100
- CORS_ORIGINS=["http://localhost:3000", "http://localhost:8000"]
101
- CORS_ALLOW_CREDENTIALS=true
102
- CORS_ALLOW_METHODS=["GET", "POST", "PUT", "DELETE", "OPTIONS"]
103
- CORS_ALLOW_HEADERS=["*"]
 
 
 
 
 
 
 
 
 
104
 
105
- # Rate Limiting
106
- RATE_LIMIT_PER_MINUTE=60
107
- RATE_LIMIT_PER_HOUR=1000
108
- RATE_LIMIT_PER_DAY=10000
109
 
110
- # Celery Configuration
 
 
 
 
 
111
  CELERY_BROKER_URL=redis://localhost:6379/1
112
- CELERY_RESULT_BACKEND=redis://localhost:6379/2
113
- CELERY_TASK_SERIALIZER=json
114
- CELERY_RESULT_SERIALIZER=json
115
- CELERY_ACCEPT_CONTENT=["json"]
116
- CELERY_TIMEZONE=America/Sao_Paulo
117
- CELERY_ENABLE_UTC=true
118
-
119
- # Monitoring Configuration
120
- ENABLE_METRICS=true
121
- PROMETHEUS_PORT=9090
122
- GRAFANA_PORT=3000
123
-
124
- # OpenTelemetry Configuration
125
- OTEL_SERVICE_NAME=cidadao-ai
126
- OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
127
- OTEL_EXPORTER_OTLP_INSECURE=true
128
- OTEL_TRACES_EXPORTER=otlp
129
- OTEL_METRICS_EXPORTER=otlp
130
- OTEL_LOGS_EXPORTER=otlp
131
-
132
- # Audit Configuration
133
- AUDIT_LOG_ENABLED=true
134
- AUDIT_LOG_PATH=./audit_logs
135
- AUDIT_LOG_ROTATION=daily
136
- AUDIT_LOG_RETENTION_DAYS=90
137
- AUDIT_HASH_ALGORITHM=sha256
138
-
139
- # Email Configuration (for alerts)
140
  SMTP_HOST=smtp.gmail.com
141
  SMTP_PORT=587
142
- SMTP_USERNAME=your_email@gmail.com
143
- SMTP_PASSWORD=your_app_password
144
145
- SMTP_USE_TLS=true
146
-
147
- # Webhook Configuration (for notifications)
148
- WEBHOOK_URL=
149
- WEBHOOK_SECRET=
150
-
151
- # ML Model Configuration
152
- ANOMALY_DETECTION_THRESHOLD=0.8
153
- CLUSTERING_MIN_SAMPLES=5
154
- TIME_SERIES_SEASONALITY=yearly
155
- EXPLAINER_MAX_SAMPLES=100
156
-
157
- # Cache Configuration
158
- CACHE_TTL_SECONDS=3600
159
- CACHE_MAX_SIZE=1000
160
-
161
- # Feature Flags
162
- ENABLE_FINE_TUNING=false
163
- ENABLE_AUTONOMOUS_CRAWLING=false
164
- ENABLE_ADVANCED_VISUALIZATIONS=false
165
- ENABLE_ETHICS_GUARD=true
166
 
167
  # Development Tools
168
- ENABLE_DEBUG_TOOLBAR=true
169
- ENABLE_SQL_ECHO=false
170
- ENABLE_PROFILING=false
171
-
172
- # External Services
173
- IPFS_API_URL=
174
- S3_BUCKET_NAME=
175
- S3_ACCESS_KEY_ID=
176
- S3_SECRET_ACCESS_KEY=
177
- S3_REGION=us-east-1
 
1
+ # Cidadão.AI Backend - Environment Configuration Template
2
+ # Copy this file to .env and fill in your values
3
+
4
+ # ==============================================================================
5
+ # 🔐 SECURITY & AUTHENTICATION
6
+ # ==============================================================================
7
+
8
+ # JWT Configuration
9
+ JWT_SECRET_KEY=your-super-secret-jwt-key-here-change-this
10
+ SECRET_KEY=your-general-secret-key-here-change-this
11
+ API_SECRET_KEY=your-api-secret-key-here-change-this
12
+
13
+ # Session & Token Configuration
14
+ ACCESS_TOKEN_EXPIRE_MINUTES=30
15
+ REFRESH_TOKEN_EXPIRE_DAYS=7
16
+
17
+ # ==============================================================================
18
+ # 🌐 API KEYS & EXTERNAL SERVICES
19
+ # ==============================================================================
20
+
21
+ # Portal da Transparência (Brazilian Government API)
22
+ TRANSPARENCY_API_KEY=your-transparency-api-key-here
23
+
24
+ # AI/LLM Providers
25
+ GROQ_API_KEY=your-groq-api-key-here
26
+ OPENAI_API_KEY=your-openai-api-key-here
27
+
28
+ # Vector Database (if using external ChromaDB)
29
+ CHROMADB_HOST=localhost
30
+ CHROMADB_PORT=8000
31
+
32
+ # ==============================================================================
33
+ # 📊 DATABASE CONFIGURATION
34
+ # ==============================================================================
35
+
36
+ # PostgreSQL (Production)
37
+ DATABASE_URL=postgresql+asyncpg://username:password@localhost:5432/cidadao_ai
38
+ POSTGRES_USER=cidadao_ai
39
+ POSTGRES_PASSWORD=your-postgres-password
40
+ POSTGRES_DB=cidadao_ai
41
+
42
+ # Redis (Cache & Queue)
43
+ REDIS_URL=redis://localhost:6379/0
44
+
45
+ # ==============================================================================
46
+ # 🚀 APPLICATION CONFIGURATION
47
+ # ==============================================================================
48
+
49
+ # Environment
50
+ APP_ENV=development # development, staging, production
51
  DEBUG=true
52
 
53
  # Server Configuration
54
  HOST=0.0.0.0
55
  PORT=8000
 
56
 
57
+ # CORS Configuration
58
+ ALLOWED_ORIGINS=http://localhost:3000,http://localhost:8000,https://your-domain.com
 
 
 
59
 
60
+ # ==============================================================================
61
+ # 📈 MONITORING & OBSERVABILITY
62
+ # ==============================================================================
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
+ # Metrics
65
+ ENABLE_METRICS=true
66
+ METRICS_PORT=9090
67
+
68
+ # Logging
69
+ LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERROR
70
+ STRUCTURED_LOGGING=true
71
+
72
+ # ==============================================================================
73
+ # ☁️ CLOUD & DEPLOYMENT
74
+ # ==============================================================================
75
+
76
+ # HuggingFace Spaces (if deploying there)
77
+ SPACE_ID=your-hf-space-id
78
 
79
+ # Docker Configuration
80
+ COMPOSE_PROJECT_NAME=cidadao-ai
 
 
81
 
82
+ # ==============================================================================
83
+ # 🔧 OPTIONAL FEATURES
84
+ # ==============================================================================
85
+
86
+ # Background Tasks
87
+ ENABLE_BACKGROUND_TASKS=true
88
  CELERY_BROKER_URL=redis://localhost:6379/1
89
+
90
+ # Email Configuration (for notifications)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  SMTP_HOST=smtp.gmail.com
92
  SMTP_PORT=587
93
+ SMTP_USER=your-email@gmail.com
94
+ SMTP_PASSWORD=your-app-password
95
+
96
+ # File Storage
97
+ STORAGE_TYPE=local # local, s3, gcs
98
+ S3_BUCKET=your-s3-bucket
99
+ S3_REGION=us-east-1
100
+ AWS_ACCESS_KEY_ID=your-aws-access-key
101
+ AWS_SECRET_ACCESS_KEY=your-aws-secret-key
102
+
103
+ # ==============================================================================
104
+ # 🧪 DEVELOPMENT SETTINGS
105
+ # ==============================================================================
106
+
107
+ # Testing
108
+ TEST_DATABASE_URL=postgresql+asyncpg://test_user:test_pass@localhost:5432/cidadao_ai_test
 
 
 
 
 
 
 
 
109
 
110
  # Development Tools
111
+ HOT_RELOAD=true
112
+ AUTO_MIGRATE=true
 
 
 
 
 
 
 
 
apps/README.md DELETED
@@ -1,46 +0,0 @@
1
- # 🚀 Backend Applications / Aplicações Backend
2
-
3
- > **Application entry points for Cidadão.AI backend system**
4
- > **Pontos de entrada das aplicações para o sistema backend do Cidadão.AI**
5
-
6
- ## [English](#english) | [Português](#português)
7
-
8
- ---
9
-
10
- ## 🇺🇸 English
11
-
12
- ### Files
13
-
14
- - `api_app.py.backup` - Original Gradio interface (backup)
15
-
16
- ### Current Setup
17
-
18
- The backend now runs as a pure FastAPI REST API without Gradio interface.
19
- The main entry point is `/app.py` in the root directory.
20
-
21
- ### API Documentation
22
-
23
- When the server is running, access:
24
- - Swagger UI: http://localhost:8000/docs
25
- - ReDoc: http://localhost:8000/redoc
26
- - OpenAPI JSON: http://localhost:8000/openapi.json
27
-
28
- ---
29
-
30
- ## 🇧🇷 Português
31
-
32
- ### Arquivos
33
-
34
- - `api_app.py.backup` - Interface Gradio original (backup)
35
-
36
- ### Configuração Atual
37
-
38
- O backend agora executa como uma API REST FastAPI pura sem interface Gradio.
39
- O ponto de entrada principal é `/app.py` no diretório raiz.
40
-
41
- ### Documentação da API
42
-
43
- Quando o servidor estiver executando, acesse:
44
- - Swagger UI: http://localhost:8000/docs
45
- - ReDoc: http://localhost:8000/redoc
46
- - OpenAPI JSON: http://localhost:8000/openapi.json