Skip to content
bingowebPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

10 Commits

Folders and files

Repository files navigation

HomeOS v2.0 - Enterprise-Grade Ev Sunucu YΓΆnetim Sistemi

Modern, güvenli, âlçeklenebilir ev sunucu yânetim platformu. USB'den başlatılabilir, production-ready.

HomeOS Lisans Dil TypeScript Production Ready

πŸŽ‰ v2.0 Yenilikler

  • βœ… Prisma ORM - PostgreSQL/SQLite veritabanΔ± desteği
  • βœ… Repository Pattern - Clean architecture
  • βœ… Dependency Injection - TSyringe IoC container
  • βœ… Winston Logging - Professional logging system
  • βœ… HttpOnly Cookies - Secure authentication
  • βœ… Swagger API Docs - OpenAPI 3.0 documentation
  • βœ… Docker Compose - Production deployment ready
  • βœ… Audit Logging - Complete action tracking
  • βœ… Multi-User Support - Database-backed user management

Detaylı değişiklikler için CHANGELOG.md dosyasına bakın.

πŸš€ Γ–zellikler

Core Features

  • πŸ“Š Real-time Dashboard - CPU, RAM, Disk, Network (WebSocket)
  • 🐳 Docker Management - Full container lifecycle
  • πŸ“ File Manager - Secure web-based file browser
  • πŸͺ App Store - 8+ ready-to-use application templates
  • βš™οΈ Settings Panel - User, security, system configuration
  • πŸŒ™ Modern UI - Glassmorphism design, fully Turkish

Backend Architecture

  • πŸ—„οΈ Prisma ORM - Type-safe database access
  • πŸ“¦ Repository Pattern - Separation of concerns
  • πŸ’‰ Dependency Injection - Testable, maintainable code
  • πŸ“ Structured Logging - Winston with rotation
  • πŸ”„ Refresh Tokens - Extended sessions (30 days)
  • πŸ“š API Documentation - Swagger UI included
  • 🎯 Custom Error Handling - Typed error responses

Security Features

  • πŸ” JWT + Cookies - HttpOnly, Secure, SameSite
  • πŸ›‘οΈ RBAC - Role-based access control
  • πŸ“Š Audit Trail - All critical actions logged
  • ⏱️ Rate Limiting - DDoS protection
  • πŸ”’ Account Lockout - Brute-force prevention
  • πŸ”‘ bcrypt 12 - Strong password hashing
  • 🚫 Input Validation - XSS & injection prevention

πŸ“‹ Requirements

Development

  • Node.js 18+
  • pnpm package manager
  • Docker (optional, for container management)

Production

  • Docker & Docker Compose
  • PostgreSQL 15+ (or SQLite for small deployments)
  • SSL/TLS certificate (recommended)

πŸ› οΈ Quick Start (Development)

# 1. Clone repository
git clone <repository-url>
cd HomeOS

# 2. Install dependencies
cd backend && pnpm install
cd ../frontend && pnpm install

# 3. Setup database
cd ../backend
cp .env.example .env
# Edit .env and change JWT_SECRET, SESSION_SECRET!

pnpm prisma db push
pnpm db:seed

# 4. Start development servers
# Terminal 1 - Backend
pnpm dev

# Terminal 2 - Frontend
cd ../frontend
pnpm dev

# 5. Open browser
# Frontend: http://localhost:5173
# API: http://localhost:3001
# API Docs: http://localhost:3001/api-docs

Default Login:

  • Username: admin
  • Password: admin123

⚠️ Change this password immediately after first login!

🐳 Production Deployment

Using Docker Compose (Recommended)

# 1. Clone and configure
git clone <repository-url>
cd HomeOS

# 2. Setup environment
cp backend/.env.example backend/.env
# Edit backend/.env:
# - Change JWT_SECRET to a random 32+ char string
# - Change SESSION_SECRET to a random 32+ char string
# - Change POSTGRES_PASSWORD in docker-compose.yml

# 3. Start services
docker-compose up -d

# 4. Check logs
docker-compose logs -f

# 5. Access
# http://your-server-ip (or configure DNS + SSL)

Included Services:

  • postgres - PostgreSQL 15 database
  • redis - Cache & session store
  • backend - Node.js API server
  • frontend - React SPA (nginx)
  • nginx - Reverse proxy with SSL support

Manual Deployment

# Backend
cd backend
pnpm install --prod
pnpm prisma migrate deploy
pnpm db:seed
pnpm build
NODE_ENV=production pnpm start

# Frontend
cd frontend
pnpm install
pnpm build
# Serve dist/ folder with nginx/apache

πŸ“ Project Structure

homeos/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/          # Configuration (DI, Swagger)
β”‚   β”‚   β”œβ”€β”€ middleware/      # Auth, error handling
β”‚   β”‚   β”œβ”€β”€ repositories/    # Data access layer
β”‚   β”‚   β”œβ”€β”€ rotalar/         # API routes
β”‚   β”‚   β”œβ”€β”€ servisler/       # Business logic
β”‚   β”‚   β”œβ”€β”€ types/           # TypeScript definitions
β”‚   β”‚   β”œβ”€β”€ utils/           # Helpers, logger, errors
β”‚   β”‚   └── index.ts         # Entry point
β”‚   β”œβ”€β”€ prisma/
β”‚   β”‚   β”œβ”€β”€ schema.prisma    # Database schema
β”‚   β”‚   └── seed.ts          # Seed data
β”‚   β”œβ”€β”€ Dockerfile           # Production image
β”‚   └── package.json
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ sayfalar/        # Pages
β”‚   β”‚   β”œβ”€β”€ bilesenler/      # Components
β”‚   β”‚   β”œβ”€β”€ depolar/         # Zustand stores
β”‚   β”‚   └── App.tsx
β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”œβ”€β”€ nginx.conf
β”‚   └── package.json
β”‚
β”œβ”€β”€ nginx/
β”‚   └── nginx.conf           # Reverse proxy config
β”‚
β”œβ”€β”€ docker-compose.yml       # Multi-container orchestration
β”œβ”€β”€ CHANGELOG.md             # Version history
└── README.md                # This file

πŸ”Œ API Documentation

Live API Docs

Access Swagger UI at: http://localhost:3001/api-docs

Key Endpoints

Authentication

POST   /api/kimlik/giris             Login
POST   /api/kimlik/cikis             Logout
POST   /api/kimlik/sifre-degistir    Change password
POST   /api/kimlik/yenile            Refresh token
GET    /api/kimlik/dogrula           Validate token

System

GET    /api/sistem/bilgi             Full system info
GET    /api/sistem/istatistikler     Real-time stats
GET    /api/sistem/surecler          Running processes

Docker

GET    /api/docker/konteynerler      List containers
POST   /api/docker/konteynerler/:id/baslat      Start
POST   /api/docker/konteynerler/:id/durdur      Stop
DELETE /api/docker/konteynerler/:id             Remove
GET    /api/docker/konteynerler/:id/loglar      Logs

Files

GET    /api/dosyalar/listele         List directory
POST   /api/dosyalar/klasor-olustur  Create folder
DELETE /api/dosyalar/sil             Delete file/folder
POST   /api/dosyalar/yukle           Upload file

πŸ›‘οΈ Security

Production Checklist

  • Change JWT_SECRET to strong random value (32+ chars)
  • Change SESSION_SECRET to strong random value (32+ chars)
  • Change default admin password
  • Change PostgreSQL password
  • Setup SSL/TLS (Let's Encrypt recommended)
  • Configure firewall (only 80, 443 open)
  • Set NODE_ENV=production
  • Enable COOKIE_SECURE=true
  • Setup log rotation
  • Configure backup strategy
  • Review rate limiting settings

Security Features

Authentication & Authorization

  • JWT with access (7d) & refresh (30d) tokens
  • HttpOnly, Secure, SameSite cookies
  • Role-based access control (yonetici, kullanici)
  • Database-backed session management
  • Account lockout: 5 failures β†’ 15min lock

Network Security

  • Helmet.js security headers
  • CORS with origin validation
  • Rate limiting: 100 req/15min (general), 5 req/1h (login)
  • CSRF protection ready

Data Security

  • bcrypt password hashing (12 rounds)
  • Input validation (express-validator)
  • XSS protection (sanitize-html, DOMPurify)
  • Path traversal prevention
  • SQL injection prevention (Prisma ORM)

Monitoring

  • Audit logging for all critical actions
  • Winston structured logging
  • Performance tracking
  • Error tracking with stack traces

πŸ”§ Configuration

Environment Variables

Create backend/.env from backend/.env.example:

# Server
PORT=3001
NODE_ENV=production

# Security (CHANGE THESE!)
JWT_SECRET=your-super-secret-key-32-chars-minimum
JWT_EXPIRES_IN=7d
JWT_REFRESH_EXPIRES_IN=30d
SESSION_SECRET=another-secret-key-32-chars-minimum
BCRYPT_ROUNDS=12

# Database
# Development (SQLite)
DATABASE_URL="file:./dev.db"

# Production (PostgreSQL)
# DATABASE_URL="postgresql://homeos:password@localhost:5432/homeos?schema=public"

# CORS
IZIN_VERILEN_ORIGIN=https://yourdomain.com

# Cookies
COOKIE_SECURE=true
COOKIE_SAME_SITE=strict

# Logging
LOG_LEVEL=info
LOG_DIR=./logs

# File Upload
MAX_FILE_SIZE=104857600
MAX_FILES=10

πŸ“Š Database

Migrations

# Create migration
pnpm prisma migrate dev --name migration_name

# Apply migrations (production)
pnpm prisma migrate deploy

# Reset database (dev only!)
pnpm prisma migrate reset

# Open Prisma Studio
pnpm prisma studio

Seed Data

# Seed database
pnpm db:seed

Default seed includes:

  • Admin user (admin/admin123)
  • Default settings
  • 6 application templates (Nextcloud, Portainer, etc.)

πŸ§ͺ Testing

# Run tests (coming soon)
pnpm test

# Coverage
pnpm test:coverage

# E2E tests
pnpm test:e2e

πŸš€ Performance

Optimization Tips

  1. Production Build: Always use pnpm build for production
  2. Database Indexing: Schema includes optimized indexes
  3. Caching: Redis ready for session & API caching
  4. Static Assets: Nginx serves frontend with caching
  5. Connection Pooling: Prisma handles DB connection pool
  6. Code Splitting: Frontend uses dynamic imports (coming)

🀝 Contributing

Contributions welcome! Please:

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

Commit Convention:

  • feat: - New feature
  • fix: - Bug fix
  • docs: - Documentation
  • refactor: - Code refactoring
  • security: - Security update
  • perf: - Performance improvement

πŸ“ License

MIT License - see LICENSE file for details.

πŸ™ Acknowledgments

  • Inspired by CasaOS
  • Built with React, Express, Prisma, and TypeScript
  • Icons by Lucide React

πŸ“§ Support


Version: 2.0.0 Last Updated: 2026-01-22 Minimum Node.js: 18.0.0

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages