The NIA Backend powers the NIA language learning assistant with real-time audio processing and AI integration. Built with Go and optimized for low-latency communication, it handles all AI interactions and audio streaming between the mobile app and OpenAI's services.
- WebSocket Audio Streaming
- OpenAI API Integration
- Authentication Middleware
- Low-latency Processing
- Cloud Deployment
- Self-hosted AI Models
.
βββ config/ # Configuration management
βββ pkg/
β βββ api/ # HTTP/WebSocket handlers
β βββ openai/ # OpenAI API integration
β βββ util/ # Helper functions
βββ migrations/ # Database migrations
- Go 1.19+
- OpenAI API key
- Google Cloud SDK
# Clone the repository
git clone https://github.com/bielcarpi/nia_backend.git
# Install dependencies
go mod download
# Run locally
go run main.go
# Deploy to Google Cloud App Engine
gcloud app deploy
The backend implements a clean architecture pattern with:
- WebSocket handlers for real-time communication
- OpenAI service integration (GPT-3.5, Whisper, TTS)
- Authentication middleware
- Helper utilities
- Real-time streaming via WebSocket
- AAC codec support
- Optimized for low latency
- Future PCM16 support planned