How amannegi/freshnest works
Project type and purpose
• FreshNest is a full-stack online marketplace connecting farmers and customers.
• It comprises three user-facing clients (Web via React/Tailwind, Mobile via Flutter, and an Admin panel), a Node.js/Express backend with MongoDB Atlas, plus auxiliary services (Firebase Storage for images, Geolocation API).
File structure
• Top level:
• backend/ – Node.js/Express server
• frontend/flutter/ – Mobile client (Flutter)
• frontend/react/ – Web client (React + TailwindCSS)
• docs/, .github/, images/ – CI/workflow docs and assets
• backend/src/: follows MVC-style separation
• models/ – Mongoose schemas (user, cart, comment, millet_item)
• routes/ – Express routers (auth, cart, list, admin, search, profile)
• startup/ – db connection (db.js), route registration (routes.js)
• utils/ – hashing, logging, response wrappers, Swagger integration
• frontend/: both Flutter and React clients use a mutated MVP pattern
• application/ – API calls + business logic
• presentation/ – UI components + styling
• Configuration: ESLint, Swagger AutoGen, VSCode launch configs, Vercel/Netlify deployment files
README for additional insights
• Describes MVP mutation: clear separation of “application” vs. “presentation” layers
• Lists tech stack: Flutter (mobile), React/Tailwind (web), Node/Express (backend), MongoDB Atlas (database)
• Mentions Swagger-generated API docs and Firebase Storage for image uploads
• Deployment: Web on Netlify, Backend on Adaptable.io
Main components
A. Clients
• Web Client (React + Tailwind)
• Mobile Client (Flutter)
• Admin Interface (could be a role in either client)
B. API Layer
• Express.js server
• Route modules (auth, cart, list, profile, admin, search)
C. Business & Data Layer
• Controllers/Services encapsulated in “application” folders (frontends) and in backend utils
• Models (MongoDB schemas)
D. Database
• MongoDB Atlas (hosted)
E. External Services
• Firebase Storage (image uploads)
• Geolocation API (mobile location)
• Swagger UI (auto-generated docs)
Relationships and data flows
• Clients → send HTTP(S) requests (REST) → Express routes
• Routes → invoke business logic and Mongoose models → read/write MongoDB
• For file uploads: route handlers → Firebase Storage SDK → store/retrieve images
• Mobile client utilizes device GPS → Geolocation API → passes location to backend
• Swagger UI exposes API docs via /swagger endpoint
• Admin role requests → same API endpoints but with elevated permissions
Architectural patterns & design principles
• Mutated MVP in frontends:
• Application layer: data fetching, state management (providers/managers)
• Presentation layer: UI widgets/pages
• Backend: MVC-style with separation of models, routes (controllers), and startup/config
• Separation of concerns, single responsibility, and layered architecture
Technologies & frameworks to annotate
• Backend: Node.js, Express.js, Mongoose, Swagger AutoGen
• Database: MongoDB Atlas
• Web: React 18, Vite, TailwindCSS, ESLint
• Mobile: Flutter 3.16.9, Dart, Firebase Storage, geolocator plugin
• Deployment: Netlify (web), Adaptable.io (backend), Vercel config in backend