A full-stack nutrition and wellness web application addressing Rwanda's double burden of malnutrition.
# NutriLink Rwanda
A full-stack nutrition and wellness web application addressing Rwanda's double burden of malnutrition. Built with Next.js, Express, Prisma, and PostgreSQL.
## Architecture
```
frontend (Next.js) → REST API → backend (Express) → Prisma → PostgreSQL
↑
packages/shared (Zod schemas)
```
## Prerequisites
- **Node.js** 18+ and npm
- **PostgreSQL** installed and running locally
- A GUI client (optional): pgAdmin or TablePlus
## Database Setup
1. Create the database (run once in psql or pgAdmin):
```sql
CREATE DATABASE nutrilink_rwanda;
```
2. Copy environment files:
```bash
cp backend/.env.example backend/.env
cp frontend/.env.local.example frontend/.env.local
```
3. Edit `backend/.env` with your PostgreSQL credentials:
```env
DATABASE_URL="postgresql://YOUR_USER:YOUR_PASSWORD@localhost:5432/nutrilink_rwanda"
JWT_SECRET="generate-a-random-string-at-least-32-characters"
FRONTEND_URL="
localhost"
PORT=4000
```
Generate a JWT secret (PowerShell):
```powershell
-join ((48..57) + (65..90) + (97..122) | Get-Random -Count 32 | ForEach-Object {[char]$_})
```
Or with OpenSSL:
```bash
openssl rand -hex 32
```
## Install & Run
From the project root:
```bash
# Install all dependencies (monorepo workspaces)
npm install
# Build shared package
npm run build --workspace=packages/shared
# Run database migrations
npm run db:migrate --workspace=backend
# Seed the food database (~45 Rwandan foods)
npm run db:seed --workspace=backend
# Start backend (terminal 1)
npm run dev:backend
# Start frontend (terminal 2)
npm run dev:frontend
```
- **Frontend:**
localhost
- **Backend API:**
localhost
- **Health check:**
localhost
## Connect a GUI Client
Use these settings in pgAdmin or TablePlus to inspect tables and watch CRUD operations in real time:
| Field | Value |
|----------|--------------------|
| Host | localhost |
| Port | 5432 |
| Datab …