How bguerradev/smspy works
Project Type and Purpose
• SMSPy is a full‐stack web messaging system.
• Purpose: user registration/authentication, sending/receiving messages (with images), user profiles, global toast notifications.
File Structure
• Backend (user_messages_backend/):
• Django project (“core” settings, URLs, ASGI/WGI)
• Django app user_messages (models, serializers, views, URLs, migrations)
• JWT auth via Django REST Framework
• requirements.txt, render.yaml (deployment config), SQLite (dev)
• Frontend (user_messages_frontend/):
• React SPA bootstrapped with Vite (vite.config.js)
• Components folder (MessageList, MessageForm, Login, Register, etc.)
• Services (api.js for REST calls, toast manager helper)
• Styling (CSS, Bootstrap)
• package.json, public/index.html
Key Insights from README
• Backend: Python, Django, DRF, JWT
• Frontend: React, Bootstrap
• Uses SQLite in dev; plans for PostgreSQL
• Features: auth, messaging with image upload, user avatars, global toasts
Main Components
a. Client (Browser/React SPA)
• Components: Login/Register, MessageTabs, MessageList, MessageForm, Profile, ToastManager
• JWT storage (in memory or localStorage)
• HTTP client (api.js)
b. API Layer (Django REST Framework)
• Endpoints: /api/auth/, /api/messages/, /api/users/
• JWT authentication middleware
• Views/Serializers
c. Database
• Future: PostgreSQL
d. Media Storage
• Local filesystem (dev) or S3/Cloud (prod) for uploaded images and avatars
e. Deployment/Infrastructure
• Render (as specified in render.yaml) or other cloud
• Web server (Gunicorn/Uvicorn), reverse proxy (nginx)
Relationships & Data Flow
• Browser → API: REST calls with JWT in Authorization header
• API → DB: ORM queries (read/write messages, users)
• API ↔ Media Store: save/fetch images
• Browser: receives JSON → React state → UI
• ToastManager: listens for API responses → displays notifications
Architectural Patterns & Principles
• Separation of Concerns: clear split between SPA and REST API
• Stateless Authentication: JWT tokens, no server‐side sessions
• MVC (Django): models, views, serializers (acts as “controllers”)
• Component-Based UI: React functional components
Technologies & Frameworks
• Python, Django, Django REST Framework, djangorestframework-simplejwt
• React, Vite, JSX, Bootstrap/CSS
• SQLite (dev), PostgreSQL (future)
• Render.com (deploy), Docker (optional)
Putting It All Together
• Inside API, note the core module (settings, URLs), user_messages app (models, serializers, views)