Main API on customer VPS (user mgmt, creds, login, mail etc ...)

lblt 9500d74a0f remove config.yaml 1 month ago
app 9e42f802df improve core apis 1 month ago
common 9e42f802df improve core apis 1 month ago
config 9e42f802df improve core apis 1 month ago
docs 9e42f802df improve core apis 1 month ago
errors 9e42f802df improve core apis 1 month ago
handlers 9e42f802df improve core apis 1 month ago
hook 6dfe80f82c update core api 1 month ago
jwtutils 9e42f802df improve core apis 1 month ago
logger 9e42f802df improve core apis 1 month ago
middleware 9e42f802df improve core apis 1 month ago
smtp 9e42f802df improve core apis 1 month ago
store 9e42f802df improve core apis 1 month ago
testing 9e42f802df improve core apis 1 month ago
validation 9e42f802df improve core apis 1 month ago
.dockerignore 9e42f802df improve core apis 1 month ago
.gitignore 9e42f802df improve core apis 1 month ago
Dockerfile 8146798a52 add dockerfile 1 month ago
README.md 6dfe80f82c update core api 1 month ago
config.sample.yaml 6dfe80f82c update core api 1 month ago
go.mod 9e42f802df improve core apis 1 month ago
go.sum 9e42f802df improve core apis 1 month ago
main.go 9e42f802df improve core apis 1 month ago

README.md

BYOM Core

A Go-based backend service for workspace and user management with built-in authentication.

Features

  • Workspace Management
  • User Authentication (JWT)
  • Profile Management
  • Email Notifications (SMTP)
  • SQLite Database (GORM)
  • Webhook Integration
  • TLS Support
  • Graceful Shutdown

Prerequisites

  • Go 1.22.5 or higher
  • SQLite 3

Project Structure

.
├── app/                # Core application components
│   ├── server.go      # HTTP server setup
│   ├── routes.go      # API route definitions
│   └── middleware.go  # HTTP middlewares
├── common/            # Shared models and utilities
├── config/            # Configuration management
├── handlers/          # HTTP request handlers
├── hook/             # Webhook integration
├── jwtutils/         # JWT authentication
├── smtp/             # Email service
│   └── templates/    # Email templates
├── store/            # Database operations
└── main.go           # Application entry point

Quick Start

Clone the repository:

git clone git@git.linuxforward.com:byom/byom-core.git
cd byom-core

Install dependencies:

go mod download

Copy and configure settings:

cp config.sample.yaml config.yaml

Run the server:

go run main.go serve

Configuration

The application is configured via config.yaml. Key sections:

server:
listening_port: 8443
tls:
enabled: false
database:
path: "./data/app.db"
log:
level: "info"
jwt:
jwt_secret: "your-jwt-secret"
smtp:
host: "smtp.example.com"
oauth2:
client_id: "your-client-id"

See config.sample.yaml for a complete example.

Development Commands

Run server:

go run main.go serve --config config.yaml

Show version:

go run main.go version

API Routes

All routes are prefixed with /api/v1/core

  • GET /health - Health check
  • POST /auth/login - User authentication
  • POST /workspaces/owner - Create workspace owner
  • PUT /workspaces/owner - Initialize workspace owner
  • POST /workspaces/invite - Invite users
  • GET /workspaces/invite/validate - Validate invitations

Protected routes require JWT authentication via the Authorization header.

Contributing

Fork the repository Create your feature branch Commit your changes Push to the branch Create a Pull Request

TODO

  • Add support for multiple OAuth2 providers
  • Improve error handling and validation
  • Add API documentation using OpenAPI/Swagger
  • Implement audit logging
  • Add metrics and monitoring
  • Improve test coverage
  • Add support for caching
  • Implement request tracing
  • Add support for webhooks configuration
  • Improve security headers configuration
  • Add support for recovery

License

Proprietary - All rights reserved