Skip to content

Rivalz-ai/framework-be

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Rivalz Framework Backend

A high-performance Go backend framework built with modern technologies for scalable web applications and microservices.

πŸš€ Features

  • High Performance: Built with Go 1.23 and Fiber web framework
  • Multi-Database Support: MongoDB, PostgreSQL, and Redis integration
  • Message Queue: Kafka integration for event-driven architecture
  • Monitoring: Elastic APM integration for application performance monitoring
  • Authentication: JWT-based authentication system
  • API Documentation: Swagger/OpenAPI documentation
  • Container Ready: Docker support with multi-stage builds
  • Blockchain Integration: Ethereum smart contract support
  • Modular Architecture: Clean separation of concerns with modular design

πŸ›  Tech Stack

  • Language: Go 1.23
  • Web Framework: Fiber v2
  • Databases:
    • MongoDB (via mongo-driver)
    • PostgreSQL (via GORM)
    • Redis (for caching and pub/sub)
  • Message Queue: Apache Kafka
  • Monitoring: Elastic APM
  • Authentication: JWT
  • Documentation: Swagger
  • Container: Docker

πŸ“‹ Prerequisites

  • Go 1.23 or higher
  • Docker (optional)
  • MongoDB
  • PostgreSQL
  • Redis
  • Apache Kafka

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/Rivalz-ai/framework-be.git
cd framework-be

2. Install Dependencies

go mod download

3. Environment Configuration

Create a .env file in the root directory with your configuration:

# Hashicorp Vault Configuration
KEY_STORE_HOST     =https://vault.rivalz.ai
KEY_STORE_PORT     =8200

KEY_STORE_USER     =
KEY_STORE_PASSWORD =
KEY_STORE_DIR      =

4. Run the Application

Development Mode

go run main.go

Using Air (Hot Reload)

air

Using Docker

# Build the image
docker build -t rivalz-framework-be .

# Run the container
docker run -p 30000:30000 rivalz-framework-be

πŸ“š API Documentation

Once the application is running, you can access the Swagger documentation at:

http://localhost:30000/swagger/

πŸ— Project Structure

framework-be/
β”œβ”€β”€ acl/                    # Access Control Layer
β”œβ”€β”€ define/                 # Contract definitions and ABIs
β”‚   └── abi/               # Ethereum smart contract ABIs
β”œβ”€β”€ middleware/             # HTTP middleware
β”œβ”€β”€ models/                 # Data models
β”œβ”€β”€ modules/                # Business logic modules
β”‚   β”œβ”€β”€ agent/             # Agent management
β”‚   β”œβ”€β”€ project/           # Project management
β”‚   β”œβ”€β”€ user/              # User management
β”‚   └── x/                 # Extended functionality
β”œβ”€β”€ routes/                 # API route definitions
β”œβ”€β”€ server/                 # Server configuration
β”œβ”€β”€ types/                  # Type definitions
β”œβ”€β”€ main.go                 # Application entry point
β”œβ”€β”€ go.mod                  # Go module file
β”œβ”€β”€ go.sum                  # Go module checksums
β”œβ”€β”€ Dockerfile             # Docker configuration
└── air.toml               # Air hot reload configuration

πŸ”§ Configuration

The application supports multiple configuration sources:

  • Environment variables
  • Configuration files
  • Vault integration for secrets management

Key Configuration Areas

  • Database: MongoDB, PostgreSQL, and Redis connections
  • Kafka: Message broker configuration
  • APM: Elastic APM monitoring setup
  • JWT: Authentication secret keys
  • HTTP: Server port and middleware settings

πŸ§ͺ Testing

# Run all tests
go test ./...

# Run tests with coverage
go test -cover ./...

# Run specific module tests
go test ./modules/agent/...

πŸ“¦ Deployment

Docker Deployment

# Build production image
docker build -t rivalz-framework-be:latest .

# Run with environment variables
docker run -d \
  -p 30000:30000 \
  -e MONGODB_URI=mongodb://your-mongo:27017 \
  -e POSTGRES_URI=postgres://user:pass@your-postgres:5432/db \
  -e REDIS_URI=redis://your-redis:6379 \
  rivalz-framework-be:latest

Kubernetes Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rivalz-framework-be
spec:
  replicas: 3
  selector:
    matchLabels:
      app: rivalz-framework-be
  template:
    metadata:
      labels:
        app: rivalz-framework-be
    spec:
      containers:
      - name: rivalz-framework-be
        image: rivalz-framework-be:latest
        ports:
        - containerPort: 30000
        env:
        - name: MONGODB_URI
          valueFrom:
            secretKeyRef:
              name: db-secrets
              key: mongodb-uri
        - name: POSTGRES_URI
          valueFrom:
            secretKeyRef:
              name: db-secrets
              key: postgres-uri

πŸ” Monitoring

The application integrates with Elastic APM for monitoring:

  • Application performance metrics
  • Request tracing
  • Error tracking
  • Database query monitoring

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

πŸ†˜ Support

For support and questions:

  • Create an issue in the GitHub repository
  • Contact the development team
  • Check the API documentation at /swagger/

πŸ”„ Version History

  • v1.0.0: Initial release with core framework features
  • Support for MongoDB, PostgreSQL, and Redis
  • Kafka integration for event-driven architecture
  • Elastic APM monitoring
  • JWT authentication
  • Swagger API documentation

Built with ❀️ by the Rivalz Team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages