Prerequisites
Ensure you have the following installed:- Go 1.21+: Download and Install
- PostgreSQL: Used for all persistence.
- Redis: Used for authentication caching.
- NATS: Used for cross-service event synchronization (Orders, CRM, Invoices, and permission cache invalidation).
Installation
-
Navigate to the Go backend directory:
-
Download dependencies:
-
Initialize the environment file:
Configuration
Edit the.env file with the following required variables:
Database (PostgreSQL)
Authentication (Better Auth)
Infrastructure
Database Migrations
The project uses GORM’sAutoMigrate for schema synchronization. To run migrations and seed default data (plans, etc.):
Running the Server
Development Mode (with Live Reload)
We useair for hot reloading:
Standard Run
http://localhost:8080.
Health Check
Verify the setup by visitinghttp://localhost:8080/health. It returns 200 OK if PostgreSQL, NATS, and the server are all functioning correctly.