How deepuchary03/secure-cloud-storage-mern works
Project Type and Purpose
• Secure-Cloud-Storage-MERN is a full-stack web application (MERN-style) that provides authenticated, access-controlled file storage in the cloud.
• The “client” directory holds a React+TypeScript single-page application (SPA) using Vite and Tailwind for UI.
• The “server” directory holds a Node.js/Express (TS) REST API that handles authentication, authorization, file upload/download, and persistence.
• The “shared” directory contains common schema definitions (used by both client and server), and “uploads” is the local file store for binary files.
File‐Structure Analysis
Top‐Level:
• client/ — React SPA
• server/ — Express API
• shared/ — shared TypeScript types/schema
• uploads/ — raw file storage
• drizzle.config.ts, tsconfig.json, vite.config.ts, tailwind.config.ts, theme.json — build/config files
Patterns:
– client/src/components/ui and components/layouts follow a component-based UI library pattern
– client/src/hooks and lib contain cross-cutting abstractions (auth, toasts, queryClient)
– server/middlewares.ts, auth.ts, routes.ts show an Express middleware→controller→service layering
– server/mongodb-storage.ts and server/storage.ts abstract file persistence (GridFS or FS)
– shared/schema.ts likely defines user, file, and access-control models
README Insights
– Title “Secure-Cloud-Storage-MERN” implies MERN stack (MongoDB, Express, React, Node)
– Screenshots (op1.png, op2.png, op3.png) likely show login, dashboard, file views
a. Main Components
1. Client (Browser SPA)
– React + TypeScript + Vite + Tailwind UI
– UI Components & Layouts, Hooks, Utilities
2. API Server
– Node.js + Express + TypeScript
– Authentication & Authorization Middleware
– RESTful Routes for user, file operations, access control
– Drizzle ORM (via drizzle.config.ts + shared/schema.ts) for metadata
– File Storage Module (server/mongodb-storage.ts or storage.ts)
3. Database
– MongoDB cluster for user credentials, file metadata, ACL
4. File Store
– Local directory under “uploads/” or GridFS (abstracted in code)
5. External Services (optional)
– Email or SMS for OTP, if implemented
– CDN for file delivery (not present but could be added)
b. Relationships & Data Flows
– User → SPA (login, upload, download)
– SPA → API Server (HTTPS requests, JWT in headers or cookie)
– API Server ↔ MongoDB (via Drizzle ORM) for CRUD on metadata
– API Server ↔ File Store for read/write raw files
– API Server → SPA (JSON responses)
c. Architectural Patterns & Principles
– Layered Architecture: Presentation (client), Application (server controllers/middleware), Data (DB & storage)
– Single-Page Application on the client, REST API on the server
– Separation of Concerns: UI components vs hooks vs utilities; routes vs middleware vs services
– Shared types/schema ensures type-safe contracts between client and server
d. Key Technologies & Libraries
– Frontend: React, TypeScript, Vite, Tailwind CSS
– Backend: Node.js, Express, TypeScript, Drizzle ORM
– Persistence: MongoDB, local filesystem or GridFS
– Utility: react-query (queryClient), custom hooks for auth and toast