# NordaBiz — Agent Instructions Platform: katalog firm i networking dla Izby Gospodarczej Norda Biznes (Wejherowo). Production: https://nordabiznes.pl | Status: LIVE ## Stack - **Backend:** Flask 3.0, SQLAlchemy 2.0, Python 3.9+, PostgreSQL - **Frontend:** HTML5, CSS3, Vanilla JS, Jinja2 - **AI:** Google Gemini 3 Flash (free tier) — moduł NordaGPT - **Security:** Flask-Login, Flask-WTF (CSRF), Flask-Limiter ## Project Structure ``` app.py # Main Flask app (routes, auth, API) database.py # SQLAlchemy models (Company, User, Chat, Forum...) gemini_service.py # Google Gemini AI integration nordabiz_chat.py # AI chat engine with company context search_service.py # Unified SearchService (synonyms, FTS, fuzzy) blueprints/ # 17 Flask blueprints (modular routes) templates/ # Jinja2 templates static/ # CSS, JS, images database/ # SQL schemas, migrations scripts/ # Python/Node.js utilities tests/ # Unit + integration tests ``` ## Key Conventions - **Slug format:** kebab-case, e.g. `pixlab-sp-z-o-o` - **NIP:** 10 digits, no dashes | **REGON:** 9 or 14 digits | **KRS:** 10 digits (companies only) - **Categories:** `IT`, `Construction`, `Services`, `Production`, `Trade`, `Other` - **Data quality levels:** `basic`, `enhanced`, `complete` ## Database - **Dev:** PostgreSQL via Docker (`localhost:5433/nordabiz`) - **Prod:** PostgreSQL on 57.128.200.27:5432 (OVH VPS inpi-vps-waw01, localhost from server) - After creating tables: `GRANT ALL ON TABLE ... TO nordabiz_app` - After creating sequences: `GRANT USAGE, SELECT ON SEQUENCE ... TO nordabiz_app` ## Running Locally ```bash docker compose up -d # Start PostgreSQL python3 app.py # Start Flask (port 5000 or 5001) ``` ## Tests ```bash pytest tests/ -v # All tests pytest tests/unit/ -v # Unit tests (no DB) pytest tests/integration/ -v # Integration tests (with DB) ``` ## Jinja2 Templates — IMPORTANT `{% block extra_js %}` in `base.html` is INSIDE a `