Developer GuideLocal Setup
Developer Guide

Local Development Setup

Step-by-step guide to running the Neostra platform locally for development.

Local Development Setup

This guide covers how to set up and run the full Neostra platform on your local machine for development. The platform consists of multiple services spanning Java/Gradle backends, Node.js frontends, and Python workers.

Prerequisites

Service Architecture

Step 1: Start Databases

Create a docker-compose.yml in your workspace root:

version: "3.8"
services:
  mongodb:
    image: mongo:6
    ports:
      - "27017:27017"
    volumes:
      - mongo-data:/data/db
    environment:
      MONGO_INITDB_DATABASE: dpdp

  postgres:
    image: postgres:14
    ports:
      - "5432:5432"
    volumes:
      - pg-data:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: neostra
      POSTGRES_PASSWORD: neostra_dev
      POSTGRES_DB: neostra

volumes:
  mongo-data:
  pg-data:
docker compose up -d

Step 2: Configure Environment Variables

Create a .env file or export the following variables in your shell. Each service reads its configuration from environment variables.

Never commit .env files or secrets to version control. Add .env to your .gitignore.

# MongoDB
export MONGODB_URI="mongodb://localhost:27017"
export MONGODB_DATABASE="dpdp"

# JWT Configuration
export JWT_SECRET="your-local-dev-jwt-secret-min-32-chars"
export JWT_EXPIRATION=10800000
export JWT_TEMP_EXPIRATION=1800000

# SendGrid (use test key or mock for local dev)
export SENDGRID_API_KEY="SG.test-key-for-local-dev"

# Google Cloud Storage (optional for local dev)
export GCS_PROJECT_ID="your-gcs-project"
export GCS_BUCKET_NAME="neostra-dev-uploads"
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"

# CORS
export CORS_ORIGINS="http://localhost:5173,http://localhost:3000"

Step 3: Run Migrations

The neostra-migrations service must be run once before starting the platform. It uses Mongock change units to seed MongoDB with initial data.

Migrations are idempotent. Running them multiple times will not duplicate data. Mongock tracks which change units have already been applied.

cd neostra-migrations
./gradlew bootRun

What Migrations Seed

Step 4: Start Backend Services

Start neostra-core (Port 9000)

The primary backend service. Must be started first as other services and the UI depend on it.

cd neostra-core
./gradlew bootRun

Verify it is running:

curl http://localhost:9000/api/v1/health

Start CPMP services

The Consent Platform Management services. Start each in a separate terminal.

# Terminal 1
cd cpmp-api-service
./gradlew bootRun

# Terminal 2
cd cpmp-log-receipt-service
./gradlew bootRun

# Terminal 3
cd cpmp-reporting-service
./gradlew bootRun

# Terminal 4
cd cpmp-crawler-service
./gradlew bootRun

Start Data Discovery (Port 8080)

cd data-discovery-boot
./gradlew bootRun

Start the Python scanner worker in a separate terminal:

cd data-discovery-scanner
pip install -r requirements.txt
python -m scanner.main

Start astra-core (Port 9010)

The admin control plane service.

cd astra-core
./gradlew bootRun

Step 5: Start Frontend Applications

The main platform UI, built with Vite.

cd neostra-ui
npm install
VITE_CORE_BASE_URL=http://localhost:9000 npm run dev

Open http://localhost:5173 in your browser.

Service Port Reference

ServicePortTechnologyDescription
neostra-core9000Java / GradlePrimary API backend
neostra-ui5173Vite / ReactMain platform frontend
neostra-migrations--Java / GradleOne-time migration runner
cpmp-api-service9001Java / GradleConsent API
cpmp-log-receipt-service9002Java / GradleConsent log ingestion
cpmp-reporting-service9003Java / GradleConsent reporting
cpmp-crawler-service9004Java / GradleWebsite cookie crawler
data-discovery-boot8080Java / GradleData discovery API
data-discovery-scanner--PythonData source scanner worker
astra-core9010Java / GradleAdmin control plane API
astra-ui--Vite / ReactAdmin control plane frontend
MongoDB27017MongoDB 6+Primary document store
PostgreSQL5432PostgreSQL 14+Relational store for CPMP and Discovery

Troubleshooting

For the minimum viable local setup, you only need MongoDB, neostra-migrations, neostra-core, and neostra-ui. Other services can be started as needed for the features you are working on.