Skip to content
Shema-arsenePublic

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AMTCIS - Artisanal Mining Traceability and Compliance Information System

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 layout

Project/
├── server/   # Express + MongoDB (Mongoose) REST API
└── client/   # React (Vite) single-page app

Prerequisites

  • 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).

Local development

  1. Install dependencies for both apps:
    npm run install:all
    
  2. Configure the server: copy server/.env.example to server/.env and fill in your MONGO_URI (from Atlas) and a JWT_SECRET (any long random string).
  3. Seed the database with realistic demo data:
    npm run seed
    
    This prints a table of demo login credentials (all use the password Password123!) and a few sample tag codes to try in the Chain of Custody viewer.
  4. Start both apps together:
    npm run dev
    

You can also run either app on its own with npm run dev --prefix server or npm run dev --prefix client.

Deploying frontend and backend independently

Backend on Render

  1. Create a new Web Service on Render, pointed at the server/ directory of this repo (Root Directory: server).
  2. Build command: npm install. Start command: npm start.
  3. 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. PORT is provided automatically by Render.
  4. Note the resulting URL, e.g. https://amtcis-api.onrender.com.

Frontend on Vercel

  1. Import this repo into Vercel, setting the Root Directory to client.
  2. Framework preset: Vite. Build command: npm run build. Output directory: dist.
  3. Set the environment variable VITE_API_URL to your Render backend URL from above (no trailing slash), e.g. VITE_API_URL=https://amtcis-api.onrender.com.
  4. 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.

Seeded demo accounts

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

Suggested demo script

  1. Log in as admin -> Manage Users -> approve the pending cooperative/trader.
  2. Log in as the compliant cooperative -> Log Extraction -> Digital Tags -> generate a tag (see the QR code).
  3. 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.
  4. 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.

Testing

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.

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages