Backend API for LJ-List — a 3-month bulk grocery payment plan for government workers in Ghana. Go, Gin, PostgreSQL, Cloudinary, Hubtel SMS.
# LJ-List API
Backend API for LJ-List, a 3-month bulk grocery hire-purchase platform for government workers in Ghana.
Customers browse products, submit applications, and chat with admin. Payments are handled offline after manual review.
## API Version
All application endpoints are versioned under:
`/api/v1`
Runtime documentation endpoints:
- `GET /`
- `GET /api/v1/docs`
Repository docs:
- API Reference
- Operations Guide
## Stack
- Go 1.22+
- Gin
- PostgreSQL (pgx v5)
- golang-migrate
- bcrypt + JWT (httpOnly cookies)
- Cloudinary (media)
- Hubtel (SMS)
## Setup
```bash
git clone
github.com
cd lj-list-api
cp .env.example .env
go mod download
make run
```
## Environment Variables
| Variable | Description | Default |
|---|---|---|
| `PORT` | HTTP port | `8080` |
| `DATABASE_URL` | Postgres DSN | required |
| `JWT_SECRET` | JWT signing secret | required |
| `RATE_LIMIT_PER_MINUTE` | Global per-IP limit for `/api/*` | `120` |
| `AUTH_RATE_LIMIT_PER_MINUTE` | Per-IP auth route limit (`/api/v1/auth/*`) | `30` |
| `CORS_ALLOWED_ORIGINS` | Comma-separated CORS allowlist | `
localhost` |
| `COOKIE_SECURE` | Set auth cookies as `Secure` | `false` |
| `COOKIE_DOMAIN` | Cookie domain (`""` means host-only) | `""` |
| `COOKIE_SAME_SITE` | `Lax`, `Strict`, or `None` | `Lax` |
| `CLOUDINARY_CLOUD_NAME` | Cloudinary cloud name | required |
| `CLOUDINARY_API_KEY` | Cloudinary key | required |
| `CLOUDINARY_API_SECRET` | Cloudinary secret | required |
| `HUBTEL_CLIENT_ID` | Hubtel SMS client ID | required |
| `HUBTEL_CLIENT_SECRET` | Hubtel SMS client secret | required |
| `HUBTEL_SMS_URL` | Hubtel SMS send endpoint | `
smsc.hubtel.com` |
| `HUBTEL_SENDER_ID` | SMS sender ID | `LJList` |
| `MESSAGE_SMS_COOLDOWN_MINUTES` | Per-conversation customer chat SMS cooldown for admin alerts | `30` |
| `ADMIN_PHONE_NUMBER` | Bootstrap phone number auto-promoted to admin on signup | defaults to `ADMIN_NUMBER` …