-
Notifications
You must be signed in to change notification settings - Fork 0
Backend
WaiHein-REISys edited this page Feb 3, 2026
·
1 revision
The backend is a Python Flask API that serves REST endpoints for authentication, welcome content, menu, header nav, and Site Visit Plan (SVP) data. It uses a repository pattern and service layer for business logic.
- Python 3.11+
- Flask 3.0
- flask-cors 4.0
- psycopg2-binary (PostgreSQL)
- python-dotenv (environment)
| Path | Purpose |
|---|---|
app.py |
Flask app, CORS, route definitions |
config/database.py |
DB connection (from .env) |
data_repository.py |
All DB access (menu, header_nav, SVP, welcome) |
services/auth_service.py |
Login validation |
services/welcome_service.py |
Welcome message from DB |
database/init_db.py |
Create users, welcome, app_config, svp_plans, svp_plan_sections
|
database/seed_data.py |
Seed users and welcome content |
scripts/init_static_data.sql |
Menu, header nav, SVP config tables and static data |
| Method | Path | Description |
|---|---|---|
| POST | /api/auth/login |
Authenticate user |
| POST | /api/auth/logout |
Logout (stateless; client clears state) |
| GET | /api/welcome |
Welcome title and message |
| GET | /api/menu |
Sidebar menu items |
| GET | /api/layout/header-nav |
Header navigation items |
| GET | /api/svp/plans |
List site visit plans |
| POST | /api/svp/plans |
Create a new plan |
| GET | /api/svp/plans/<id> |
Get plan by ID |
| GET | /api/svp/config |
SVP grid/search config |
| GET | /api/svp/initiate/options |
Options for initiate form |
| GET |
/health, /api/health
|
Health check |
See API Reference for request/response details.
-
Routes in
app.pyreceive HTTP requests and call repository or services. -
Services (e.g.
authenticate_user) contain business logic and use the repository or DB where needed. -
Repository (
data_repository.py) opens connections, runs queries, and returns dicts/lists. No business logic.
cd backend
pip install -r requirements.txt
# Configure .env, run init_db.py, seed_data.py, init_static_data.sql
python app.pyDefault port: 3001 (override with PORT in .env).
Home · API Reference · Deployment
© 2026 REI Systems. All rights reserved.
Community Development Platform
Getting Started
Development
Features
Reference
Deployment