Node.js/Express API for UhuruVerse Pulse - African policy tracking platform
# UhuruVerse Backend API
This is the backend API for the UhuruVerse Pulse feature - a civic engagement platform that aggregates legislative updates, explains them in plain language, and facilitates organized public debate.
## Features
- **User Management**: Anonymous and verified user profiles
- **Pulse Feed**: Legislative updates with AI-powered explanations
- **Debate System**: Structured arguments with voting
- **Mobile Money Integration**: Tipping functionality
- **Real-time Updates**: WebSocket support for live debates
- **Comprehensive API**: RESTful API with OpenAPI documentation
## Technology Stack
- **Runtime**: Node.js 18+
- **Framework**: Express.js
- **Database**: PostgreSQL 15+
- **Caching**: Redis 7+
- **Authentication**: JWT with refresh tokens
- **Documentation**: OpenAPI 3.0 (Swagger)
- **Logging**: Winston
- **Security**: Helmet, CORS, rate limiting
## Project Structure
```
backend/
├── src/
│ ├── config/ # Configuration files
│ │ ├── database.js # PostgreSQL configuration
│ │ └── redis.js # Redis configuration
│ ├── migrations/ # Database migrations
│ │ ├── 001_initial_schema.sql
│ │ └── runMigrations.js
│ ├── models/ # Database models (to be created)
│ ├── routes/ # API routes (to be created)
│ ├── middleware/ # Custom middleware (to be created)
│ ├── utils/ # Utility functions (to be created)
│ └── server.js # Main server file
├── .env.example # Environment variables template
├── package.json # Dependencies and scripts
└── README.md # This file
```
## Getting Started
### Prerequisites
1. **Node.js** 18 or higher
2. **PostgreSQL** 15 or higher
3. **Redis** 7 or higher
4. **npm** 9 or higher
### Installation
1. Clone the repository:
```bash
git clone
cd backend
```
2. Install dependencies:
```bash
npm install
```
3. Set up environment variables:
```bash
cp .env.example .env
# Edit .env with your configuration
```
4. Set up the …