How edward2362/android-asm3-2022 works
Project Type and Purpose
• This is a full-stack “Go-Goat” book marketplace composed of:
• A native Android front-end (Java + XML)
• A Node.js/Express RESTful API back-end
• A MongoDB database (Atlas)
• Purpose: allow users to browse, search, post, update, delete, and purchase new/used books, including account management and seller reviews.
File Structure Analysis
• Backend/
• index.js (server entry)
• config/db.js (MongoDB connection)
• controllers/ (business logic per resource: auth, book, order, etc.)
• models/ (Mongoose schemas)
• routes/ (Express routes mapping to controllers)
• middleware/auth.js (JWT or session checks)
• Frontend/
• app/src/main/java/com/example/asm3/… – Activities, Fragments, Controllers, Adapters, Models
• base/networking/api (ApiService interface) & services (HTTP tasks)
• base/localStorage (file-based persistence)
• config/Constant.java (endpoints, keys)
• resources: layouts, drawables, menus, values
• build.gradle, wrapper files
Key Components to Illustrate
• Android Client
• UI Layer: Activities & Fragments
• Controller/VM Layer: Controllers and ViewModels
• Networking Layer: Retrofit/AsyncTask modules via ApiService
• Local Storage (caching or offline)
• REST API Server
• Express Server (index.js)
• Middleware (authentication)
• Router Layer (routes/*.js)
• Controller Layer (controllers/*.js)
• Data Layer (models/*.js using Mongoose)
• Database
• MongoDB cluster (Atlas)
• External Services
• Heroku (hosting API)
• Potential push notification service
Relationships and Data Flows
• Android → HTTP(S) requests → API endpoints (e.g., GET /api/book/getProducts)
• API → CRUD operations → MongoDB
• API → JSON responses → Android client
• Auth flows: login/register endpoints returning JWT or session token → stored locally → attached to subsequent requests
• NotificationReceiver on Android might handle push notifications from server/external service
Architectural Patterns & Principles
• Backend: MVC (models, routes/controllers, express server)
• Frontend: MVVM-like (Activities/Fragments + Controllers/ViewModels + Adapters)
• Clear separation of concerns: UI vs networking vs data layers
• RESTful design, stateless API, token‐based authentication
Essential Elements
• Component labels: Activity names, Controller modules, API endpoints, Model schemas
• Container boundaries for Frontend vs Backend vs Cloud