How shashwat-akhilesh-shukla/midnightreads works
Project Type and Purpose
• This is a full-stack web application called Readverse, a gamified book‐reading website.
• The frontend is a React single-page app (bootstrapped with Create React App) in the public/ and src/ folders.
• The backend is a Django project (django_project/) exposing REST endpoints for user authentication, PDF management, and progress tracking.
File Structure Analysis
• Top-level separation:
• src/, public/ & package.json → React frontend
• django_project/ → Django backend (with readverse/ core settings and the pdfs/ app)
• Frontend:
• src/our_API.js defines how React components call backend APIs.
• Components: Browse.js, LoginSignup.js, PdfViewerModal.js, etc., handle UI and data flow.
• Backend:
• pdfs/ Django app contains models.py, serializers.py, views.py, and urls.py in readverse/urls.py.
• uploads.py suggests custom file‐upload handling.
• Migration files under pdfs/migrations/ point to a relational database (e.g., PostgreSQL/SQLite).
Key README Insights
• The README title “Readverse” and tagline “A gamified book reading website” confirm the application’s goal.
Main Components
a. Client (Web Browser)
• Renders React SPA, manages user interactions (login, browsing, reading).
b. Frontend Layer (React App)
• UI Components (Navbar, Sidebar, Browse, PdfViewerModal)
• HTTP Client (our_API.js) calls backend REST endpoints.
c. API Gateway / HTTP Server
• (Optional) Nginx or Node / serve-static for hosting built React assets.
• Django’s WSGI/ASGI server handles API requests at /api/....
d. Backend Layer (Django Project)
• readverse/: global settings, URL routing (urls.py), WSGI/ASGI entry points.
• pdfs/ app:
– models.py: User, PDF metadata, progress tracking.
– serializers.py: JSON ↔ model translation.
– views.py: API views for login, signup, PDF list, PDF fetch.
– uploads.py: file storage logic (local or cloud).
e. Database
• Relational database (e.g., PostgreSQL) storing users, PDF metadata, reading status.
f. File Storage
• Local filesystem or cloud storage (e.g., S3) for PDF uploads.
g. External Services (if any)
• Authentication (JWT or session cookies)
• Analytics or gamification engine (if extended in future)
Relationships and Data Flow
• Browser → (HTTPS) → Frontend Server (static assets)
• React SPA → (REST) → Django API endpoints
• Django API → (ORM) → Database
• Django API → File Storage to fetch PDF binaries → returns to React
• React renders PDF in PdfViewerModal.js using fetched binary or URL
Architectural Patterns and Design Principles
• Client-Server Separation: Strict frontend/backend split, communicated over JSON REST.
• Layered Architecture: UI layer, service layer (views/serializers), data layer (models/ORM).
• Modularization: Django “pdfs” app encapsulates all PDF-related logic; React components are feature-oriented.
• Stateless API: Each request carries authentication and context; no server-side sessions.
Technologies and Frameworks
• Frontend: React, Create React App, CSS modules, JavaScript ES6+
• Backend: Python, Django, Django REST Framework (implied by serializers/views)
• Database: PostgreSQL or SQLite (Django migrations)
• File Storage: Local filesystem or AWS S3 via uploads.py
• Build Tools: npm, Webpack (via CRA), Django’s manage.py commands
Essential Elements
• Annotations for port numbers (e.g., 3000 for React dev, 8000 for Django)