A prototype MERN-stack implementation of the system proposed in the accompanying thesis (University of Kigali, Bachelor of Business Information Technology): digitising extraction logging, mineral bag tagging, mine-site safety recording and RMB production-quota cross-referencing for artisanal mining cooperatives, licensed traders and RMB.
The frontend (client/) and backend (server/) are two independent applications that
only communicate over HTTP - there is no shared build step or proxy dependency in production.
This lets you deploy the frontend to Vercel and the backend to Render (or any other
static host / Node host) without either one knowing about the other's platform.
Project/
├── server/ # Express + MongoDB (Mongoose) REST API
└── client/ # React (Vite) single-page app
- Node.js 18+ and npm
- A MongoDB database. Easiest option: a free MongoDB Atlas M0 cluster (no local install, works the same locally and once deployed on Render).
- Install dependencies for both apps:
npm run install:all - Configure the server: copy
server/.env.exampletoserver/.envand fill in yourMONGO_URI(from Atlas) and aJWT_SECRET(any long random string). - Seed the database with realistic demo data:
This prints a table of demo login credentials (all use the password
npm run seedPassword123!) and a few sample tag codes to try in the Chain of Custody viewer. - Start both apps together:
npm run dev- Backend: http://localhost:5000
- Frontend: http://localhost:5173 (Vite proxies
/apirequests to the backend automatically - you do not need to setVITE_API_URLfor local dev)
You can also run either app on its own with npm run dev --prefix server or
npm run dev --prefix client.
- Create a new Web Service on Render, pointed at the
server/directory of this repo (Root Directory:server). - Build command:
npm install. Start command:npm start. - Set environment variables in the Render dashboard:
MONGO_URI,JWT_SECRET,JWT_EXPIRES_IN(optional), and once you know your Vercel URL,CLIENT_ORIGIN(e.g.https://amtcis.vercel.app) so the API only accepts requests from your deployed frontend.PORTis provided automatically by Render. - Note the resulting URL, e.g.
https://amtcis-api.onrender.com.
- Import this repo into Vercel, setting the Root Directory to
client. - Framework preset: Vite. Build command:
npm run build. Output directory:dist. - Set the environment variable
VITE_API_URLto your Render backend URL from above (no trailing slash), e.g.VITE_API_URL=https://amtcis-api.onrender.com. - Deploy. The client will call the backend directly using that URL - no proxy needed in production.
Because the two apps never share a build or a domain, you can redeploy, rescale or replace either one independently at any time.
All seeded accounts use the password Password123!. Run npm run seed to (re)create them;
it wipes and reseeds the database, so the printed table of credentials is always accurate for
the current database.
| Role | Notes |
|---|---|
| System Admin | approves/suspends users, manages mine sites & mineral types |
| RMB Traceability Officer | sets quotas, reviews anomalies, generates compliance reports |
| Cooperative (compliant) | extraction stays under its monthly quota |
| Cooperative (overage) | extraction exceeds its quota - triggers a live anomaly |
| Cooperative (mixed) | normal activity, no quota configured |
| Cooperative (pending) | not yet approved - demonstrates the admin approval flow |
| Trader (with export history) | holds one fully-lifecycled tag (extraction -> tag -> receipt -> export) |
| Trader (with inventory only) | holds a received bag not yet exported |
| Trader (pending) | not yet approved |
- Log in as admin -> Manage Users -> approve the pending cooperative/trader.
- Log in as the compliant cooperative -> Log Extraction -> Digital Tags -> generate a tag (see the QR code).
- Log in as trader.two -> Receive Bag -> paste in a tag code from step 2 (or one of the
seeded codes printed by
npm run seed) -> My Inventory shows it. - Log in as rmb.officer -> Anomalies -> see the overage cooperative already flagged -> Chain of Custody -> paste the fully-lifecycled seeded tag code to show the complete extraction -> tag -> receipt -> export trail -> Compliance Report -> Print/Save as PDF.
No automated test framework is included (disproportionate for a solo prototype). Instead:
server/requests.http- a REST Client (VS Code extension) request collection covering every endpoint, useful for fast backend-only checks.- Manual click-through per role as described in the demo script above doubles as system-testing evidence for the thesis report (take screenshots as you go).
Before your panel demo, do a fresh-clone dry run on the actual demo machine: delete
node_modules in both server/ and client/, run npm run install:all, npm run seed,
npm run dev, and confirm everything still works end to end.