diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 44040a6..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: [dotnize] \ No newline at end of file diff --git a/Brain.md b/Brain.md index 8b1173b..31238c9 100644 --- a/Brain.md +++ b/Brain.md @@ -1,13 +1,13 @@ -# Brain.md — Michess Project Memory +# Brain.md — MiChess Project Memory -> Dieses Dokument ist mein aktives Gedächtnis während der Entwicklung von Michess. +> Dieses Dokument ist mein aktives Gedächtnis während der Entwicklung von MiChess. > Ich denke hier, notiere Entscheidungen, Probleme und Fortschritt. --- ## Projektziel -Michess = Lichess-inspirierte Schachplattform, self-hosted auf einer NAS, in Docker, mit Stockfish-Engine. +MiChess = Lichess-inspirierte Schachplattform, self-hosted auf einer NAS, in Docker, mit Stockfish-Engine. --- @@ -47,7 +47,7 @@ Michess = Lichess-inspirierte Schachplattform, self-hosted auf einer NAS, in Doc 1. **Stockfish AI-Gegner** — verschiedene Schwierigkeitsgrade (Level 1-8, ELO-basiert) 2. **Admin-Panel** — Nutzerverwaltung, Git-Pull-Button, Statistiken 3. **Freundessystem** — Freundschaftsanfragen, Freundesliste, Freunde herausfordern -4. **Branding** — Alles auf "Michess" umbenennen +4. **Branding** — Alles auf "MiChess" umbenennen 5. **Docker NAS-Deployment** — docker-compose für NAS, Auto-Update-Script 6. **DB-Schema Erweiterungen** — admin-Flag, friends-Tabelle, friend_requests-Tabelle 7. **E-Mail-basierte Registrierung** — (email-Feld schon da, braucht UI-Flow: email → unique username wählen) @@ -91,7 +91,7 @@ Michess = Lichess-inspirierte Schachplattform, self-hosted auf einer NAS, in Doc - [x] Brain.md erstellt - [x] Plan.md erstellt - [ ] Git remote auf `git.mischlabs.de` gesetzt -- [ ] Projekt auf "Michess" umbenannt +- [ ] Projekt auf "MiChess" umbenannt - [ ] DB-Schema erweitert (admin, friends, friend_requests) - [ ] Stockfish integriert - [ ] Admin-Panel gebaut @@ -103,7 +103,7 @@ Michess = Lichess-inspirierte Schachplattform, self-hosted auf einer NAS, in Doc ## Bekannte Probleme / Offene Fragen -- chessu's Dockerfile nutzt `CMD ["start"]` — muss für Michess angepasst werden (Server + Client separat oder zusammen) +- chessu's Dockerfile nutzt `CMD ["start"]` — muss für MiChess angepasst werden (Server + Client separat oder zusammen) - Stockfish binary muss im Docker-Image vorhanden sein (Alpine Linux: `apk add stockfish` oder npm-Paket) - Admin-Git-Pull: funktioniert nur wenn Container read-write Zugriff auf sein eigenes Verzeichnis hat — besser: Host-Script via webhook triggern @@ -118,7 +118,7 @@ Michess = Lichess-inspirierte Schachplattform, self-hosted auf einer NAS, in Doc ## Nächste Schritte (immer aktuell) 1. Git remote setzen → push -2. Umbenennen chessu → Michess +2. Umbenennen chessu → MiChess 3. DB-Schema erweitern 4. Stockfish backend einbauen 5. Admin-Panel UI + Backend diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index fc0cd2c..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,128 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, religion, or sexual identity -and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -- Demonstrating empathy and kindness toward other people -- Being respectful of differing opinions, viewpoints, and experiences -- Giving and gracefully accepting constructive feedback -- Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -- Focusing on what is best not just for us as individuals, but for the - overall community - -Examples of unacceptable behavior include: - -- The use of sexualized language or imagery, and sexual attention or - advances of any kind -- Trolling, insulting or derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or email - address, without their explicit permission -- Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -admin@ches.su. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series -of actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or -permanent ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within -the community. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 2.0, available at -https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. - -Community Impact Guidelines were inspired by [Mozilla's code of conduct -enforcement ladder](https://github.com/mozilla/diversity). - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see the FAQ at -https://www.contributor-covenant.org/faq. Translations are available at -https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2cd8d09..a48486c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,60 +1,14 @@ -# Contributing +# Beitragen zu MiChess -Welcome! We're glad you're interested in contributing to the project. +Issues und Pull Requests sind willkommen auf [git.mischlabs.de/MrDiderot/MiChess](https://git.mischlabs.de/MrDiderot/MiChess). -We welcome contributions of any kind; however, for **feature changes or additions**, please open an issue first for discussion. +## Entwicklungsumgebung -## Getting Started +1. Node.js 20+ und pnpm installieren +2. Repository klonen und `pnpm install` ausführen +3. `.env.example` nach `.env` kopieren und anpassen +4. `pnpm dev` starten -1. [Fork this repository](https://github.com/dotnize/chessu/fork) to your GitHub account. You can then clone the repository to your local machine and create a new branch for your changes. - ```sh - git clone https://github.com/[your-username]/chessu.git - cd chessu - git checkout -b my-feature-branch - ``` -2. Follow the [setup guide](./README.md#getting-started) from the README to install the necessary dependencies and run the development servers. -3. You may now make your changes and commit them to your branch. +## Commit-Stil -When adding new dependencies or running other commands from the root directory, you can specify the workspace with the `--filter` flag before the command. For example, `pnpm --filter client lint` or `pnpm --filter server add express`. - -### Formatting and linting - -We use ESLint and Prettier to enforce code style and formatting. Please make sure to run `pnpm lint:fix` and `pnpm format` before committing your changes. - -### Environment variables - -You may create a `.env` file in each package directory to set their environment variables. - -
-client - -```env -NEXT_PUBLIC_API_URL=http://localhost:3001 # replace with backend URL -``` - -
- -
-server - -```env -CORS_ORIGIN=http://localhost:3000 # replace with frontend URL -PORT=3001 -SESSION_SECRET=randomstring # replace for security - -# PostgreSQL connection info (required) -PGHOST=db.example.com -PGUSER=exampleuser -PGPASSWORD=examplepassword -PGDATABASE=chessu -``` - -
- -## Guidelines - -- Follow the [Code of Conduct](CODE_OF_CONDUCT.md). -- Make sure your changes are thoroughly tested. -- Keep your commits atomic and descriptive. -- Ensure that your code is formatted and linted using `pnpm lint:fix` and `pnpm format`. -- Make your pull requests as descriptive as possible. +Prefixe: `feat:`, `fix:`, `ui:`, `admin:`, `docker:`, `docs:` diff --git a/LICENSE b/LICENSE index b6bf1c1..45d7653 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023-present, Nathaniel Tampus +Copyright (c) 2024-present, Tom Misch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Plan.md b/Plan.md index 7f4aa29..7b7a6c8 100644 --- a/Plan.md +++ b/Plan.md @@ -1,10 +1,10 @@ -# Plan.md — Michess Entwicklungsplan +# Plan.md — MiChess Entwicklungsplan --- ## Vision -**Michess** ist eine selbst-gehostete Schachplattform für eine private Community, inspiriert von Lichess.org. +**MiChess** ist eine selbst-gehostete Schachplattform für eine private Community, inspiriert von Lichess.org. Läuft als Docker-Container auf einer Synology/QNAP NAS, komplett ohne Cloud-Abhängigkeit. --- @@ -14,12 +14,12 @@ Läuft als Docker-Container auf einer Synology/QNAP NAS, komplett ohne Cloud-Abh ### 1.1 Projekt-Setup - [x] chessu (MIT) als Basis klonen - [x] Brain.md & Plan.md erstellen -- [ ] Git remote auf `https://git.mischlabs.de/MrDiderot/Michess.git` setzen +- [ ] Git remote auf `https://git.mischlabs.de/MrDiderot/MiChess.git` setzen - [ ] Initaler Push (chessu-Basis + eigene Dateien) -### 1.2 Rebranding chessu → Michess +### 1.2 Rebranding chessu → MiChess - [ ] `package.json` Namen anpassen -- [ ] README durch Michess-README ersetzen +- [ ] README durch MiChess-README ersetzen - [ ] Alle Titel/Meta-Tags im Frontend ändern - [ ] Logo-Platzhalter anpassen @@ -131,7 +131,7 @@ CREATE TABLE IF NOT EXISTS "friendship" ( ### Aktueller chessu-Flow: `name + email + password` → Account erstellt -### Gewünschter Michess-Flow: +### Gewünschter MiChess-Flow: 1. `email + password` → Account erstellt (noch kein Nutzername) 2. Weitergeleitet zu "Nutzername wählen" (einmalig, nicht änderbar) 3. Nutzername prüfen: verfügbar? gültig? → bestätigen @@ -157,7 +157,7 @@ CREATE TABLE IF NOT EXISTS "friendship" ( ```bash # Einmalige Erstinstallation auf der NAS: -git clone https://git.mischlabs.de/MrDiderot/Michess.git michess +git clone https://git.mischlabs.de/MrDiderot/MiChess.git michess cd michess cp .env.example .env # .env anpassen (Passwörter, Admin-Email, etc.) diff --git a/README.md b/README.md index 4919d21..6edca7d 100644 --- a/README.md +++ b/README.md @@ -1,83 +1,59 @@ -

- chessu -

-

- - ches.su - - Last commit -

+# MiChess -

Yet another Chess web app. +Eine selbst-gehostete Schachplattform, inspiriert von Lichess.org. +Läuft als Docker-Container auf einer NAS — lokal, privat, ohne Cloud. -

- chessu -

+> Basiert auf [chessu](https://github.com/dotnize/chessu) (MIT) von dotnize — vielen Dank für die solide Basis. -- play against other users in real-time -- spectate and chat in ongoing games with other users -- _optional_ user accounts for tracking stats and game history -- ~~play solo against Stockfish~~ (wip) -- mobile-friendly -- ... and more ([view roadmap](https://github.com/users/dotnize/projects/2)) +## Features -Built with Next.js 14, Tailwind CSS + daisyUI, react-chessboard, chess.js, Express.js, socket.io and PostgreSQL. +- Echtzeit-Multiplayer (Spieler vs. Spieler) +- Stockfish KI in 6 Schwierigkeitsgraden (Anfänger bis Meister) +- Nutzeraccounts mit E-Mail & Passwort +- Freundessystem mit Anfragen und Freundesliste +- Admin-Panel: Nutzerverwaltung, Sperren/Entsperren, Git-Update per Knopfdruck +- Spielarchiv & Statistiken +- Zuschauer & Chat +- Mobil-optimiert -## Development +## Tech Stack -> Node.js 20 or newer is recommended. +Next.js 14 · Tailwind CSS · daisyUI · react-chessboard · chess.js · Express.js · Socket.io · PostgreSQL · TypeScript · Docker -This project is structured as a monorepo using **pnpm** workspaces, separated into three packages: +## Deployment (NAS / Docker) -- `client` - Next.js application for the front-end, ~~deployed to ches.su via Vercel~~. -- `server` - Node/Express.js application for the back-end, ~~deployed to server.ches.su via Railway~~. -- `types` - Shared type definitions required by the client and server. +```bash +# 1. Repository klonen +git clone https://git.mischlabs.de/MrDiderot/MiChess.git michess +cd michess -### Getting started +# 2. Konfiguration anpassen +cp .env.example .env +nano .env # Passwörter, ADMIN_EMAIL etc. setzen -1. Install [pnpm](https://pnpm.io/installation). -2. Install the necessary dependencies by running `pnpm install` in the root directory of the project. -3. In the `server` directory, create a `.env` file for your PostgreSQL database. You can try [ElephantSQL](https://www.elephantsql.com/) or [Aiven](https://aiven.io/postgresql) for a free hosted database. - ```env - PGHOST=db.example.com - PGUSER=exampleuser - PGPASSWORD=examplepassword - PGDATABASE=chessu - ``` -4. Run the development servers with `pnpm dev`. - - To run the frontend and backend servers separately, use `pnpm dev:client` and `pnpm dev:server`, respectively. -5. You can now access the frontend at http://localhost:3000 and the backend at http://localhost:3001. - -## Running chessu with Docker - -To build the project with Docker, you can use the provided `Dockerfile`. -```sh -docker build -t chessu . +# 3. Starten +docker compose up -d --build ``` -This command will build the Docker image with the name `chessu`. You can then run the image with the following command: -```sh -docker run -p 3000:3000 -p 3001:3001 chessu +Frontend: `http://deine-nas-ip:3000` +Backend API: `http://deine-nas-ip:3001` + +## Update + +```bash +# Manuell via Script +./scripts/update.sh + +# Oder im Admin-Panel → "Jetzt aktualisieren" ``` -Once built, to start the project with POSTGRES, you can use the provided `docker-compose.yml` file. -```sh -docker-compose up +## Entwicklung (lokal) + +```bash +pnpm install +pnpm dev ``` -Please make sure to modify the values in the `server/.env` file to match the values in the `docker-compose.yml` file or vice versa. -The entrypoint for the Docker image is set to run pnpm. -The Dockerfile's `CMD` instruction is set to run the project in production mode. -If you want to run the project in development mode, you can override the `CMD` instruction by running the following command: -```sh -docker run -p 3000:3000 -p 3001:3001 chessu dev # runs both client and server in development mode -docker run -p 3000:3000 -p 3001:3001 chessu dev:client # runs only the client in development mode -docker run -p 3000:3000 -p 3001:3001 chessu dev:server # runs only the server in development mode -``` -## Contributing +## Lizenz -Please read our [Contributing Guidelines](./CONTRIBUTING.md) before starting a pull request. - -## License - -[MIT](./LICENSE) +[MIT](./LICENSE) · Copyright © 2024-present Tom Misch diff --git a/client/package.json b/client/package.json index ea4aa8f..dd0da26 100644 --- a/client/package.json +++ b/client/package.json @@ -1,5 +1,5 @@ { - "name": "@chessu/client", + "name": "@michess/client", "version": "0.0.0", "private": true, "scripts": { @@ -19,7 +19,7 @@ "socket.io-client": "^4.7.5" }, "devDependencies": { - "@chessu/types": "workspace:*", + "@michess/types": "workspace:*", "@types/node": "^20.14.10", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", diff --git a/client/src/app/[code]/page.tsx b/client/src/app/[code]/page.tsx index 636f051..934ca03 100644 --- a/client/src/app/[code]/page.tsx +++ b/client/src/app/[code]/page.tsx @@ -18,10 +18,10 @@ export async function generateMetadata({ params }: { params: { code: string } }) return { description: `Play or watch a game with ${game.host?.name}`, openGraph: { - title: "chessu", + title: "MiChess", description: `Play or watch a game with ${game.host?.name}`, url: `https://ches.su/${game.code}`, - siteName: "chessu", + siteName: "MiChess", locale: "en_US", type: "website" }, diff --git a/client/src/app/archive/[id]/page.tsx b/client/src/app/archive/[id]/page.tsx index a1c5dde..1647740 100644 --- a/client/src/app/archive/[id]/page.tsx +++ b/client/src/app/archive/[id]/page.tsx @@ -1,6 +1,6 @@ import ArchivedGame from "@/components/archive/ArchivedGame"; import { fetchArchivedGame } from "@/lib/game"; -import type { Game } from "@chessu/types"; +import type { Game } from "@michess/types"; import { notFound } from "next/navigation"; export async function generateMetadata({ params }: { params: { id: number } }) { @@ -19,10 +19,10 @@ export async function generateMetadata({ params }: { params: { id: number } }) { return { description: `Archived game: ${game.white?.name} vs ${game.black?.name}`, openGraph: { - title: "chessu", + title: "MiChess", description: `Archived game: ${game.white?.name} vs ${game.black?.name}`, url: `https://ches.su/archive/${game.id}`, - siteName: "chessu", + siteName: "MiChess", locale: "en_US", type: "website" }, diff --git a/client/src/app/layout.tsx b/client/src/app/layout.tsx index 2dbbb1b..8ca42a3 100644 --- a/client/src/app/layout.tsx +++ b/client/src/app/layout.tsx @@ -9,12 +9,12 @@ import AuthModal from "@/components/auth/AuthModal"; import ContextProvider from "@/context/ContextProvider"; export const metadata = { - title: "Michess", + title: "MiChess", description: "Schach spielen – lokal, privat, kostenlos.", openGraph: { - title: "Michess", + title: "MiChess", description: "Schach spielen – lokal, privat, kostenlos.", - siteName: "Michess", + siteName: "MiChess", locale: "de_DE", type: "website" }, @@ -55,9 +55,9 @@ export default function RootLayout({ children }: { children: ReactNode }) { id="load-theme" dangerouslySetInnerHTML={{ __html: `if (localStorage.theme === "dark" || (!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches)) { - document.documentElement.setAttribute("data-theme", "chessuDark"); + document.documentElement.setAttribute("data-theme", "michessDark"); } else { - document.documentElement.setAttribute("data-theme", "chessuLight"); + document.documentElement.setAttribute("data-theme", "michessLight"); }` }} > diff --git a/client/src/app/user/[name]/page.tsx b/client/src/app/user/[name]/page.tsx index cb6cc6c..f2665a7 100644 --- a/client/src/app/user/[name]/page.tsx +++ b/client/src/app/user/[name]/page.tsx @@ -16,13 +16,13 @@ export async function generateMetadata({ params }: { params: { name: string } }) }; } return { - title: `${data.name} | chessu`, + title: `${data.name} | MiChess`, description: `${data.name}'s profile`, openGraph: { - title: `${data.name} | chessu`, - description: `${data.name}'s profile on chessu`, + title: `${data.name} | MiChess`, + description: `${data.name}'s profile on MiChess`, url: `https://ches.su/user/${data.name}`, - siteName: "chessu", + siteName: "MiChess", locale: "en_US", type: "website" }, diff --git a/client/src/components/Footer.tsx b/client/src/components/Footer.tsx index b781639..dbdfc78 100644 --- a/client/src/components/Footer.tsx +++ b/client/src/components/Footer.tsx @@ -2,11 +2,11 @@ export default function Footer() { return (