Getting Started

Set up your local development environment and start running STORM DAY in minutes.

Prerequisites

Go1.21+
Node.js20+
pnpmlatest
Docker Desktoplatest

Environment Variables

Each service requires specific environment variables. Here are the key configurations:

Gateway

.env
NATS_URL=nats://localhost:4222
JWT_SECRET=your-secret-key
HTTP_PORT=8080

User Service

.env
DB_HOST=localhost
DB_PORT=5432
DB_NAME=storm_user_db
DB_USER=postgres
DB_PASSWORD=postgres
JWT_SECRET=your-secret-key

Message Service

.env
STORAGE=postgres  # or "memory" for testing
HTTP_PORT=8081
NATS_URL=nats://localhost:4222
DATABASE_URL=postgres://postgres:postgres@localhost:5432/storm_chat_db

Local Development Setup

Follow these steps in order to start the full stack locally:

1

Start Infrastructure

Start the required infrastructure services using Docker Compose:

docker compose up -d postgres-user postgres-chat nats redis
2

Start User Service

Start the NestJS user service on port 3000:

cd services/user
DB_NAME=storm_user_db npm run start:dev
3

Start Gateway

Start the Go gateway on port 8080:

cd services/gateway
go run ./cmd/main.go
4

Start Message Service

Start the Go message service on port 8081:

cd services/message
STORAGE=postgres HTTP_PORT=8081 go run ./cmd/main.go
5

Start Frontend

Start the Vue.js frontend on port 5174:

cd STORM_DAY_Project_Front
pnpm install
pnpm dev

Vite Proxy Configuration

The Vite dev server is configured to proxy API requests to the Gateway:

vite.config.ts
// vite.config.ts
export default defineConfig({
  server: {
    port: 5174,
    proxy: {
      '/api': 'http://localhost:8080',
      '/auth': 'http://localhost:8080',
      '/users': 'http://localhost:8080',
      '/ws': {
        target: 'ws://localhost:8080',
        ws: true
      }
    }
  }
})

Production Environment

Azure AKS Deployment

The backend is currently deployed on Azure AKS at http://51.138.200.66:8080

For frontend-only development, point the Vite proxy to the production backend and only run pnpm dev.

Troubleshooting

NATS connection refused

Ensure NATS is running: docker ps | grep nats

Database connection failed

Check PostgreSQL is running and DB_NAME matches your environment

WebSocket not connecting

Verify the JWT token is valid and the Gateway is running on port 8080