A Social Media Platform with Integrated E-Commerce
Live Demo: AURA
- Frontend: Vanilla HTML/CSS/JS with ES Modules (MPA)
- Multi‑Page Architecture (
index.html,profile.html,shop.html, etc.) - Modular JavaScript (
index.js,profile.js, etc.) - Fetch API for backend communication
- Hot‑reload support using WebSocket (
frontend-server.js)
- Multi‑Page Architecture (
- Backend: Node.js + Supabase
- REST API (
/api/register,/api/login) - Supabase for database, authentication, and storage
- JWT‑based authentication (custom implementation with
jsonwebtoken)
- REST API (
- Architecture: Monorepo (
frontend/+backend/) managed via npm workspaces - Database & Storage: Supabase (PostgreSQL + Storage)
-
Monorepo Management
- Root
package.jsonuses npm workspaces to install and manage frontend & backend dependencies. - Development script (
npm run dev) usesconcurrentlyto launch both servers in parallel.
- Root
-
Backend (Node.js + Supabase)
- Native HTTP server using Node.js core
httpmodule (server.jsentry point). - Declarative routing in
routes.js, dispatched byhandleRequest. - Supabase client (
@supabase/supabase-js) for database and storage operations. - JWT authentication via
jsonwebtoken(utilities inauth/). - Body parsing & multipart/form-data uploads using
busboywith a unifiedparseBody(backend/src/utils/utils.js). - Hot reload in development powered by
nodemon(configured innodemon.json).
- Native HTTP server using Node.js core
-
Frontend (Vanilla HTML/CSS/JS + ES Modules)
- Multi‑Page Application (MPA): standalone pages in
frontend/(index.html,profile.html,shop.html, etc.). - Modular JavaScript modules under
frontend/js(e.g.,global.js,profile.js,messages.js). - Centralized styling in
frontend/css/styles.css; component styles underfrontend/css/components. - Live‑reload server
frontend-server.jsusingchokidar+WebSocketfor automatic page refresh. - All API calls via Fetch API, base URL managed by
window.CONFIG.API_URL.
- Multi‑Page Application (MPA): standalone pages in
-
Deployment & Tools
- Frontend deployed to Vercel (static hosting).
- Backend deployable on any Node.js‑compatible host (Railway, Heroku, etc.).
- Environment variables loaded from
.env(SUPABASE_URL,SUPABASE_KEY,JWT_SECRET). - Documentation maintained in
docs/overview.md,docs/frontend.md, anddocs/backend.md.
-
Centralized CORS Handling
All CORS headers and allowed origins are configured in one place withinhandleRequest, with early return on OPTIONS requests. -
Decoupled Declarative Routing
Endpoints are defined in a single route map inroutes.js, eliminating sprawlingif/elsechains when adding or removing routes.
- Dynamic Pages:
profile.htmldynamically loads user details and posts.shop.htmlandmessages.htmlprovide interactive user experiences.
- Authentication: Login and registration pages with form validation.
- Global Styling: Centralized CSS in
frontend/css/styles.css. - Hot Reload: Automatic page reload on file changes during development.
- User Management: Register and login with JWT authentication.
- Post Management: Create, fetch, and delete posts.
- Notifications: Fetch and display user notifications.
- Supabase Integration: Database operations and file uploads handled via Supabase JS.
- Node.js (v16+)
- Supabase account with configured database and storage
- Git for version control
-
Clone the repository:
git clone https://github.com/krnsa/AURA.git cd AURA -
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.envfile in thebackend/directory with:SUPABASE_URL=your_supabase_url SUPABASE_KEY=your_supabase_key JWT_SECRET=your_jwt_secret CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret
- Create a
-
Start the development servers:
npm run dev
- Start Backend:
npm run start:backend(production mode) - Develop Backend:
npm run dev:backend(withnodemonhot reload) - Start Frontend:
npm run start:frontend - Development Mode:
npm run dev(concurrently starts both frontend & backend)
AURA/
├── backend/ # Backend code
│ ├── src/ # Source files
│ ├── .env # Environment variables
│ ├── server.js # Backend entry point
│ └── package.json # Backend dependencies
├── frontend/ # Frontend code
│ ├── css/ # CSS files
│ ├── js/ # JavaScript files
│ ├── index.html # Main entry point
│ └── package.json # Frontend dependencies
├── docs/ # Documentation
├── package.json # Root dependencies and scripts
└── README.md # Project documentation
The frontend is deployed to Vercel or any static hosting service.
- Ensure the
frontend/directory is set as the root for deployment.
Deploy the backend to any Node.js‑compatible hosting platform (Railway, Heroku, etc.).
Ensure the following environment variables are set during deployment:
NODE_ENV=productionSUPABASE_URL=your_supabase_urlSUPABASE_KEY=your_supabase_keyJWT_SECRET=your_jwt_secretCLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_nameCLOUDINARY_API_KEY=your_cloudinary_api_keyCLOUDINARY_API_SECRET=your_cloudinary_api_secret
These Cloudinary variables are used for managing media uploads and storage. Replace your_cloudinary_* with the actual values from your Cloudinary account.
This project is licensed under the MIT License. See the LICENSE file for details.