Skip to content

Restructure#11

Merged
chefmatteo merged 12 commits into
mainfrom
restructure
Mar 25, 2026
Merged

Restructure#11
chefmatteo merged 12 commits into
mainfrom
restructure

Conversation

@chefmatteo

@chefmatteo chefmatteo commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Authentication and User Management:

  • All email addresses are now normalized (trimmed and lowercased) during registration and login in both the backend.*This prevents issues with duplicate accounts and ensures consistent authentication.
  • The frontend login flow now provides more detailed and user-friendly error messages for various authentication failures, including connection issues, disabled accounts, and backend availability.

Frontend Features:

  • Added a new EditProfileScreen in the Flutter app, allowing users to update their profile information with form validation, error handling, and API integration.

Security and Environment Configuration:

  • Hardcoded Google Maps API keys have been removed from both Android and iOS configuration files and replaced with placeholders, reducing the risk of accidental credential exposure.
  • Backend and script setup now consistently use the virtual environment’s pip and executables to avoid issues with system-managed Python environments and to improve cross-platform reliability.
  • Updated pydantic dependency to use a version range (>=2.11.7) for better compatibility and future-proofing.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added profile editing capability for authenticated users.
    • Introduced activity tracking backend service.
  • Bug Fixes

    • Fixed email handling to be case-insensitive during authentication.
  • Improvements

    • Secured Google Maps API credentials with placeholder values.
    • Unified backend startup process with centralized orchestrator.
    • Enhanced project architecture with modular microservices.
  • Documentation

    • Updated setup instructions for new unified backend structure.
    • Added secret scanning guidelines.

@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 159 files, which is 9 over the limit of 150.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a511059b-7791-4141-9f76-2045da6e786f

📥 Commits

Reviewing files that changed from the base of the PR and between 4c1ab67 and c7de357.

⛔ Files ignored due to path filters (2)
  • backend/__pycache__/run.cpython-311.pyc is excluded by !**/*.pyc
  • frontend/ios/Podfile.lock is excluded by !**/*.lock
