How ahmad-danaf/spacecodey works
Project Type and Purpose
• Type: Full-stack monolithic web application built on Django.
• Purpose: Provide astrophotographers and space enthusiasts with user accounts, daily NASA images, ISS tracking, weather comparison, optimal shoot times, tips & articles.
Main Components
a. Client / Frontend
– Web browser or mobile client
– Static assets: HTML templates, CSS, JavaScript under /templates and /static
b. Django Application (Monolith)
– ASGI/WSGI entrypoint (asgi.py, wsgi.py)
– URL router (urls.py)
– View layer (views.py in each app + global views.py)
– Models (models.py) + ORM (SQLite by default)
– Apps (each a logical module):
• user_management
• content
• events
• nasa_info
• weather
– Management commands (background jobs):
• fetch_events (pull events from external calendar APIs)
• delete_old_events
c. Database
– SQLite (or Postgres/MySQL in production)
– Stores users, articles, events, weather history, etc.
d. External Services / APIs
– NASA APOD API
– ISS Tracking API
– Weather APIs (for real-time comparisons)
e. Deployment / Infrastructure
– Azure Web App (or VM)
– GitHub Actions CI/CD (.github/workflows/deploy.yml)
– Environment variables (.env for API keys)
Relationships and Data Flows
– User → HTTP(S) → Django ASGI/WSGI → URL router → App View → Model/DB → Render Template → HTTP Response → User
– App View → External API Client (e.g., in nasa_info/views.py, weather/views.py, events/utils.py) → API Response → Transform & Cache if needed → Display to User
– Management Command (cron/worker) → Django ORM → Fetch & Clean Data → Update DB
– Static Assets served via Django collectstatic or CDN
– Email Verification Flow:
User → Register View (user_management) → Send Email via SMTP → Verification Link → Confirm View → Activate Account
Architectural Patterns & Design Principles
– Monolithic, modular design using Django Apps (separation by feature).
– MVC/MVT pattern: Models, Views (logic), Templates.
– Single database for all apps.
– Reuse of Django’s authentication framework extended in user_management.
– Background tasks implemented as Django management commands.
– API wrappers/utilities isolated in utils packages.