Rename project from imc-vibe to imc
- Binary name: imc-vibe -> imc - Go module: github.com/imc-vibe/backend -> github.com/imc/backend - JWT issuer: imc-vibe -> imc - UI labels: IMC Vibe -> IMC - Update all imports and comments
This commit is contained in:
parent
a4c6b04b37
commit
ff52be8adf
19 changed files with 52 additions and 40 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -4,7 +4,7 @@ build/
|
||||||
backend/cmd/server/embed/
|
backend/cmd/server/embed/
|
||||||
backend/tmp/
|
backend/tmp/
|
||||||
.env
|
.env
|
||||||
backend/imc-vibe
|
backend/imc
|
||||||
node_modules/
|
node_modules/
|
||||||
frontend/node_modules/
|
frontend/node_modules/
|
||||||
frontend/build/
|
frontend/build/
|
||||||
|
|
|
||||||
2
Makefile
2
Makefile
|
|
@ -1,7 +1,7 @@
|
||||||
.PHONY: all dev dev-frontend dev-backend build build-frontend build-backend clean test lint
|
.PHONY: all dev dev-frontend dev-backend build build-frontend build-backend clean test lint
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
APP_NAME := imc-vibe
|
APP_NAME := imc
|
||||||
FRONTEND_DIR := frontend
|
FRONTEND_DIR := frontend
|
||||||
BACKEND_DIR := backend
|
BACKEND_DIR := backend
|
||||||
BUILD_DIR := build
|
BUILD_DIR := build
|
||||||
|
|
|
||||||
20
README.md
20
README.md
|
|
@ -1,4 +1,4 @@
|
||||||
# IMC Vibe
|
# IMC
|
||||||
|
|
||||||
A self-sufficient web application to manage an ISPmail (Postfix, Dovecot, Rspamd) mail server.
|
A self-sufficient web application to manage an ISPmail (Postfix, Dovecot, Rspamd) mail server.
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ make build
|
||||||
### 2. Create Admin User
|
### 2. Create Admin User
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./build/imc-vibe --reset-admin-password
|
./build/imc --reset-admin-password
|
||||||
# This creates an admin user or resets the password
|
# This creates an admin user or resets the password
|
||||||
# Output: Username: admin, Password: (randomly generated)
|
# Output: Username: admin, Password: (randomly generated)
|
||||||
```
|
```
|
||||||
|
|
@ -44,7 +44,7 @@ make build
|
||||||
### 3. Run
|
### 3. Run
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./build/imc-vibe --bind=0.0.0.0 --port=8080
|
./build/imc --bind=0.0.0.0 --port=8080
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Access
|
### 4. Access
|
||||||
|
|
@ -97,7 +97,7 @@ Example service file at `/etc/systemd/system/imc-vibe.service`:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=IMC Vibe Mail Admin
|
Description=IMC Mail Admin
|
||||||
After=network.target mariadb.service postfix.service
|
After=network.target mariadb.service postfix.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|
@ -127,10 +127,22 @@ WantedBy=multi-user.target
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
|
Run development server that watches for file changes:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Build the binary into the build/ directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build frontend and backend
|
# Build frontend and backend
|
||||||
make build
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
Build only frontend or backend:
|
||||||
|
|
||||||
|
```sh
|
||||||
# Run backend only (uses filesystem frontend)
|
# Run backend only (uses filesystem frontend)
|
||||||
cd backend && go run ./cmd/server
|
cd backend && go run ./cmd/server
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
# Install air: go install github.com/air-verse/air@latest
|
# Install air: go install github.com/air-verse/air@latest
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
bin = "./tmp/imc-vibe"
|
bin = "./tmp/imc"
|
||||||
cmd = "go build -o ./tmp/imc-vibe ./cmd/server"
|
cmd = "go build -o ./tmp/imc ./cmd/server"
|
||||||
stop_on_error = true
|
stop_on_error = true
|
||||||
|
|
||||||
[log]
|
[log]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Package main is the entry point for the imc-vibe mail server admin application.
|
// Package main is the entry point for the IMC mail server admin application.
|
||||||
// This single binary contains both the Go backend API and the embedded SvelteKit frontend.
|
// This single binary contains both the Go backend API and the embedded SvelteKit frontend.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|
@ -11,11 +11,11 @@ import (
|
||||||
"os" // OS-level operations like reading command-line args
|
"os" // OS-level operations like reading command-line args
|
||||||
"strings" // string manipulation utilities
|
"strings" // string manipulation utilities
|
||||||
|
|
||||||
"github.com/gin-gonic/gin" // web framework
|
"github.com/gin-gonic/gin" // web framework
|
||||||
"github.com/imc-vibe/backend/internal/api" // HTTP API routing and handlers
|
"github.com/imc/backend/internal/api" // HTTP API routing and handlers
|
||||||
"github.com/imc-vibe/backend/internal/auth" // password hashing
|
"github.com/imc/backend/internal/auth" // password hashing
|
||||||
"github.com/imc-vibe/backend/internal/config" // configuration loading
|
"github.com/imc/backend/internal/config" // configuration loading
|
||||||
"github.com/imc-vibe/backend/internal/db" // database connection and operations
|
"github.com/imc/backend/internal/db" // database connection and operations
|
||||||
)
|
)
|
||||||
|
|
||||||
// main is the entry point of the application.
|
// main is the entry point of the application.
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
func main() {
|
func main() {
|
||||||
// Parse command-line flags.
|
// Parse command-line flags.
|
||||||
// Flags are optional arguments passed after the program name.
|
// Flags are optional arguments passed after the program name.
|
||||||
// Example: ./imc-vibe --bind=0.0.0.0 --port=8080
|
// Example: ./imc --bind=0.0.0.0 --port=8080
|
||||||
|
|
||||||
// --bind: The IP address the server should listen on.
|
// --bind: The IP address the server should listen on.
|
||||||
// 0.0.0.0 means listen on all network interfaces (accessible from other machines).
|
// 0.0.0.0 means listen on all network interfaces (accessible from other machines).
|
||||||
|
|
@ -69,14 +69,14 @@ func main() {
|
||||||
|
|
||||||
// Connect to the database (MariaDB/MySQL).
|
// Connect to the database (MariaDB/MySQL).
|
||||||
// The database stores both ISPmail data (virtual_users, virtual_domains, etc.)
|
// The database stores both ISPmail data (virtual_users, virtual_domains, etc.)
|
||||||
// and imc-vibe's own data (imc_users, imc_users2domains, etc.).
|
// and IMC's own data (imc_users, imc_users2domains, etc.).
|
||||||
database, err := db.Connect(cfg)
|
database, err := db.Connect(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to connect to database: %v", err) // Fatal = print and exit
|
log.Fatalf("Failed to connect to database: %v", err) // Fatal = print and exit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create database tables if they don't exist.
|
// Create database tables if they don't exist.
|
||||||
// This only creates imc-vibe's own tables, not the ISPmail tables.
|
// This only creates IMC's own tables, not the ISPmail tables.
|
||||||
if err := database.InitSchema(); err != nil {
|
if err := database.InitSchema(); err != nil {
|
||||||
log.Printf("Warning: Could not initialize schema: %v", err) // Non-fatal = continue
|
log.Printf("Warning: Could not initialize schema: %v", err) // Non-fatal = continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
module github.com/imc-vibe/backend
|
module github.com/imc/backend
|
||||||
|
|
||||||
go 1.25.0
|
go 1.25.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/imc-vibe/backend/internal/db"
|
"github.com/imc/backend/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AliasHandler struct {
|
type AliasHandler struct {
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/imc-vibe/backend/internal/auth"
|
"github.com/imc/backend/internal/auth"
|
||||||
"github.com/imc-vibe/backend/internal/db"
|
"github.com/imc/backend/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MaxLoginAttempts = 5
|
const MaxLoginAttempts = 5
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/imc-vibe/backend/internal/db"
|
"github.com/imc/backend/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DomainHandler struct {
|
type DomainHandler struct {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/imc-vibe/backend/internal/mail"
|
"github.com/imc/backend/internal/mail"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LogsHandler struct{}
|
type LogsHandler struct{}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/imc-vibe/backend/internal/auth"
|
"github.com/imc/backend/internal/auth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AuthContextKey is the key used to store auth context in gin.Context.
|
// AuthContextKey is the key used to store auth context in gin.Context.
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/imc-vibe/backend/internal/mail"
|
"github.com/imc/backend/internal/mail"
|
||||||
)
|
)
|
||||||
|
|
||||||
type QueueHandler struct{}
|
type QueueHandler struct{}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/imc-vibe/backend/internal/db"
|
"github.com/imc/backend/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StatsHandler struct {
|
type StatsHandler struct {
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/imc-vibe/backend/internal/db"
|
"github.com/imc/backend/internal/db"
|
||||||
"github.com/imc-vibe/backend/internal/mail"
|
"github.com/imc/backend/internal/mail"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserHandler struct {
|
type UserHandler struct {
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/imc-vibe/backend/internal/api/handlers"
|
"github.com/imc/backend/internal/api/handlers"
|
||||||
"github.com/imc-vibe/backend/internal/auth"
|
"github.com/imc/backend/internal/auth"
|
||||||
"github.com/imc-vibe/backend/internal/config"
|
"github.com/imc/backend/internal/config"
|
||||||
"github.com/imc-vibe/backend/internal/db"
|
"github.com/imc/backend/internal/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Router struct {
|
type Router struct {
|
||||||
|
|
@ -22,7 +22,7 @@ type Router struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(database *db.DB, cfg *config.Config) *Router {
|
func New(database *db.DB, cfg *config.Config) *Router {
|
||||||
jwtManager := auth.NewJWTManager(cfg.JWTSecret, "imc-vibe")
|
jwtManager := auth.NewJWTManager(cfg.JWTSecret, "imc")
|
||||||
|
|
||||||
r := &Router{
|
r := &Router{
|
||||||
authHandler: handlers.NewAuthHandler(database, jwtManager, cfg.TrustedProxies),
|
authHandler: handlers.NewAuthHandler(database, jwtManager, cfg.TrustedProxies),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Package db provides database access for the imc-vibe application.
|
// Package db provides database access for the IMC application.
|
||||||
// It uses GORM (Go ORM) for database operations.
|
// It uses GORM (Go ORM) for database operations.
|
||||||
//
|
//
|
||||||
// The database contains two sets of tables:
|
// The database contains two sets of tables:
|
||||||
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"gorm.io/gorm" // GORM ORM library
|
"gorm.io/gorm" // GORM ORM library
|
||||||
"gorm.io/gorm/logger" // GORM logger configuration
|
"gorm.io/gorm/logger" // GORM logger configuration
|
||||||
|
|
||||||
"github.com/imc-vibe/backend/internal/config" // configuration
|
"github.com/imc/backend/internal/config" // configuration
|
||||||
)
|
)
|
||||||
|
|
||||||
// DB wraps GORM's database connection with helper methods.
|
// DB wraps GORM's database connection with helper methods.
|
||||||
|
|
@ -70,7 +70,7 @@ type Alias struct {
|
||||||
func (Alias) TableName() string { return "virtual_aliases" }
|
func (Alias) TableName() string { return "virtual_aliases" }
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// imc-vibe Application Models (tables created by this app)
|
// IMC Application Models (tables created by this app)
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
// ImcUser represents an admin user who can log into this application.
|
// ImcUser represents an admin user who can log into this application.
|
||||||
|
|
@ -190,7 +190,7 @@ func Connect(cfg *config.Config) (*DB, error) {
|
||||||
return &DB{db}, nil
|
return &DB{db}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitSchema creates imc-vibe's database tables if they don't exist.
|
// InitSchema creates IMC's database tables if they don't exist.
|
||||||
// This only creates the imc_* tables, not the ISPmail virtual_* tables.
|
// This only creates the imc_* tables, not the ISPmail virtual_* tables.
|
||||||
// Called during application startup.
|
// Called during application startup.
|
||||||
func (d *DB) InitSchema() error {
|
func (d *DB) InitSchema() error {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "imc-vibe-frontend",
|
"name": "imc-frontend",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<a href="/" class="btn btn-ghost text-xl">IMC Vibe</a>
|
<a href="/" class="btn btn-ghost text-xl">IMC</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if selectedDomain}
|
{#if selectedDomain}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
<div class="min-h-screen flex items-center justify-center bg-base-200" data-theme="light">
|
<div class="min-h-screen flex items-center justify-center bg-base-200" data-theme="light">
|
||||||
<div class="card bg-base-100 shadow-xl w-full max-w-md">
|
<div class="card bg-base-100 shadow-xl w-full max-w-md">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h1 class="text-2xl font-bold text-center mb-2">IMC Vibe</h1>
|
<h1 class="text-2xl font-bold text-center mb-2">IMC</h1>
|
||||||
<p class="text-center text-base-content/60 mb-6">Mail Server Administration</p>
|
<p class="text-center text-base-content/60 mb-6">Mail Server Administration</p>
|
||||||
|
|
||||||
{#if error}
|
{#if error}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue