SecureAssist is a hybrid GenAI pilot project for an ISP security assistant orchestration platform.
The goal of the project is to prototype an AI assistant that can support security project integration workflows by analyzing project descriptions and generating:
- project summaries
- security risks with categories and severity levels
- ISP questions
- missing documents
- recommended actions
The project uses a local LLM through Ollama, so it does not require a paid OpenAI API key.
backend/: Node.js API used as the main backend layer between the frontend, PostgreSQL and the AI service.ai-service/: Python FastAPI microservice responsible for calling the local AI model through Ollama.frontend/: React/Vite UI for security analysis and prompt management.database/: PostgreSQL initialization script for prompt templates.docs/: project documentation, including local AI setup notes..github/workflows/: GitHub Actions CI configuration.
Current architecture:
React Frontend
→ Node.js Backend
→ PostgreSQL prompt_templates
→ Python FastAPI AI Service
→ Ollama Local LLM
→ llama3.2:3b
The frontend provides two main sections:
- Security Analysis: submit a project description and display a structured security analysis.
- Prompt Management: list prompt templates, inspect versions, and activate the prompt used by the analysis workflow.
The Node.js backend follows a layered architecture:
routes → services → repositories → database / external services
The backend loads the active prompt template from PostgreSQL, injects the project description into the prompt, then sends the final prompt to the Python FastAPI AI service.
The AI service calls the local Ollama API running on:
http://localhost:11434
Ollama executes the local model and returns a structured JSON response.
The backend parses the JSON response and sends it back to the frontend, where it is displayed as structured cards.
The project currently uses:
Ollama
llama3.2:3b
FastAPI
Uvicorn
PostgreSQL
Node.js
React
This allows the project to run locally without using a paid external AI API.
The backend is organized with a layered structure:
backend/src/
├── app.js
├── index.js
├── db/
│ └── pool.js
├── repositories/
│ └── promptRepository.js
├── routes/
│ ├── aiRoutes.js
│ ├── healthRoutes.js
│ ├── promptRoutes.js
│ └── securityRoutes.js
└── services/
├── aiService.js
├── healthService.js
├── promptService.js
└── securityAnalysisService.js
Responsibilities:
routes/: HTTP endpoints and request/response handling.services/: business logic and workflow orchestration.repositories/: database access.db/: PostgreSQL connection pool.aiService.js: communication with the Python AI service.securityAnalysisService.js: security analysis workflow orchestration.
SecureAssist stores prompt templates in PostgreSQL instead of hardcoding them directly in the backend.
The backend loads the active prompt for the use case:
ISP_SECURITY_ANALYSIS
from the prompt_templates table.
The prompt contains a placeholder:
{{projectDescription}}
The backend replaces this placeholder with the project description provided by the user.
This allows prompt templates to be versioned, activated/deactivated, and managed independently from the application code.
Current table:
prompt_templates
Main fields:
id
name
version
use_case
template
is_active
created_at
updated_at
SecureAssist exposes prompt management endpoints through the backend.
Available endpoints:
GET /api/prompts
GET /api/prompts/active?useCase=ISP_SECURITY_ANALYSIS
POST /api/prompts
PATCH /api/prompts/:id/activate
DELETE /api/prompts/:id
These endpoints allow the application to:
- list prompt templates
- retrieve the active prompt for a use case
- create a new prompt version
- activate a specific prompt version
The frontend includes a Prompt Management tab that displays available prompt templates, their versions, their active/inactive status, and allows activating another prompt version.
You need:
- Node.js
- npm
- Python 3
- pip
- Docker
- PostgreSQL container
- Ollama
- WSL/Linux terminal recommended
Install Ollama, then check the version:
ollama --versionDownload the local model:
ollama pull llama3.2:3bTest the model directly:
ollama run llama3.2:3bCheck that the Ollama API is reachable:
curl http://127.0.0.1:11434/api/tagsOllama usually runs on:
http://localhost:11434
SecureAssist uses PostgreSQL to store prompt templates.
The project includes a docker-compose.yml, but if Docker Compose is not available in the local environment, PostgreSQL can be started manually with Docker.
The database runs on local port 5433 to avoid conflicts with other local PostgreSQL containers.
Start PostgreSQL manually:
docker run -d \
--name secureassist-postgres \
-e POSTGRES_DB=secureassist \
-e POSTGRES_USER=secureassist_user \
-e POSTGRES_PASSWORD=secureassist_password \
-p 5433:5432 \
-v secureassist_postgres_data:/var/lib/postgresql/data \
-v "$(pwd)/database/init.sql:/docker-entrypoint-initdb.d/init.sql" \
postgres:16-alpineCheck that the container is running:
docker psConnect to the database:
docker exec -it secureassist-postgres psql -U secureassist_user -d secureassistList tables:
\dtExpected table:
prompt_templates
Exit PostgreSQL:
\qIf the database already exists and the init script needs to be applied manually:
docker exec -i secureassist-postgres psql -U secureassist_user -d secureassist < database/init.sqlCheck prompt templates:
SELECT id, name, version, use_case, is_active
FROM prompt_templates;Go to the AI service folder:
cd ai-serviceCreate a Python virtual environment:
python3 -m venv venvActivate it:
source venv/bin/activateInstall dependencies:
pip install -r requirements.txtCreate a .env file in ai-service/:
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama3.2:3bStart the FastAPI AI service:
uvicorn app:app --reload --port 8001The AI service runs on:
http://localhost:8001
Test it with:
curl http://localhost:8001/healthExpected response:
{
"status": "ok",
"service": "secureassist-ai",
"provider": "ollama",
"model": "llama3.2:3b"
}Go to the backend folder:
cd backendInstall dependencies:
npm installCreate a .env file in backend/:
PORT=8000
AI_SERVICE_URL=http://localhost:8001
DB_HOST=localhost
DB_PORT=5433
DB_NAME=secureassist
DB_USER=secureassist_user
DB_PASSWORD=secureassist_passwordStart the backend:
npm run devThe backend runs on:
http://localhost:8000
Test the backend health endpoint:
curl http://localhost:8000/healthTest the database health endpoint:
curl http://localhost:8000/health/dbExpected response:
{
"status": "ok",
"database": "connected"
}Test the ISP security analysis endpoint:
curl -X POST http://localhost:8000/api/security/analyze \
-H "Content-Type: application/json" \
-d '{"projectDescription":"A banking team wants to expose a new internal API that allows applications to access customer transaction history."}'Expected flow:
curl
→ Node.js Backend
→ PostgreSQL prompt_templates
→ FastAPI AI Service
→ Ollama
→ llama3.2:3b
Expected response includes:
{
"workflow": "isp-security-analysis",
"promptTemplate": {
"id": 1,
"name": "ISP Security Analysis Prompt",
"version": "v2",
"useCase": "ISP_SECURITY_ANALYSIS"
},
"structuredAnalysis": {
"projectSummary": "...",
"mainSecurityRisks": [
{
"title": "...",
"category": "...",
"severity": "...",
"impact": "...",
"recommendedControl": "..."
}
],
"ispQuestions": [],
"missingDocuments": [],
"recommendedActions": []
}
}List prompts:
curl "http://localhost:8000/api/prompts?useCase=ISP_SECURITY_ANALYSIS"Get active prompt:
curl "http://localhost:8000/api/prompts/active?useCase=ISP_SECURITY_ANALYSIS"Create a new prompt version:
curl -X POST http://localhost:8000/api/prompts \
-H "Content-Type: application/json" \
-d '{
"name": "ISP Security Analysis Prompt",
"version": "v3",
"useCase": "ISP_SECURITY_ANALYSIS",
"template": "You are an information security assistant. Analyze the following project and return ONLY valid JSON. Project: {{projectDescription}}",
"isActive": false
}'Activate a prompt version:
curl -X PATCH http://localhost:8000/api/prompts/1/activateDelete an inactive prompt version:
curl -X DELETE http://localhost:8000/api/prompts/2
## Frontend setup
Go to the frontend folder:
```bash
cd frontendInstall dependencies:
npm installStart the frontend:
npm run devThe frontend should be available at:
http://localhost:5173
The frontend includes two tabs:
- Security Analysis
- Prompt Management
The Prompt Management tab allows reviewing PostgreSQL-backed prompt templates, showing or hiding prompt content, and activating a prompt version from the UI.
Expected full flow:
React Frontend
→ Node.js Backend
→ PostgreSQL prompt_templates
→ FastAPI AI Service
→ Ollama
→ Structured security analysis UI
The project uses:
- Prettier for JavaScript, JSX, CSS, JSON and Markdown
- Black for Python
Run formatting from the root folder:
npm run formatCheck formatting:
npm run format:checkThe project includes a GitHub Actions workflow for basic quality checks.
The CI validates:
- root dependency installation
- backend dependency installation
- frontend dependency installation
- AI service dependency installation
- Prettier formatting
- Black formatting
- backend app loading
- Python syntax
- frontend build
Workflow file:
.github/workflows/ci.yml
Run PostgreSQL:
docker start secureassist-postgresStop PostgreSQL:
docker stop secureassist-postgresRun the AI service:
cd ai-service
source venv/bin/activate
uvicorn app:app --reload --port 8001Run the backend:
cd backend
npm run devRun the frontend:
cd frontend
npm run devList local Ollama models:
ollama listRun the model directly:
ollama run llama3.2:3bTest Ollama API:
curl http://127.0.0.1:11434/api/tagsTest backend security analysis:
curl -X POST http://localhost:8000/api/security/analyze \
-H "Content-Type: application/json" \
-d '{"projectDescription":"A new internal HR application will store employee personal data and expose an API for managers."}'Implemented:
- Local AI model integration with Ollama
- Python FastAPI AI service
- Node.js backend with layered architecture
- React frontend
- Security Analysis UI
- Prompt Management UI
- Structured JSON output
- Enhanced security risk schema with title, category, severity, impact and recommended control
- PostgreSQL-based prompt versioning
- Prompt management endpoints
- Active prompt template loaded from database
- Database health check endpoint
- Project-wide formatting with Prettier and Black
- GitHub Actions CI
The target use case is to build an AI assistant that helps security teams analyze a project early in its lifecycle.
Example input:
A banking team wants to expose a new internal API that allows applications to access customer transaction history.
Expected output:
- Project summary
- Main security risks with categories and severity levels
- Security impact for each risk
- Recommended control for each risk
- ISP questions to ask
- Missing documents
- Recommended actions
Potential next improvements:
- Add a frontend form to create new prompt versions
- Add prompt editing support
- Add prompt validation before activation
- Add document ingestion
- Add RAG-based document analysis
- Add security analysis history
- Add authentication later if needed
This project is currently a local GenAI prototype.
It is designed for learning and experimentation around:
- Local LLM integration
- AI service architecture
- Prompt orchestration
- Prompt versioning
- PostgreSQL-backed prompt management
- Security project analysis
- Backend/frontend integration
- GenAI application design