Skip to content

luoxthedev/statix

Repository files navigation

Statix

A modern static site hosting platform with file management and real-time deployment. Statix is THE open-source alternative to Netlify.

πŸ‡«πŸ‡· Version franΓ§aise

πŸš€ Features

  • Static site management: Easily upload and manage your HTML/CSS/JS sites
  • Multilingual interface: Support for French and English (real-time language switching)
  • Intuitive dashboard: View your sites, statistics, and files at a glance
  • Instant deployment: Your sites are accessible immediately after upload
  • Subdomain routing: Access your sites via slug.lvh.me:3000 or /sites/id/
  • Configurable main file: Choose which HTML file to serve by default
  • Secure authentication: Login/register system with JWT
  • File management: Upload, delete, and organize your files

πŸ› οΈ Technologies

Frontend

  • React 18 with TypeScript
  • Vite for build and dev server
  • Tailwind CSS for styling
  • shadcn/ui for UI components
  • Zustand for state management
  • i18next for internationalization
  • Framer Motion for animations

Backend

  • Express.js for REST API
  • SQLite for database (default), with support for MySQL/MariaDB and Supabase (Postgres)
  • Multer for file uploads
  • JWT for authentication
  • bcrypt for password hashing

πŸ“¦ Installation

Prerequisites

  • Node.js 18+ and npm
  • Git

Installation Steps

# Clone the repository
git clone https://github.com/luoxthedev/static-site-host.git
cd static-site-host

# Install frontend dependencies
npm install

# Install backend dependencies
cd server
npm install
cd ..

πŸš€ Getting Started

Quick Start (both servers)

# From the root folder, start the backend
npm run server

# In another terminal, start the frontend
npm run dev

Manual Start

Backend (port 3000):

cd server
npm start

Frontend (port 8080):

npm run dev

🌐 Access

βš™οΈ Configuration

Environment Variables

Create a .env file in the server/ folder (see server/.env.example):

PORT=3000
JWT_SECRET=your_jwt_secret_here
SITES_ROOT=uploads

Database Configuration

Statix supports three database backends. Set DB_TYPE in your .env file:

SQLite (default – local file, no setup needed)

DB_TYPE=sqlite
SQLITE_FILE=./database.sqlite

MySQL / MariaDB (VPS)

Install the driver first:

cd server && npm install mysql2
DB_TYPE=mysql
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=statix

Supabase (Postgres)

Install the driver first:

cd server && npm install pg

Then use the direct connection string from the Supabase Dashboard (Settings β†’ Database):

DB_TYPE=supabase
SUPABASE_DB_URL=postgresql://postgres:password@db.xxxxx.supabase.co:5432/postgres
SUPABASE_SSL=true

Server Configuration

Modify server/config.js to customize:

module.exports = {
  appDomain: 'lvh.me',        // Domain for subdomains
  port: 3000,                 // Server port
  sitesRoot: 'uploads',       // Sites storage folder
  enableSubdomains: true      // Enable subdomain routing
};

πŸ“ Project Structure

.
β”œβ”€β”€ src/                    # Frontend source code
β”‚   β”œβ”€β”€ components/         # React components
β”‚   β”œβ”€β”€ pages/             # Application pages
β”‚   β”œβ”€β”€ stores/            # State management (Zustand)
β”‚   β”œβ”€β”€ locales/           # Translation files (FR/EN)
β”‚   └── lib/               # Utilities
β”œβ”€β”€ server/                # Backend source code
β”‚   β”œβ”€β”€ routes/            # Express routes
β”‚   β”œβ”€β”€ middleware/        # Middleware (auth, etc.)
β”‚   β”œβ”€β”€ database/          # Database adapters (sqlite, mysql, supabase)
β”‚   β”œβ”€β”€ uploads/           # Hosted sites
β”‚   β”œβ”€β”€ database.js        # Database initialisation (adapter selection)
β”‚   └── index.js           # Backend entry point
└── public/                # Static assets

πŸ”‘ Key Features

Site Management

  • Create a new site with name and slug
  • Upload files (HTML, CSS, JS, images, etc.)
  • Set a custom main file
  • Delete files
  • Redeploy a site

Authentication

  • Registration with name, email, and password
  • Login with JWT
  • "Remember me" option
  • Forgot password

Dashboard

  • Overview of all your sites
  • Statistics: number of sites, active sites, storage used
  • Site search and filtering
  • Quick access to each site management

Internationalization

  • Switch between French and English
  • Real-time language switching
  • Language preference persistence

πŸ§ͺ Available Scripts

npm run dev          # Start the frontend in development mode
npm run build        # Build the frontend for production
npm run preview      # Preview the production build
npm run server       # Start the backend

πŸ“ License

MIT

πŸ‘¨β€πŸ’» Author

Developed by luoxthedev

About

Statix : The Open Source alternative to Netlify

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •