docs: update README.md with detailed features, tech stack, and game rules
This commit is contained in:
191
README.md
191
README.md
@@ -1,42 +1,199 @@
|
|||||||
# sv
|
# OnePieceDle
|
||||||
|
|
||||||
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
|
A One Piece themed daily guessing game inspired by Wordle. Guess the character of the day based on various hints that unlock after each wrong guess.
|
||||||
|
|
||||||
## Creating a project
|
## Features
|
||||||
|
|
||||||
If you're seeing this, you've probably already done this step. Congrats!
|
- **Daily Character Challenge**: A new character to guess every 24 hours
|
||||||
|
- **Progressive Hints**: Unlock hints after a certain number of guesses:
|
||||||
|
- Origin (after 5 guesses)
|
||||||
|
- Devil Fruit (after 10 guesses)
|
||||||
|
- Affiliations (after 15 guesses)
|
||||||
|
- **Character Comparison**: See how your guesses match up against the daily character with visual feedback
|
||||||
|
- **History Tracking**: Keep track of your guesses and attempts
|
||||||
|
- **Responsive Design**: Play on desktop or mobile with Tailwind CSS
|
||||||
|
- **Database**: SQLite with Drizzle ORM for persistent data storage
|
||||||
|
|
||||||
|
## Tech Stack
|
||||||
|
|
||||||
|
- **Frontend**: Svelte 5 with SvelteKit
|
||||||
|
- **Styling**: Tailwind CSS with Forms and Typography plugins
|
||||||
|
- **Backend**: Node.js with Better Auth for authentication
|
||||||
|
- **Database**: SQLite with Drizzle ORM
|
||||||
|
- **Scraping**: Cheerio for web scraping One Piece data
|
||||||
|
- **Build**: Vite with TypeScript
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- Node.js (see `.npmrc` for engine requirements)
|
||||||
|
- npm or similar package manager
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# create a new project
|
npm install
|
||||||
npx sv create my-app
|
|
||||||
```
|
```
|
||||||
|
|
||||||
To recreate this project with the same configuration:
|
### Environment Variables
|
||||||
|
|
||||||
```sh
|
Create a `.env` file based on [.env.example](.env.example):
|
||||||
# recreate this project
|
|
||||||
npx sv create --template minimal --types ts --add prettier eslint better-auth="demo:password" sveltekit-adapter="adapter:auto" tailwindcss="plugins:forms,typography" drizzle="database:sqlite+sqlite:libsql" --install npm onepiecedle
|
```env
|
||||||
|
DATABASE_URL=file:local.db
|
||||||
|
ORIGIN=http://localhost:5173
|
||||||
|
BETTER_AUTH_SECRET=your-secret-here
|
||||||
```
|
```
|
||||||
|
|
||||||
## Developing
|
### Development
|
||||||
|
|
||||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
Start the development server:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run dev
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
# or start the server and open the app in a new browser tab
|
Open [http://localhost:5173](http://localhost:5173) in your browser.
|
||||||
npm run dev -- --open
|
|
||||||
|
### Database
|
||||||
|
|
||||||
|
Initialize the database:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run db:migrate
|
||||||
|
```
|
||||||
|
|
||||||
|
View the database:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run db:studio
|
||||||
|
```
|
||||||
|
|
||||||
|
### Data Management
|
||||||
|
|
||||||
|
#### Import Character Data
|
||||||
|
|
||||||
|
Scrape and import One Piece character data:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run scrape
|
||||||
|
npm run db:import
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Set Daily Mode Characters
|
||||||
|
|
||||||
|
Configure which characters appear in daily mode:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Edit scripts/daily-characters.json with desired character IDs
|
||||||
|
npm run db:set-daily-mode
|
||||||
|
```
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
src/
|
||||||
|
├── lib/
|
||||||
|
│ ├── server/
|
||||||
|
│ │ ├── db/
|
||||||
|
│ │ │ ├── schema.ts # Database schema
|
||||||
|
│ │ │ └── index.ts # Database client
|
||||||
|
│ │ ├── daily-character.ts # Daily character logic
|
||||||
|
│ │ └── auth.ts # Authentication
|
||||||
|
│ └── assets/ # Static assets
|
||||||
|
├── routes/
|
||||||
|
│ ├── +page.svelte # Home page
|
||||||
|
│ ├── +page.server.ts # Home server logic
|
||||||
|
│ ├── daily/
|
||||||
|
│ │ ├── +page.svelte # Daily game page
|
||||||
|
│ │ ├── +page.server.ts # Daily game server logic
|
||||||
|
│ │ └── +server.ts # API endpoints
|
||||||
|
│ └── +layout.svelte # App layout
|
||||||
|
scripts/
|
||||||
|
├── scrape-onepiece.ts # Web scraper for One Piece data
|
||||||
|
├── import-json.ts # Import scraped data to database
|
||||||
|
├── set-daily-mode.ts # Configure daily mode characters
|
||||||
|
└── daily-characters.json # List of daily mode character IDs
|
||||||
|
scraped-data/
|
||||||
|
├── characters.json # Scraped character data
|
||||||
|
├── arcs.json # Scraped arc data
|
||||||
|
└── devil-fruits.json # Scraped devil fruit data
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
To create a production version of your app:
|
Create a production build:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
You can preview the production build with `npm run preview`.
|
Preview the production build:
|
||||||
|
|
||||||
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
```sh
|
||||||
|
npm run preview
|
||||||
|
```
|
||||||
|
|
||||||
|
## Code Quality
|
||||||
|
|
||||||
|
### Linting
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
|
### Formatting
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run format
|
||||||
|
```
|
||||||
|
|
||||||
|
### Type Checking
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run check
|
||||||
|
```
|
||||||
|
|
||||||
|
Watch mode:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run check:watch
|
||||||
|
```
|
||||||
|
|
||||||
|
## Database Schema
|
||||||
|
|
||||||
|
### Main Tables
|
||||||
|
|
||||||
|
- **character**: One Piece characters with stats (bounty, haki, devil fruit, etc.)
|
||||||
|
- **arc**: Story arcs with chapter ranges
|
||||||
|
- **devilFruit**: Devil fruits with types (Paramecia, Zoan, Logia)
|
||||||
|
- **characterHistory**: Daily game attempts and wins
|
||||||
|
- **characterScrapeValidation**: Validation data for scraped characters
|
||||||
|
|
||||||
|
See [drizzle.config.ts](drizzle.config.ts) and [drizzle/0000_graceful_master_mold.sql](drizzle/0000_graceful_master_mold.sql) for details.
|
||||||
|
|
||||||
|
## Game Rules
|
||||||
|
|
||||||
|
1. You have unlimited guesses to find the daily character
|
||||||
|
2. Each guess shows you how close you are on various attributes:
|
||||||
|
- **Green**: Exact match
|
||||||
|
- **Yellow**: Partial match (e.g., both have Haki but different types)
|
||||||
|
- **Red**: No match
|
||||||
|
3. Attributes displayed: Character, Status, Gender, Affiliations, Haki types, Bounty, Height, Origin, Arc, Devil Fruit type
|
||||||
|
4. Hints unlock progressively:
|
||||||
|
- Origin: Always available
|
||||||
|
- Devil Fruit: After 5 guesses
|
||||||
|
- Affiliations: After 10 guesses
|
||||||
|
|
||||||
|
## API Endpoints
|
||||||
|
|
||||||
|
- `POST /daily`: Submit a daily game result
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Feel free to fork and submit pull requests for new features or improvements.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is for educational purposes and fan use of the One Piece franchise.
|
||||||
Reference in New Issue
Block a user