ansNia is a digital logistics dispatch platform that connects clients with vehicle and fleet owners across Kenya. Powered by AI-driven job matching, real-time tracking, and M-Pesa integration, it streamlines delivery requests for SMEs and informal transport operators.
## 🐳 Running with Docker
This project includes a full Docker setup for both development and production environments, using Node.js 22.13.1 and MongoDB. The Docker configuration is tailored for the TransNia platform and exposes both the frontend (Next.js) and backend (Express) services.
### Project-specific Requirements
- **Node.js Version:** 22.13.1 (as specified in the Dockerfile)
- **MongoDB:** Latest official image
- **Ports Exposed:**
- `3000`: Next.js frontend
- `5000`: Express backend
- `27017`: MongoDB (internal, mapped for development)
### Environment Variables
Ensure you have a `.env` file with the following variables (see the example in the main README for details):
- `MONGO_URI` (e.g., `mongodb://mongo:27017/transnia` for Docker)
- `JWT_SECRET`
- `STRIPE_SECRET_KEY`
- `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`
- `NEXT_PUBLIC_API_URL`
- `FRONTEND_URL`
> **Note:** When running in Docker, set `MONGO_URI` to use the service name `mongo` (not `localhost`).
### Build & Run Instructions
1. **Build and Start All Services**
```bash
docker-compose up --build
```
This will build the application image and start both the `typescript-app` (frontend/backend) and `mongo` services.
2. **Access the Application**
- Frontend:
localhost
- Backend API:
localhost
- MongoDB: Accessible at `localhost:27017` (for development/testing)
3. **Stopping Services**
```bash
docker-compose down
```
### Special Configuration
- The Docker Compose file creates a persistent volume `mongo-data` for MongoDB data.
- The application runs as a non-root user for security.
- Both frontend and backend are served from a single container (`typescript-app`), with the backend started via `node server/server.js` and the frontend via `next start`.
- If you need to use a custom `.env` file, uncomment the `env_file` line in `docker-compose.yml` and provide your environment file.
---