# BuySell Liberia
A modern marketplace for buying and selling in Liberia, built with Next.js (App Router), an Express + Socket.IO realtime server, and MongoDB via Mongoose.
## Overview
- Frontend/API: Next.js 14 (app directory) on port 3000
- Realtime server: Express + Socket.IO on port 3001 (`server/index.js`)
- Database: MongoDB (local or Atlas) via Mongoose (`lib/mongoose.ts`)
- Storage helpers: Local uploads under `/uploads` with a Next.js file-serving route at `/uploads/*`, optional Firebase helpers
Key features:
- Listings with categories, pagination, featured listings, and product detail views
- Client-side auth via JWT stored locally with fast UI state and background profile fetching
- Realtime presence, announcements, and messaging through Socket.IO
- Monetization plans (including banner ads), subscription/featured/bump flows
- Admin tools for banner images with auto-expiry and cleanup
## Getting started
### Prerequisites
- Node.js 18+
- MongoDB (local or Atlas)
### Install
```bash
git clone
github.com
cd buy-sell-liberia
npm install
```
### Environment variables
Create a `.env` in the project root and set at least:
```env
MONGODB_URI=mongodb://localhost:27017/buysell
# Optional: Firebase client vars if you use Firebase storage
NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
NEXT_PUBLIC_FIREBASE_APP_ID=
# Optional: protect cron cleanup endpoint
CRON_SECRET=your-strong-random-secret
```
### Run (development)
- Frontend/API only:
```bash
npm run dev
```
- Socket server only:
```bash
npm run dev:socket
```
- Both together:
```bash
npm run dev:all
```
Visit
localhost (Next.js) and the socket server at
localhost.
### Build and start (production)
```bash
npm run build
npm run start
```
## Seeding data
Categories and other seeds are provided.
- …