AI Representative Governance System
- Node.js: v18 or higher
- Docker: Latest stable version
- Docker Compose: Latest stable version (usually included with Docker Desktop)
- npm: v7 or higher
# Make sure Docker is running first!
docker-compose up -d postgres redis # Start database and Redis services
# Install dependencies
npm ci
# Start servers using convenience scripts
./scripts/start-servers.sh # Starts both backend and frontend
# Alternatively, start servers manually
npm run dev:backend # Start backend in watch mode on http://localhost:4000
npm run dev:frontend # Start frontend on http://localhost:5173
# Stop all servers when done
./scripts/stop-servers.shOn first run, you'll need to set up the database:
cd backend
npx prisma migrate dev # Apply all migrations
npx prisma db seed # Seed the database with initial dataYou can also run the entire stack with Docker:
# Make sure Docker is running!
docker-compose up --build -d # Build and start all services (postgres, redis, backend, frontend)
docker-compose exec backend npm run migrate
docker-compose exec backend npm run seedAccess the application at:
- Frontend: http://localhost:5173
- Backend API: http://localhost:4000
The backend service requires a .env file in the backend directory. Copy the example file and modify as needed:
cp backend/.env.example backend/.envKey environment variables:
DB_URL: PostgreSQL connection stringREDIS_URL: Redis connection stringJWT_SECRET: Secret for JWT token generationOPENROUTER_API_KEY: Your OpenRouter API key for LLM services
If you encounter database connection errors:
- Ensure Docker is running
- Check if PostgreSQL container is running:
docker ps | grep postgres - If it's not running, start the containers:
docker-compose up -d postgres redis
- Restart the backend server
cd backend && npm run dev
If login attempts fail with a 500 server error:
- Check backend logs for database connection errors
- Ensure the PostgreSQL container is running
- Verify that your backend/.env file has the correct DB_URL
If the frontend shows API errors:
- Ensure both frontend and backend servers are running
- Check that the backend is accessible at http://localhost:4000/api/health
- Look for CORS errors in the browser console
backend/: Node.js Express server with Prisma ORMsrc/: Source coderoutes/: API routesmiddleware/: Express middlewareservices/: Business logicutils/: Utility functions
prisma/: Database schema and migrations
frontend/: React applicationsrc/: Source codecomponents/: React componentspages/: Page componentscontext/: React context providersapi/: API client
npm run dev:backend: Start backend server in development modenpm run dev:frontend: Start frontend dev server with hot reloadnpm run build: Build the application for productionnpm run test: Run tests./scripts/start-servers.sh: Start both backend and frontend servers./scripts/stop-servers.sh: Stop all running servers
- See
HANDOFF.mdfor the current state of the project and next steps - See
TESTING_LOG.mdfor testing history and known issues - See
NDNE_CANONICAL_COMPLETION_AUDIT.mdfor remaining implementation tasks