📒 Files selected for processing (159)
  • .github/workflows/docker-images.yml
  • .github/workflows/tests.yml
  • .gitignore
  • README.md
  • backend/README.md
  • backend/activity-backend/.dockerignore
  • backend/activity-backend/.env.example
  • backend/activity-backend/.gitignore
  • backend/activity-backend/CURL_TESTS.md
  • backend/activity-backend/Dockerfile
  • backend/activity-backend/FRONTEND_ACTIVITY_API_SCHEMA.md
  • backend/activity-backend/README.md
  • backend/activity-backend/SUPABASE_SETUP.sql
  • backend/activity-backend/config.py
  • backend/activity-backend/main.py
  • backend/activity-backend/middleware/auth.py
  • backend/activity-backend/models.py
  • backend/activity-backend/requirements.txt
  • backend/activity-backend/routes/activities.py
  • backend/activity-backend/run.py
  • backend/activity-backend/services/supabase_client.py
  • backend/community-backend/.dockerignore
  • backend/community-backend/.env.example
  • backend/community-backend/.gitignore
  • backend/community-backend/Dockerfile
  • backend/community-backend/README.md
  • backend/community-backend/config.py
  • backend/community-backend/doc/README.md
  • backend/community-backend/doc/TEST_RESULTS.md
  • backend/community-backend/main.py
  • backend/community-backend/middleware/auth.py
  • backend/community-backend/models/community.py
  • backend/community-backend/requirements.txt
  • backend/community-backend/routes/comments.py
  • backend/community-backend/routes/posts.py
  • backend/community-backend/routes/subthreads.py
  • backend/community-backend/run.py
  • backend/community-backend/services/supabase_client.py
  • backend/docker-compose.yml
  • backend/main-backend/.dockerignore
  • backend/main-backend/.env.example
  • backend/main-backend/.gitignore
  • backend/main-backend/.python-version
  • backend/main-backend/Dockerfile
  • backend/main-backend/README.md
  • backend/main-backend/app/api/dependencies.py
  • backend/main-backend/app/api/v1/__init__.py
  • backend/main-backend/app/api/v1/activities/__init__.py
  • backend/main-backend/app/api/v1/activities/helpers.py
  • backend/main-backend/app/api/v1/activities/routes.py
  • backend/main-backend/app/api/v1/auth.py
  • backend/main-backend/app/api/v1/notifications.py
  • backend/main-backend/app/api/v1/users.py
  • backend/main-backend/app/core/config.py
  • backend/main-backend/app/core/jwt.py
  • backend/main-backend/app/core/security.py
  • backend/main-backend/app/core/storage.py
  • backend/main-backend/app/core/supabase/__init__.py
  • backend/main-backend/app/core/supabase/activities.py
  • backend/main-backend/app/core/supabase/base.py
  • backend/main-backend/app/core/supabase/comments.py
  • backend/main-backend/app/core/supabase/posts.py
  • backend/main-backend/app/core/supabase/profiles.py
  • backend/main-backend/app/core/supabase/subthreads.py
  • backend/main-backend/app/core/supabase/users.py
  • backend/main-backend/app/main.py
  • backend/main-backend/app/schemas/__init__.py
  • backend/main-backend/app/schemas/activity.py
  • backend/main-backend/doc/README.md
  • backend/main-backend/pytest.ini
  • backend/main-backend/requirements-test.txt
  • backend/main-backend/requirements.txt
  • backend/main-backend/run.py
  • backend/main-backend/tests/README.md
  • backend/main-backend/tests/__init__.py
  • backend/main-backend/tests/conftest.py
  • backend/main-backend/tests/run_tests.sh
  • backend/main-backend/tests/test_auth.py
  • backend/main-backend/tests/test_jwt.py
  • backend/main-backend/tests/test_main.py
  • backend/main-backend/tests/test_security.py
  • backend/main-backend/tests/test_storage.py
  • backend/main-backend/tests/test_users.py
  • backend/map-backend/.dockerignore
  • backend/map-backend/.env.example
  • backend/map-backend/.gitignore
  • backend/map-backend/CURL_TESTS.md
  • backend/map-backend/Dockerfile
  • backend/map-backend/LOCAL_SETUP.md
  • backend/map-backend/README.md
  • backend/map-backend/config.py
  • backend/map-backend/main.py
  • backend/map-backend/middleware/auth.py
  • backend/map-backend/models/elevation.py
  • backend/map-backend/models/maps.py
  • backend/map-backend/requirements.txt
  • backend/map-backend/routes/elevation.py
  • backend/map-backend/routes/maps.py
  • backend/map-backend/run.py
  • backend/map-backend/services/dynamic_map_client.py
  • backend/map-backend/services/elevation_client.py
  • backend/map-backend/services/static_map_client.py
  • backend/map-backend/services/supabase_client.py
  • backend/requirements.txt
  • backend/run.py
  • backend/shared/__init__.py
  • backend/shared/contract_tests.py
  • backend/shared/contracts.py
  • backend/shared/deprecation.py
  • backend/shared/exception_handlers.py
  • backend/shared/middleware.py
  • backend/shared/query_migration.py
  • community-backend/run.sh
  • docker-compose.yml
  • docs/TESTING.md
  • docs/service-ownership.md
  • frontend/.dockerignore
  • frontend/Dockerfile
  • frontend/android/app/src/main/AndroidManifest.xml
  • frontend/doc/architecture_map_service.md
  • frontend/ios/Runner/Info.plist
  • frontend/lib/providers/notification_provider.dart
  • frontend/lib/screens/profile/edit_profile_screen.dart
  • frontend/lib/services/api_service.dart
  • frontend/lib/services/apis/activities_api.dart
  • frontend/lib/services/apis/auth_api.dart
  • frontend/lib/services/apis/community_api.dart
  • frontend/lib/services/apis/notifications_api.dart
  • frontend/lib/services/apis/users_api.dart
  • frontend/lib/services/service_registry.dart
  • main-backend/.venv/bin/Activate.ps1
  • main-backend/.venv/bin/activate
  • main-backend/.venv/bin/activate.csh
  • main-backend/.venv/bin/activate.fish
  • main-backend/.venv/bin/dotenv
  • main-backend/.venv/bin/email_validator
  • main-backend/.venv/bin/fastapi
  • main-backend/.venv/bin/httpx
  • main-backend/.venv/bin/pip
  • main-backend/.venv/bin/pip3
  • main-backend/.venv/bin/pip3.11
  • main-backend/.venv/bin/pyrsa-decrypt
  • main-backend/.venv/bin/pyrsa-encrypt
  • main-backend/.venv/bin/pyrsa-keygen
  • main-backend/.venv/bin/pyrsa-priv2pub
  • main-backend/.venv/bin/pyrsa-sign
  • main-backend/.venv/bin/pyrsa-verify
  • main-backend/.venv/bin/python
  • main-backend/.venv/bin/python3
  • main-backend/.venv/bin/python3.11
  • main-backend/.venv/bin/uvicorn
  • main-backend/.venv/bin/watchfiles
  • main-backend/.venv/bin/websockets
  • main-backend/.venv/pyvenv.cfg
  • map-backend/Dockerfile
  • map-backend/run.sh
  • scripts/README.md
  • scripts/check_secrets.sh
  • scripts/send_notification.sh

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Repository restructured from separate backend services to unified backend/ directory with microservices architecture. Added new activity-backend and map-backend services, centralized configuration and virtual environment, created orchestrator script for multi-service startup, updated frontend with profile editing and API key placeholders, and added secret scanning tooling.

Changes

Cohort / File(s) Summary
Repository Structure & Configuration
.gitignore, backend/requirements.txt, backend/run.py, backend/.../config.py
Unified backend directory with shared requirements, centralized .venv, and orchestrator script supporting single/all service startup with subprocess management.
Backend Documentation & Setup
README.md, backend/README.md, scripts/README.md, docs/TESTING.md, backend/.../*.md
Reorganized documentation reflecting new backend/ directory layout, updated setup instructions, added health check endpoints, and included secret scanning guidance.
Main Backend Service
backend/main-backend/run.py, backend/main-backend/app/api/v1/auth.py, backend/main-backend/app/core/supabase/users.py
Added dedicated run.py entrypoint, implemented email normalization in login/register flows with audit logging, updated Supabase query to case-insensitive matching.
Community Backend Service
backend/community-backend/config.py, backend/community-backend/main.py, backend/community-backend/run.py, backend/community-backend/requirements.txt, backend/community-backend/README.md
Introduced configuration module with environment-based settings and class hierarchy, added FastAPI app with lifespan management and routers, created standalone entrypoint, relaxed pydantic constraint.
Activity Backend Service
backend/activity-backend/config.py, backend/activity-backend/main.py, backend/activity-backend/run.py, backend/activity-backend/*.md
New microservice with configuration management, FastAPI application setup with Supabase initialization, standalone runner, and API documentation.
Map Backend Service
backend/map-backend/config.py, backend/map-backend/main.py, backend/map-backend/run.py, backend/map-backend/LOCAL_SETUP.md, backend/map-backend/README.md
Relocated service with enhanced config supporting Google Maps API settings, FastAPI app with dual route handlers, standalone entrypoint, and updated setup docs.
Removed Virtual Environment
main-backend/.venv/bin/..., main-backend/.venv/pyvenv.cfg
Deleted 20+ venv activation scripts and configuration files from main-backend (migrated to shared backend/.venv).
Removed Legacy Startup Scripts
community-backend/run.sh, map-backend/run.sh
Obsoleted shell-based service runners replaced by unified Python orchestrator and per-service run.py files.
Frontend Profile Management
frontend/lib/screens/profile/edit_profile_screen.dart
New StatefulWidget for user profile editing with async loading, validation, error handling, and success/failure feedback via SnackBar.
Frontend API & Security
frontend/lib/services/api_service.dart, frontend/android/app/src/main/AndroidManifest.xml, frontend/ios/Runner/Info.plist
Enhanced login with email normalization, refined error handling for auth failures, replaced hardcoded Google Maps API keys with YOUR_GOOGLE_MAPS_API_KEY placeholder.
Security & CI/CD Tooling
scripts/check_secrets.sh, scripts/send_notification.sh, .github/workflows/tests.yml
Added Bash-based secret scanner with ripgrep/grep fallback detecting API keys and tokens, updated CI paths to new backend structure, corrected notification script backend reference.

Sequence Diagram

sequenceDiagram
    participant User
    participant Frontend
    participant Orchestrator as backend/run.py
    participant MainSvc as main-backend/run.py
    participant CommunitySvc as community-backend/run.py
    participant ActivitySvc as activity-backend/run.py
    participant MapSvc as map-backend/run.py

    User->>Frontend: Start app
    Frontend->>Orchestrator: python run.py
    activate Orchestrator
    
    Orchestrator->>MainSvc: subprocess.Popen(run.py)
    activate MainSvc
    Orchestrator->>CommunitySvc: subprocess.Popen(run.py)
    activate CommunitySvc
    Orchestrator->>ActivitySvc: subprocess.Popen(run.py)
    activate ActivitySvc
    Orchestrator->>MapSvc: subprocess.Popen(run.py)
    activate MapSvc
    
    MainSvc->>MainSvc: Load config, start uvicorn
    CommunitySvc->>CommunitySvc: Load config, init Supabase, start uvicorn
    ActivitySvc->>ActivitySvc: Load config, init Supabase, start uvicorn
    MapSvc->>MapSvc: Load config, init Supabase, start uvicorn
    
    MainSvc-->>Orchestrator: Running on 8080
    CommunitySvc-->>Orchestrator: Running on 5001
    ActivitySvc-->>Orchestrator: Running on 5100
    MapSvc-->>Orchestrator: Running on 5200
    
    Frontend->>MainSvc: POST /auth/login (normalized email)
    MainSvc->>MainSvc: Validate, fetch user, audit log
    MainSvc-->>Frontend: JWT token
    
    Frontend->>ActivitySvc: GET /health
    ActivitySvc-->>Frontend: healthy
    
    User->>Frontend: Edit profile
    Frontend->>Frontend: Show EditProfileScreen
    Frontend->>MainSvc: GET /profile (with token)
    MainSvc-->>Frontend: User data
    Frontend->>Frontend: Populate form fields
    User->>Frontend: Submit changes
    Frontend->>MainSvc: PUT /profile (trimmed values)
    MainSvc-->>Frontend: Updated profile
    Frontend->>Frontend: Show success SnackBar
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 Hops through the backend with bounded glee,
Four services now, structured with care—
Emails trimmed low, secrets kept fair,
A profile to edit, a map to see!
Organization blooms, the refactor's complete~ 🌿✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch restructure

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chefmatteo chefmatteo marked this pull request as draft March 20, 2026 23:12
@chefmatteo chefmatteo requested review from ArthurINIA and Copilot and removed request for ArthurINIA and Copilot March 20, 2026 23:21
@chefmatteo chefmatteo marked this pull request as ready for review March 25, 2026 16:43
@chefmatteo chefmatteo merged commit 4d693b4 into main Mar 25, 2026
2 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant