How sujanraghav05/codealpha_tasks works
Repository Scope
This repository contains two independent full-stack applications:
• An e-commerce system under CodeAlpha_E-commerce/eco_comm_fullstack.
• A social-media platform (“Truth Talks”) under CodeAlpha_Social_Media/truth-talks-v2-sql/truth-talks-sql.
They have separate frontend/backend runtimes, data models, and deployment boundaries.
E-commerce Application
The e-commerce backend is a Node.js service entered through CodeAlpha_E-commerce/eco_comm_fullstack/backend/src/server.js. It exposes route groups for authentication, products, orders, and administration:
• backend/src/routes/auth.js
• backend/src/routes/products.js
• backend/src/routes/orders.js
• backend/src/routes/admin.js
Routes delegate to domain controllers, which form the HTTP-to-business-logic boundary: backend/src/controllers/authController.js, backend/src/controllers/productController.js, and backend/src/controllers/orderController.js.
E-commerce Identity, Data, and Security
Persistent domain entities are separated into model files for users, products, orders, and OTP tokens:
• backend/src/models/User.js
• backend/src/models/Product.js
• backend/src/models/Order.js
Database initialization and token configuration are centralized at backend/src/config/db.js and backend/src/config/jwt.js. Authentication middleware protects restricted endpoints, while shared error handling is isolated from controller logic:
• backend/src/middleware/auth.js
• backend/src/middleware/errorHandler.js
A SQL schema exists at CodeAlpha_E-commerce/eco_comm_fullstack/sql/schema.sql, representing a material database boundary for this application.
E-commerce Client Boundary
The e-commerce UI is a static HTML/CSS/JavaScript client rather than a component-based SPA. Its storefront, cart, account, and administration surfaces are individual pages under frontend/pages, including:
• frontend/pages/products.html
• frontend/pages/cart.html
• frontend/pages/admin.html
Shared browser-side behavior is concentrated in frontend/js/utils.js, with global styling in frontend/css/style.css. The client is expected to call the backend HTTP API; no server-rendering entry point is present in the tree.
Truth Talks Client
Truth Talks is a React client entered through CodeAlpha_Social_Media/truth-talks-v2-sql/truth-talks-sql/client/src/index.js, with top-level composition/routing in client/src/App.jsx. It separates authenticated and application layouts:
• client/src/components/layout/AuthLayout.jsx
• client/src/components/layout/AppLayout.jsx
Feature pages cover feed, profiles, post creation, stories, reels, channels, and chat. Core client data boundaries are the HTTP API wrapper and stateful authentication/socket contexts:
• client/src/utils/api.js
• client/src/context/authStore.js
• client/src/context/SocketContext.jsx
Truth Talks Server, Realtime, and Media
The Node.js server entry point is CodeAlpha_Social_Media/truth-talks-v2-sql/truth-talks-sql/server/index.js. REST routes partition core social functions—authentication, users, posts, stories, reels, channels, chat, discovery, and upload—such as:
• server/routes/auth.js
• server/routes/posts.js
• server/routes/chat.js
The server applies auth middleware (server/middleware/auth.js), accesses relational data through server/config/db.js and server/models/index.js, and includes a SQLite database at server/data/truth_talks.sqlite. Schema evolution is initiated by server/migrations/run.js.
Realtime communication is a distinct Socket.IO-style boundary implemented in server/socket/socketHandler.js, consumed by the client socket context. Media upload/storage is split between local upload directories and Cloudinary configuration:
• server/routes/upload.js
• server/config/cloudinary.js
• server/uploads/
Thus, Truth Talks’ primary flow is React UI → HTTP API or socket connection → authenticated route/socket handlers → SQLite models, with uploaded media handled through local storage and configured cloud-media integration.
Main entry points: src/index.js React client · server/index.js Social API server · utils.js Browser utilities · server.js Commerce API server
Components 23
E-commerce
Independent static-client and Node.js commerce application.
- Static storefront pages · Products, cart, account, and administration pages.
CodeAlpha_E-commerce/eco_comm_fullstack/frontend/pages/products.html - Browser utilities · Shared client behavior and styling.
CodeAlpha_E-commerce/eco_comm_fullstack/frontend/js/utils.js - Commerce API server
CodeAlpha_E-commerce/eco_comm_fullstack/backend/src/server.js - API route groups · Authentication, products, orders, and admin endpoints.
- Auth middleware · Protects restricted API endpoints.
- Commerce controllers · HTTP-to-business-logic boundary for auth, products, and orders.
- Commerce models · Users, products, orders, and OTP tokens.
- Database configuration
- Commerce SQL schema
CodeAlpha_E-commerce/eco_comm_fullstack/sql/schema.sql
Truth Talks
Independent React, Node.js, SQLite, and realtime application.
- React client · Client bootstrap and top-level application composition.
CodeAlpha_Social_Media/truth-talks-v2-sql/truth-talks-sql/client/src/index.js - Auth and app layouts · Separates unauthenticated and application experiences.
- HTTP API wrapper
- Auth and socket contexts · Maintains authentication and realtime connection state.
- Social API server
CodeAlpha_Social_Media/truth-talks-v2-sql/truth-talks-sql/server/index.js - Social REST routes · Auth, social content, chat, discovery, and upload endpoints.
- Auth middleware
- Socket handlers · Socket.IO-style realtime communication boundary.
- Relational models
- Truth Talks SQLite · Relational persistent data store.
- Schema migrations
- Media upload route · Accepts media uploads for local and cloud-backed handling.
- Cloudinary integration
- Local media storage
Connections 23
- Static storefront pages → Browser utilities: uses
- Browser utilities → Commerce API server: HTTP API
- Commerce API server → API route groups: mounts
- API route groups → Auth middleware: protects routes
- API route groups → Commerce controllers: delegates
- Commerce controllers → Commerce models: uses
- Commerce models → Database configuration: connects through
- Database configuration → Commerce SQL schema: persists to
- React client → Auth and app layouts: renders
- React client → HTTP API wrapper: uses
- React client → Auth and socket contexts: provides
- HTTP API wrapper → Social API server: HTTP API
- Auth and socket contexts → Socket handlers: socket connection
- Social API server → Social REST routes: mounts
- Social API server → Socket handlers: initializes
- Social REST routes → Auth middleware: protects routes
- Social REST routes → Relational models: uses
- Socket handlers → Relational models: uses
- Relational models → Truth Talks SQLite: persists to
- Schema migrations → Truth Talks SQLite: evolves schema
- Social REST routes → Media upload route: mounts
- Media upload route → Local media storage: stores locally
- Media upload route → Cloudinary integration: uses configuration