Cadel Watson 4 hónapja
szülő
commit
2683cffca0
4 módosított fájl, 89 hozzáadás és 13 törlés
  1. 71 6
      README.md
  2. 1 1
      html/index.html
  3. 15 0
      requirements.txt
  4. 2 6
      server/main.py

+ 71 - 6
README.md

@@ -1,16 +1,81 @@
 # Drafter
 
-# UI
+A web-based assistant for Magic: The Gathering Limited players. 
 
-Install with `npm install`.
+Load your drafts from [17Lands](https://www.17lands.com/) and analyse your picks.
 
-Run with `npm run start`.
+> ⚠️ **Early development**
+> 
+> Drafter is pre-alpha software. It's very incomplete. Expect bugs and breaking changes.
 
-Build with `npm run build`.
+---
 
-## Backend
+## Project structure
 
-## Adding a new set
+| Path | Purpose |
+| ---- | ------- |
+| `src/` | Elm source for the front-end UI |
+| `css/`, `tailwind.config.js` | Tailwind CSS styling |
+| `html/` | Static HTML entry point served by Parcel |
+| `server/` | FastAPI backend that exposes set/card endpoints |
+| `data/` | Raw data files and helper scripts used to generate JSON served by the backend |
+
+---
+
+## Prerequisites
+
+Front-end
+* Node ≥ 14 and npm (or yarn)
+
+Back-end
+* Python ≥ 3.10
+* (Recommended) `virtualenv` or `pyenv`
+
+---
+
+## Running locally
+
+### 1. Clone & install
+
+```bash
+# clone and enter the repo
+# git clone https://github.com/kdelwat/drafter.git
+cd drafter
+
+# Front-end deps
+npm install
+
+# Back-end deps (inside a venv)
+python3 -m venv .venv
+source .venv/bin/activate
+pip install fastapi uvicorn[standard] httpx
+```
+
+### 2. Start development servers
+
+| Service | Command | URL |
+| ------- | ------- | --- |
+| UI (Parcel) | `npm run start` | http://localhost:1234 |
+| API (FastAPI) | `uvicorn server.main:app --reload --port 8000` | http://localhost:8000 |
+
+The UI is configured to call the API on `localhost:8000` during development via CORS.
+
+### 3. Build for production (optional)
+
+```bash
+npm run build   # outputs static assets to dist/
+```
+
+### 4. Running tests
+
+There are a few frontend tests, run with:
+
+```bash
+elm-test
+```
+---
+
+## Generating & adding new set data
 
 0. Create a new folder in data/sets
 

+ 1 - 1
html/index.html

@@ -2,7 +2,7 @@
 <html lang="en">
   <head>
     <meta charset="utf-8"/>
-    <title>My First Parcel App</title>
+    <title>Drafter</title>
     <link rel="stylesheet" href="../css/styles.css" />
     <script type="module" src="../js/app.js"></script>
   </head>

+ 15 - 0
requirements.txt

@@ -0,0 +1,15 @@
+annotated-types==0.7.0
+anyio==4.9.0
+certifi==2025.7.14
+click==8.1.8
+fastapi==0.115.12
+h11==0.16.0
+httpcore==1.0.9
+idna==3.10
+pydantic==2.11.3
+pydantic_core==2.33.1
+sniffio==1.3.1
+starlette==0.46.2
+typing-inspection==0.4.0
+typing_extensions==4.13.2
+uvicorn==0.34.1

+ 2 - 6
server/main.py

@@ -1,18 +1,14 @@
-import asyncio
 import json
 import os
-import re
-from typing import TypedDict, List, Dict, Any
 
-import httpx
 from fastapi import FastAPI
 from fastapi.middleware.cors import CORSMiddleware
 
 app = FastAPI()
 
 origins = [
-    "http://drafter.cadel.me",
-    "https://drafter.cadel.me",
+    "http://drafter.cadelwatson.com",
+    "https://drafter.cadelwatson.com",
     "http://localhost",
     "http://localhost:1234",
 ]