A full-stack enterprise web application built for multi-branch balance sheet consolidation, trial balance ledger verification, automated accounting reconciliation, double-entry bookkeeping, and executive financial reporting.
- **Server-Side Architecture**: Express backend (`server.ts`) handling state management, calculations, audit logging, and email dispatches.
- **PostgreSQL & Fallback Storage**: Connects to PostgreSQL via `pg` connection pool with automatic fallback to JSON data persistence (`/app/data/portal-data.json`).
- **Containerized Deployment**: Ready for Docker, Docker Compose, and **Coolify** self-hosting.
| `server.ts` | Express server entry point with PostgreSQL initialization and REST API routes. |
---
## 🛠️ Local Development & Running via Docker
### 1. Run via Docker Compose (With PostgreSQL & Configurable Host Ports)
```bash
docker-compose up --build -d
```
By default, the application will be accessible on host port `http://localhost:8080` (mapped to internal container port `3000`), and PostgreSQL on host port `5433` (mapped to internal container port `5432`).
If host ports `3000` or `5432` are already used by another application, set custom host ports in `.env`:
```env
HOST_PORT=8080
POSTGRES_HOST_PORT=5433
```
### 2. Run via Docker CLI
```bash
docker build -t balance-sheet-portal .
docker run -p 8080:3000 -v portal_data:/app/data balance-sheet-portal
```
### 3. Native Node.js Development
```bash
# Install dependencies
npm install
# Start development server (Express + Vite hot reload)
npm run dev
```
---
## ☁️ Deployment on Coolify
Refer to [`COOLIFY.md`](./COOLIFY.md) for step-by-step instructions on deploying via Docker Compose or Coolify Managed PostgreSQL.