Development Guide

January 21, 2026 · View on GitHub

Complete guide for setting up and developing Nimbus locally.


Table of Contents


Prerequisites

RequirementVersionNotes
Node.js24+For frontend development
Go1.25+For backend development
PostgreSQL15+Database (18 recommended)
MakeAnyBuild automation
DockerOptionalFor production testing
  • pgAdmin - PostgreSQL GUI management
  • VS Code - With Go and TypeScript extensions
  • Postman or Insomnia - API testing

Quick Setup

# 1. Clone the repository
git clone https://github.com/Turbootzz/Nimbus.git
cd nimbus

# 2. Run setup (copies .env files, installs dependencies)
make setup

# 3. Create database in PostgreSQL
# Using pgAdmin or psql:
# CREATE DATABASE nimbus;

# 4. Configure environment
# Edit .env with your PostgreSQL credentials

# 5. Test database connection
make testdb

# 6. Run migrations
make migrate

# 7. Start development servers
make dev-backend    # Terminal 1
make dev-frontend   # Terminal 2

Access your app:


Project Structure

nimbus/
├── Makefile                 # Root-level commands
├── .env                     # Backend environment variables
├── .env.example             # Example configuration

├── backend/
│   ├── Makefile             # Backend-specific commands
│   ├── cmd/
│   │   ├── server/          # Main application entry
│   │   ├── migrate/         # Database migration runner
│   │   ├── seed/            # Test data seeder
│   │   └── testdb/          # Database connection tester
│   ├── internal/
│   │   ├── config/          # Configuration management
│   │   ├── db/              # Database & migrations
│   │   ├── handlers/        # HTTP request handlers
│   │   ├── middleware/      # Auth, CORS, logging
│   │   ├── models/          # Data models
│   │   ├── repository/      # Database operations
│   │   ├── services/        # Business logic
│   │   └── workers/         # Background tasks
│   └── go.mod

├── frontend/
│   ├── app/                 # Next.js App Router pages
│   ├── components/          # React components
│   ├── lib/                 # Utilities & API client
│   ├── types/               # TypeScript definitions
│   ├── .env.local           # Frontend environment
│   └── package.json

└── docs/
    ├── CONFIGURATION.md     # Environment variables
    └── DEVELOPMENT.md       # This file

Make Commands

Run make or make help to see all available commands.

Root Commands (from project root)

CommandDescription
make setupFirst-time setup (copy .env, install deps)
make dev-backendStart backend development server
make dev-frontendStart frontend development server
make testdbTest database connection
make migrateRun database migrations
make migrate-downRollback last migration
make seedSeed database with test users
make ci-checkRun all CI checks locally
make kill-portsKill processes on 8080/3000
make cleanClean build artifacts
make installInstall all dependencies

Backend Commands (from backend/)

CommandDescription
make devRun development server
make buildBuild production binary
make testRun all tests
make testdbTest database connection
make fmtFormat Go code
make fmt-checkCheck formatting (CI)
make vetRun go vet
make ci-checkRun all backend CI checks
make depsDownload & tidy dependencies
make migrate-upRun migrations
make migrate-create name=xxxCreate new migration
make seedSeed test data
make cleanRemove build artifacts

Frontend Commands (from frontend/)

CommandDescription
npm run devStart development server
npm run buildBuild for production
npm run startStart production server
npm run lintRun ESLint
npm run formatFormat with Prettier
npm run ci-checkRun all frontend CI checks

Database Setup

Option 1: Using pgAdmin

  1. Open pgAdmin
  2. Right-click on Databases → Create → Database
  3. Name: nimbus
  4. Save

Option 2: Using psql

psql -U postgres
CREATE DATABASE nimbus;
\q

Configure Connection

Edit .env in the project root:

DB_HOST=localhost      # Use 'localhost' for local dev
DB_PORT=5432
DB_NAME=nimbus
DB_USER=postgres       # Your PostgreSQL user
DB_PASSWORD=password   # Your PostgreSQL password

Verify Connection

make testdb

Run Migrations

make migrate

Migrations run automatically when starting the backend server.

Creating New Migrations

cd backend
make migrate-create name=add_user_preferences

This creates timestamped migration files in backend/internal/db/migrations/.


Running the Application

Development Mode

Start both servers in separate terminals:

# Terminal 1 - Backend (Go)
make dev-backend

# Terminal 2 - Frontend (Next.js)
make dev-frontend

Alternative: Direct Commands

# Backend
cd backend && go run cmd/server/main.go

# Frontend
cd frontend && npm run dev

Environment Files

FilePurpose
.envBackend configuration (root directory)
frontend/.env.localFrontend configuration

Important: The JWT_SECRET must match in both files!


Testing

Run All Tests

# Full CI check (recommended before commits)
make ci-check

Backend Tests Only

cd backend
make test           # Standard tests
make ci-check       # Tests with race detector

Frontend Tests

cd frontend
npm run lint        # Linting
npm run build       # Type checking + build

Test Database Connection

make testdb

Code Quality

Formatting

# Backend (Go)
cd backend && make fmt

# Frontend (TypeScript/JavaScript)
cd frontend && npm run format

Linting

# Backend
cd backend && make vet

# Frontend
cd frontend && npm run lint

Pre-commit Checks

Run before committing:

make ci-check

This runs:

  • Go formatting check
  • Go vet
  • Go tests with race detector
  • Frontend linting
  • Frontend build

Troubleshooting

Port Already in Use

make kill-ports

Or manually:

lsof -ti:8080 | xargs kill -9
lsof -ti:3000 | xargs kill -9

Database Connection Failed

  1. Verify PostgreSQL is running
  2. Check credentials in .env
  3. Ensure database nimbus exists
  4. Run make testdb to diagnose

Module Not Found (Go)

cd backend
go mod download
go mod tidy

Node Modules Issues

cd frontend
rm -rf node_modules package-lock.json
npm install

Migrations Failed

Check the error message. Common issues:

  • Database doesn't exist
  • Wrong credentials
  • Migration syntax error

To reset (development only):

# Drop and recreate database
psql -U postgres -c "DROP DATABASE nimbus;"
psql -U postgres -c "CREATE DATABASE nimbus;"
make migrate

JWT Errors

Ensure JWT_SECRET matches in both:

  • .env (backend)
  • frontend/.env.local

Minimum 32 characters required.


API Endpoints

Authentication

MethodEndpointDescription
POST/api/v1/auth/registerRegister new user
POST/api/v1/auth/loginUser login
POST/api/v1/auth/logoutUser logout
GET/api/v1/auth/meGet current user

Services

MethodEndpointDescription
GET/api/v1/servicesList all services
POST/api/v1/servicesCreate service
GET/api/v1/services/:idGet service
PUT/api/v1/services/:idUpdate service
DELETE/api/v1/services/:idDelete service
PUT/api/v1/services/reorderReorder services
POST/api/v1/services/:id/checkManual health check

Health

MethodEndpointDescription
GET/api/v1/healthAPI health check

Tips

  1. Hot Reload: Both frontend and backend support hot reload in development
  2. Database GUI: Use pgAdmin to inspect data during development
  3. API Testing: Use the health endpoint to verify backend is running
  4. Logs: Backend logs show in Terminal 1, frontend in Terminal 2
  5. VS Code: Install Go and TypeScript extensions for best experience

Next Steps