Skip to content

Commit 06241e7

Browse files
committed
Document clean standalone ecommerce repository architecture
1 parent 1230d06 commit 06241e7

1 file changed

Lines changed: 38 additions & 34 deletions

File tree

‎README.md‎

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
1-
# Electronics E-commerce — Independent Store
1+
# Electronics E-commerce
22

3-
This is a standalone electronics e-commerce project. **It does not call, read, or write Karvio or its Google Apps Script backend.**
3+
Independent Bangladesh electronics retail website with an original visual identity, familiar marketplace navigation and **no Karvio ERP connection**.
44

5-
## Architecture
6-
- React + Vite frontend, hosted independently on GitHub Pages.
7-
- Independent Cloudflare Worker API in `backend/src/index.js`.
8-
- Independent Cloudflare D1 SQLite database in `backend/schema.sql`.
9-
- Catalog, checkout, order tracking, product inventory, and order administration.
10-
- Payments: Cash on Delivery; optional manual bKash reference collection (not an automated payment verification).
5+
## Live
6+
- [Storefront](https://codewithroni.github.io/Electronics-Ecommerce/)
7+
- [Admin panel](https://codewithroni.github.io/Electronics-Ecommerce/#/admin)
8+
- API: https://electronics-ecommerce-api.ahroni-usa.workers.dev/
9+
10+
## Repository structure
11+
```
12+
src/
13+
App.jsx Navigation and routes
14+
components/ Shared product components
15+
pages/ Home, Products, Product, Wishlist, Cart, Checkout, Track, Admin
16+
lib/ API client, cart/catalog store, wishlist
17+
styles.css Shared responsive styles
18+
styles-startech.css Electronics retail theme
19+
backend/
20+
src/index.js Independent Cloudflare Worker API
21+
migrations/ Cloudflare D1 schema migrations
22+
wrangler.toml Worker and D1 binding
23+
.github/workflows/ Pages, Worker, and database deployment
24+
```
1125

1226
## Setup
13-
1. Install Node.js 22 and run `npm ci`.
14-
2. Create a Cloudflare account and install Wrangler: `npm install -g wrangler`, then `wrangler login`.
15-
3. Create a **new, independent** D1 database: `wrangler d1 create electronics-ecommerce`. Copy its database ID into `backend/wrangler.toml`.
16-
4. Initialize the schema: `cd backend && wrangler d1 execute electronics-ecommerce --remote --file=schema.sql`.
17-
5. Create an admin secret: `cd backend && wrangler secret put ADMIN_TOKEN`. Use a long random secret.
18-
6. Set Worker variables in Cloudflare for `SHOP_NAME`, `SHOP_PHONE`, `SHOP_ADDRESS`, `ALLOWED_ORIGIN` (your storefront origin), `DELIVERY_INSIDE`, `DELIVERY_OUTSIDE`; optionally `BKASH_NUMBER`.
19-
7. Deploy: `cd backend && wrangler deploy`.
20-
8. In GitHub repository Settings → Secrets and variables → Actions → Variables, create `VITE_API_URL` with your Worker URL. For local development create `.env.local` containing `VITE_API_URL=https://YOUR-WORKER.workers.dev`.
21-
9. Run `npm run dev` locally. The existing GitHub Pages workflow deploys frontend changes from `main`.
22-
23-
**Important:** Without deploying the independent Worker and setting `VITE_API_URL`, the storefront intentionally shows a configuration error rather than silently connecting to Karvio. No fake orders are recorded.
24-
25-
## Admin API
26-
Send JSON POST to the Worker with header `Authorization: Bearer YOUR_ADMIN_TOKEN`:
27-
- `{"action":"admin.products"}` — list inventory
28-
- `{"action":"admin.product.upsert","payload":{"product":{"id":"router-1","name":"Router","price":1500,"stock":10,"group_id":"Networking"}}}`
29-
- `{"action":"admin.orders"}` — list orders
30-
- `{"action":"admin.order.status","payload":{"order_no":"EE-...","status":"confirmed"}}`
31-
32-
Do not put the admin token in frontend source code, `.env` files committed to Git, or browser local storage. Use a secure private admin client.
33-
34-
## Operations and limitations
35-
- This is a new empty database: **Karvio products/orders are not migrated**.
36-
- The storefront must not accept real orders until the Worker, database, inventory and payment settings have been configured and tested.
37-
- bKash references are recorded for manual checking; no automatic payment confirmation is provided.
38-
- For a production launch, add rate limiting, monitoring, backups, transactional stock reservations, and a dedicated authenticated admin UI.
27+
```sh
28+
npm ci
29+
npm run dev
30+
npm run build
31+
```
32+
Set `VITE_API_URL` in `.env.local` for local development. GitHub Pages deploys on main branch pushes. Worker deployment uses GitHub Secrets `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`. Database migrations are manually approved: see `backend/MIGRATIONS.md`.
33+
34+
## Admin
35+
At `/#/admin`, enter the Cloudflare Worker `ADMIN_TOKEN` secret. The admin interface keeps it in memory, not browser storage. Admin can edit products, prices, stock, image URLs and order status. Never commit the token.
36+
37+
## Features and limitations
38+
Implemented: responsive catalog, category navigation, search, filters, sorting, wishlist, cart, checkout, manual bKash reference, order tracking, inventory and order admin.
39+
40+
Not yet implemented: PC builder, comparisons, user accounts, reviews, coupons, image file uploads, automated payment verification, advanced specification filters, robust stock reservation and production rate limiting. Do not accept real orders until checkout and stock handling have been tested.
41+
42+
The layout is independently authored; no Star Tech logos, images, or brand identity are used.

0 commit comments

Comments
 (0)