chore: initial project structure

This commit is contained in:
2026-05-23 17:57:37 +03:00
commit 551c75a232
13 changed files with 94 additions and 0 deletions

21
.gitignore vendored Normal file
View File

@@ -0,0 +1,21 @@
# Binaries
*.exe
*.dll
*.so
*.dylib
*.test
*.out
# Go
vendor/
go.sum
# IDE
.idea/
.vscode/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db

25
README.md Normal file
View File

@@ -0,0 +1,25 @@
# MrixsCraft Server
Minecraft серверная часть на Go (net/http + PostgreSQL).
## Сборка
```bash
go build -o mrixscraft-server ./cmd/server
```
## Запуск
```bash
export SERVER_PORT=8080
export DATABASE_URL="postgres://user:pass@localhost:5432/mrixscraft"
go run ./cmd/server
```
## Переменные окружения
| Переменная | Описание | По умолчанию |
|------------|----------|--------------|
| `SERVER_PORT` | Порт HTTP-сервера | `8080` |
| `DATABASE_URL` | DSN PostgreSQL | — |

26
cmd/server/main.go Normal file
View File

@@ -0,0 +1,26 @@
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {
port := os.Getenv("SERVER_PORT")
if port == "" {
port = "8080"
}
mux := http.NewServeMux()
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintln(w, "ok")
})
log.Printf("MrixsCraft Server starting on :%s", port)
if err := http.ListenAndServe(":"+port, mux); err != nil {
log.Fatal(err)
}
}

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module github.com/Mrixs/MrixsCraft-server
go 1.22

2
internal/admin/admin.go Normal file
View File

@@ -0,0 +1,2 @@
// package admin implements admin panel endpoints (modpack management, CI/CD release).
package admin

3
internal/api/api.go Normal file
View File

@@ -0,0 +1,3 @@
// Package api implements public HTTP endpoints for the launcher and website.
package api

2
internal/auth/auth.go Normal file
View File

@@ -0,0 +1,2 @@
// Package auth implements Yggdrasil authentication protocol.
package auth

2
internal/cas/cas.go Normal file
View File

@@ -0,0 +1,2 @@
// package cas implements Content-Addressable Storage for files (mods, assets, etc).
package cas

View File

@@ -0,0 +1,2 @@
// package config handles server configuration (env vars, config files).
package config

View File

@@ -0,0 +1,2 @@
// package database manages PostgreSQL connections, migrations, and data models.
package database

View File

@@ -0,0 +1,2 @@
// package middleware provides HTTP middleware (JWT, CORS, rate limiting, logging).
package middleware

View File

@@ -0,0 +1,2 @@
// package templates handles Go html/template rendering for the site and admin panel.
package templates

2
pkg/utils/utils.go Normal file
View File

@@ -0,0 +1,2 @@
// package utils provides shared utility functions (SHA-1, ZIP, etc.).
package utils