Backend Development
Guide for developing the FacilFlow backend.
Technology Stack
- Runtime: Node.js 18+
- Framework: Express.js
- Database: PostgreSQL, InfluxDB
- Auth: Firebase Admin SDK
- Logging: Winston
Project Structure
backend/
├── src/
│ ├── server.js # Express app setup
│ ├── routes/
│ │ ├── pipelines.js # Pipeline CRUD
│ │ ├── agents.js # Agent management
│ │ ├── catalog.js # Data catalog
│ │ └── health.js # Health checks
│ └── services/ # Business logic
├── tests/ # Jest tests
└── package.json
API Routes
Pipelines /api/pipelines
| Method | Endpoint | Description |
|---|---|---|
| GET | / | List all pipelines |
| POST | / | Create pipeline |
| GET | /:id | Get pipeline details |
| PUT | /:id | Update pipeline |
| DELETE | /:id | Delete pipeline |
| POST | /:id/start | Start pipeline |
| POST | /:id/stop | Stop pipeline |
Agents /api/agents
| Method | Endpoint | Description |
|---|---|---|
| GET | / | List all agents |
| GET | /:id | Get agent details |
| GET | /:id/status | Get agent health |
| POST | /:id/restart | Restart agent |
Catalog /api/catalog
| Method | Endpoint | Description |
|---|---|---|
| GET | / | Get full catalog |
| GET | /sources | List data sources |
| GET | /sources/:id/tags | List source tags |
| POST | /query | Query data |
Running Tests
cd backend
npm test # Run all tests
npm test -- --watch # Watch mode