initial config
This commit is contained in:
95
README.md
95
README.md
@@ -0,0 +1,95 @@
|
|||||||
|
# 🏹 FletchIQ - Archery Scoring Application
|
||||||
|
|
||||||
|
A modern, secure, and extensible archery tournament scoring system built with React, TypeScript, Node.js, and PostgreSQL.
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
- Ubuntu/Linux
|
||||||
|
- Docker and Docker Compose
|
||||||
|
- Git
|
||||||
|
|
||||||
|
### Setup
|
||||||
|
|
||||||
|
1. **Navigate to project**
|
||||||
|
```bash
|
||||||
|
cd fletchiq
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Start all services**
|
||||||
|
```bash
|
||||||
|
docker-compose up
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Access the application**
|
||||||
|
- Frontend: http://localhost:3000
|
||||||
|
- Backend API: http://localhost:5000/api
|
||||||
|
- PostgreSQL: localhost:5432
|
||||||
|
- Redis: localhost:6379
|
||||||
|
|
||||||
|
### Development Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# View logs
|
||||||
|
docker-compose logs -f backend
|
||||||
|
docker-compose logs -f frontend
|
||||||
|
|
||||||
|
# Stop all services
|
||||||
|
docker-compose down
|
||||||
|
|
||||||
|
# Rebuild containers
|
||||||
|
docker-compose build --no-cache
|
||||||
|
|
||||||
|
# Reset database
|
||||||
|
docker-compose down -v
|
||||||
|
docker-compose up
|
||||||
|
```
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
fletchiq/
|
||||||
|
├── backend/ # Node.js/Express API
|
||||||
|
│ ├── src/
|
||||||
|
│ │ ├── routes/ # API endpoints
|
||||||
|
│ │ ├── controllers/ # Request handlers
|
||||||
|
│ │ ├── services/ # Business logic
|
||||||
|
│ │ ├── middleware/ # Express middleware
|
||||||
|
│ │ ├── models/ # TypeORM entities
|
||||||
|
│ │ └── utils/ # Helper functions
|
||||||
|
│ ├── database/ # SQL migrations
|
||||||
|
│ └── tests/ # Unit & integration tests
|
||||||
|
├── frontend/ # React application
|
||||||
|
│ ├── src/
|
||||||
|
│ │ ├── components/ # React components
|
||||||
|
│ │ ├── pages/ # Page components
|
||||||
|
│ │ ├── hooks/ # Custom React hooks
|
||||||
|
│ │ ├── services/ # API client
|
||||||
|
│ │ └── types/ # TypeScript types
|
||||||
|
│ └── public/ # Static assets
|
||||||
|
└── docker-compose.yml # Service orchestration
|
||||||
|
```
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
1. Implement authentication routes
|
||||||
|
2. Create tournament CRUD endpoints
|
||||||
|
3. Build scoring input UI
|
||||||
|
4. Add real-time leaderboard with WebSockets
|
||||||
|
5. Implement analytics dashboard
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
- JWT token-based authentication
|
||||||
|
- Bcrypt password hashing
|
||||||
|
- CORS and rate limiting
|
||||||
|
- Input validation with Zod
|
||||||
|
- Row-level security in database
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Follow the architecture guide and ensure all code is:
|
||||||
|
- Type-safe (TypeScript)
|
||||||
|
- Well-tested
|
||||||
|
- Documented
|
||||||
|
- Following the existing patterns
|
||||||
|
|||||||
13
backend/Dockerfile
Normal file
13
backend/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
RUN npm install --legacy-peer-deps
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
CMD ["npm", "run", "dev"]
|
||||||
85
backend/database/init.sql
Normal file
85
backend/database/init.sql
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
-- Users table
|
||||||
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
email VARCHAR(255) UNIQUE NOT NULL,
|
||||||
|
password_hash VARCHAR(255) NOT NULL,
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX idx_users_email ON users(email);
|
||||||
|
|
||||||
|
-- Shooting styles table
|
||||||
|
CREATE TABLE IF NOT EXISTS shooting_styles (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
name VARCHAR(255) NOT NULL UNIQUE,
|
||||||
|
description TEXT,
|
||||||
|
scoring_format VARCHAR(50) NOT NULL,
|
||||||
|
max_points_per_arrow INT NOT NULL DEFAULT 10,
|
||||||
|
configuration JSONB DEFAULT '{}',
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Tournaments table
|
||||||
|
CREATE TABLE IF NOT EXISTS tournaments (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
shooting_style_id UUID NOT NULL REFERENCES shooting_styles(id),
|
||||||
|
status VARCHAR(50) DEFAULT 'draft',
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX idx_tournaments_user_id ON tournaments(user_id);
|
||||||
|
CREATE INDEX idx_tournaments_status ON tournaments(status);
|
||||||
|
|
||||||
|
-- Archers table
|
||||||
|
CREATE TABLE IF NOT EXISTS archers (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
tournament_id UUID NOT NULL REFERENCES tournaments(id) ON DELETE CASCADE,
|
||||||
|
user_id UUID REFERENCES users(id) ON DELETE SET NULL,
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
bib_number VARCHAR(50),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX idx_archers_tournament_id ON archers(tournament_id);
|
||||||
|
|
||||||
|
-- Rounds table
|
||||||
|
CREATE TABLE IF NOT EXISTS rounds (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
tournament_id UUID NOT NULL REFERENCES tournaments(id) ON DELETE CASCADE,
|
||||||
|
round_number INT NOT NULL,
|
||||||
|
distance_meters INT,
|
||||||
|
arrow_count INT NOT NULL DEFAULT 72,
|
||||||
|
max_score_per_arrow INT NOT NULL DEFAULT 10,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX idx_rounds_tournament_id ON rounds(tournament_id);
|
||||||
|
|
||||||
|
-- Shots table
|
||||||
|
CREATE TABLE IF NOT EXISTS shots (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
round_id UUID NOT NULL REFERENCES rounds(id) ON DELETE CASCADE,
|
||||||
|
archer_id UUID NOT NULL REFERENCES archers(id) ON DELETE CASCADE,
|
||||||
|
arrow_number INT NOT NULL,
|
||||||
|
score INT NOT NULL,
|
||||||
|
notes TEXT,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX idx_shots_round_id ON shots(round_id);
|
||||||
|
CREATE INDEX idx_shots_archer_id ON shots(archer_id);
|
||||||
|
|
||||||
|
-- Insert default shooting styles
|
||||||
|
INSERT INTO shooting_styles (name, description, scoring_format, max_points_per_arrow, configuration)
|
||||||
|
VALUES
|
||||||
|
('Olympic Recurve', 'Standard Olympic archery format', 'point_based', 10, '{"rounds": 1, "arrows_per_round": 72}'),
|
||||||
|
('3D Field', 'Field archery with variable distances', 'zone_based', 12, '{"variable_distance": true}'),
|
||||||
|
('Indoor 18m', 'Indoor competition at 18 meters', 'point_based', 10, '{"distance_meters": 18, "arrows": 60}'),
|
||||||
|
('Compound', 'Compound bow format', 'point_based', 10, '{"bow_type": "compound"}')
|
||||||
|
ON CONFLICT (name) DO NOTHING;
|
||||||
42
backend/package.json
Normal file
42
backend/package.json
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"name": "archery-scoring-backend",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Backend for archery scoring application",
|
||||||
|
"main": "dist/app.js",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "node --import tsx src/app.ts",
|
||||||
|
"build": "tsc",
|
||||||
|
"start": "node dist/app.js",
|
||||||
|
"migrate": "node --import tsx src/database/migrate.ts",
|
||||||
|
"seed": "node --import tsx src/database/seed.ts",
|
||||||
|
"test": "vitest",
|
||||||
|
"lint": "eslint src/"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"express": "4.18.2",
|
||||||
|
"cors": "2.8.5",
|
||||||
|
"dotenv": "16.3.1",
|
||||||
|
"pg": "8.11.3",
|
||||||
|
"redis": "4.6.12",
|
||||||
|
"jsonwebtoken": "9.0.2",
|
||||||
|
"bcryptjs": "2.4.3",
|
||||||
|
"zod": "3.22.4",
|
||||||
|
"uuid": "9.0.1",
|
||||||
|
"express-rate-limit": "7.1.5",
|
||||||
|
"helmet": "7.1.0",
|
||||||
|
"morgan": "1.10.0",
|
||||||
|
"axios": "1.6.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "20.10.6",
|
||||||
|
"@types/express": "4.17.21",
|
||||||
|
"@types/bcryptjs": "2.4.6",
|
||||||
|
"@types/jsonwebtoken": "9.0.7",
|
||||||
|
"typescript": "5.3.3",
|
||||||
|
"tsx": "4.7.0",
|
||||||
|
"vitest": "1.1.0",
|
||||||
|
"supertest": "6.3.3",
|
||||||
|
"@types/supertest": "6.0.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
66
backend/src/app.ts
Normal file
66
backend/src/app.ts
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import express from 'express';
|
||||||
|
import cors from 'cors';
|
||||||
|
import helmet from 'helmet';
|
||||||
|
import morgan from 'morgan';
|
||||||
|
import rateLimit from 'express-rate-limit';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const PORT = process.env.PORT || 5000;
|
||||||
|
|
||||||
|
// Security middleware
|
||||||
|
app.use(helmet());
|
||||||
|
app.use(cors({
|
||||||
|
origin: process.env.NODE_ENV === 'production'
|
||||||
|
? process.env.FRONTEND_URL
|
||||||
|
: ['http://localhost:3000', 'http://localhost:5000'],
|
||||||
|
credentials: true
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Rate limiting
|
||||||
|
const limiter = rateLimit({
|
||||||
|
windowMs: 15 * 60 * 1000,
|
||||||
|
max: 100,
|
||||||
|
message: 'Too many requests from this IP'
|
||||||
|
});
|
||||||
|
app.use(limiter);
|
||||||
|
|
||||||
|
// Logging
|
||||||
|
app.use(morgan('combined'));
|
||||||
|
|
||||||
|
// Body parser
|
||||||
|
app.use(express.json());
|
||||||
|
app.use(express.urlencoded({ extended: true }));
|
||||||
|
|
||||||
|
// Health check
|
||||||
|
app.get('/health', (req, res) => {
|
||||||
|
res.json({ status: 'ok', timestamp: new Date().toISOString() });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Routes (placeholder)
|
||||||
|
app.get('/api', (req, res) => {
|
||||||
|
res.json({ message: 'Archery Scoring API v1.0' });
|
||||||
|
});
|
||||||
|
|
||||||
|
// 404 handler
|
||||||
|
app.use((req, res) => {
|
||||||
|
res.status(404).json({ error: 'Route not found' });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Error handler
|
||||||
|
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||||
|
console.error(err);
|
||||||
|
res.status(err.status || 500).json({
|
||||||
|
error: process.env.NODE_ENV === 'production'
|
||||||
|
? 'Internal server error'
|
||||||
|
: err.message
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`🏹 Server running on http://localhost:${PORT}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default app;
|
||||||
20
backend/tsconfig.json
Normal file
20
backend/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ES2020",
|
||||||
|
"lib": ["ES2020"],
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"sourceMap": true
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"],
|
||||||
|
"exclude": ["node_modules", "dist", "tests"]
|
||||||
|
}
|
||||||
83
docker-compose.yml
Normal file
83
docker-compose.yml
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
version: '3.9'
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${POSTGRES_DB}
|
||||||
|
POSTGRES_USER: ${POSTGRES_USER}
|
||||||
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
|
POSTGRES_INITDB_ARGS: "-U ${POSTGRES_USER}"
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
- ./backend/database/init.sql:/docker-entrypoint-initdb.d/01-init.sql
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- archery_network
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- archery_network
|
||||||
|
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: ./backend
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
environment:
|
||||||
|
DATABASE_URL: postgresql://${POSTGRES_USER}:${DB_PASSWORD}@postgres:5432/${POSTGRES_DB}
|
||||||
|
REDIS_URL: redis://redis:6379
|
||||||
|
NODE_ENV: ${NODE_ENV}
|
||||||
|
JWT_SECRET: ${JWT_SECRET}
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
volumes:
|
||||||
|
- ./backend/src:/app/src
|
||||||
|
- ./backend/database:/app/database
|
||||||
|
networks:
|
||||||
|
- archery_network
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: ./frontend
|
||||||
|
dockerfile: Dockerfile.dev
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
REACT_APP_API_URL: ${REACT_APP_API_URL}
|
||||||
|
volumes:
|
||||||
|
- ./frontend/src:/app/src
|
||||||
|
- ./frontend/public:/app/public
|
||||||
|
- ./frontend/index.html:/app/index.html
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
networks:
|
||||||
|
- archery_network
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
|
redis_data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
archery_network:
|
||||||
|
driver: bridge
|
||||||
13
frontend/Dockerfile.dev
Normal file
13
frontend/Dockerfile.dev
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
RUN npm install --legacy-peer-deps
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["npm", "run", "dev", "--", "--host"]
|
||||||
12
frontend/index.html
Normal file
12
frontend/index.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Archery Scoring</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
29
frontend/package.json
Normal file
29
frontend/package.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "archery-scoring-frontend",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"react": "18.2.0",
|
||||||
|
"react-dom": "18.2.0",
|
||||||
|
"react-router-dom": "6.20.1",
|
||||||
|
"axios": "1.6.2",
|
||||||
|
"tailwindcss": "3.4.1",
|
||||||
|
"lucide-react": "0.263.1",
|
||||||
|
"zod": "3.22.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/react": "18.2.37",
|
||||||
|
"@types/react-dom": "18.2.15",
|
||||||
|
"@vitejs/plugin-react": "4.2.1",
|
||||||
|
"vite": "5.0.8",
|
||||||
|
"typescript": "5.3.3",
|
||||||
|
"postcss": "8.4.32",
|
||||||
|
"autoprefixer": "10.4.16"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "tsc && vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
frontend/postcss.config.js
Normal file
6
frontend/postcss.config.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export default {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
}
|
||||||
31
frontend/src/App.tsx
Normal file
31
frontend/src/App.tsx
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { BrowserRouter as Router, Routes, Route, Link } from 'react-router-dom'
|
||||||
|
import { ArcheryTarget } from 'lucide-react'
|
||||||
|
import Home from './pages/Home'
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
return (
|
||||||
|
<Router>
|
||||||
|
<div className="min-h-screen bg-gradient-to-br from-slate-900 to-slate-800">
|
||||||
|
<nav className="bg-slate-900 border-b border-slate-700">
|
||||||
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
|
<div className="flex justify-between items-center h-16">
|
||||||
|
<Link to="/" className="flex items-center space-x-2">
|
||||||
|
<ArcheryTarget className="text-amber-400" size={32} />
|
||||||
|
<span className="text-white font-bold text-xl">Archery Scoring</span>
|
||||||
|
</Link>
|
||||||
|
<div className="space-x-4">
|
||||||
|
<Link to="/" className="text-gray-300 hover:text-white">Home</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<Routes>
|
||||||
|
<Route path="/" element={<Home />} />
|
||||||
|
</Routes>
|
||||||
|
</div>
|
||||||
|
</Router>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App
|
||||||
22
frontend/src/index.css
Normal file
22
frontend/src/index.css
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||||
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||||
|
sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||||
|
monospace;
|
||||||
|
}
|
||||||
10
frontend/src/main.tsx
Normal file
10
frontend/src/main.tsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import ReactDOM from 'react-dom/client'
|
||||||
|
import App from './App'
|
||||||
|
import './index.css'
|
||||||
|
|
||||||
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||||
|
<React.StrictMode>
|
||||||
|
<App />
|
||||||
|
</React.StrictMode>,
|
||||||
|
)
|
||||||
22
frontend/src/pages/Home.tsx
Normal file
22
frontend/src/pages/Home.tsx
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
export default function Home() {
|
||||||
|
return (
|
||||||
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-20">
|
||||||
|
<div className="text-center">
|
||||||
|
<h1 className="text-5xl font-bold text-white mb-6">
|
||||||
|
Welcome to Archery Scoring
|
||||||
|
</h1>
|
||||||
|
<p className="text-xl text-gray-300 mb-8">
|
||||||
|
Track tournament scores with precision and ease
|
||||||
|
</p>
|
||||||
|
<div className="space-x-4">
|
||||||
|
<button className="bg-amber-500 hover:bg-amber-600 text-white px-8 py-3 rounded-lg font-semibold">
|
||||||
|
Create Tournament
|
||||||
|
</button>
|
||||||
|
<button className="bg-slate-700 hover:bg-slate-600 text-white px-8 py-3 rounded-lg font-semibold">
|
||||||
|
Join Tournament
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
11
frontend/tailwind.config.js
Normal file
11
frontend/tailwind.config.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
export default {
|
||||||
|
content: [
|
||||||
|
"./index.html",
|
||||||
|
"./src/**/*.{js,ts,jsx,tsx}",
|
||||||
|
],
|
||||||
|
theme: {
|
||||||
|
extend: {},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
}
|
||||||
18
frontend/tsconfig.json
Normal file
18
frontend/tsconfig.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"strict": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx"
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
|
"references": [{ "path": "./tsconfig.node.json" }]
|
||||||
|
}
|
||||||
10
frontend/tsconfig.node.json
Normal file
10
frontend/tsconfig.node.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowSyntheticDefaultImports": true
|
||||||
|
},
|
||||||
|
"include": ["vite.config.ts"]
|
||||||
|
}
|
||||||
10
frontend/vite.config.ts
Normal file
10
frontend/vite.config.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import react from '@vitejs/plugin-react'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
server: {
|
||||||
|
port: 3000,
|
||||||
|
host: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user