2025-07-23 22:26:54 -04:00
|
|
|
# TCG Vault
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
A modern trading card game collection manager built with Next.js and Neon Database.
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
## 🚀 Features
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
- **Card Management**: Track your MTG, Pokémon, and Lorcana cards
|
|
|
|
|
- **Collection Organization**: Create and manage card collections
|
|
|
|
|
- **Deck Building**: Build and share decks
|
|
|
|
|
- **Authentication**: Secure user accounts with JWT
|
|
|
|
|
- **Admin Panel**: Manage cards and users
|
|
|
|
|
- **Real-time Pricing**: Track card values
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
## 🛠️ Tech Stack
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
- **Frontend**: Next.js 15, React 18, TypeScript
|
|
|
|
|
- **Backend**: Next.js API Routes
|
|
|
|
|
- **Database**: Neon PostgreSQL (serverless)
|
|
|
|
|
- **Authentication**: JWT with bcrypt
|
|
|
|
|
- **Styling**: Tailwind CSS
|
|
|
|
|
- **Deployment**: Vercel
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
## 📦 Installation
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
1. **Clone the repository**
|
|
|
|
|
```bash
|
|
|
|
|
git clone <repository-url>
|
|
|
|
|
cd tcg-vault
|
|
|
|
|
```
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
2. **Install dependencies**
|
|
|
|
|
```bash
|
|
|
|
|
npm install
|
|
|
|
|
```
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
3. **Set up environment variables**
|
2025-07-21 15:04:48 -04:00
|
|
|
```bash
|
2025-07-23 22:26:54 -04:00
|
|
|
cp .env.example .env.local
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Update `.env.local` with your Neon database URL:
|
|
|
|
|
```env
|
|
|
|
|
POSTGRES_URL="postgresql://your-username:your-password@your-host/your-database"
|
|
|
|
|
JWT_SECRET="your-super-secret-jwt-key"
|
2025-07-21 15:04:48 -04:00
|
|
|
```
|
|
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
4. **Set up the database**
|
2025-07-21 15:04:48 -04:00
|
|
|
```bash
|
2025-07-23 22:26:54 -04:00
|
|
|
npm run setup-db
|
2025-07-21 15:04:48 -04:00
|
|
|
```
|
|
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
5. **Start development server**
|
2025-07-21 15:04:48 -04:00
|
|
|
```bash
|
2025-07-23 22:26:54 -04:00
|
|
|
npm run dev
|
2025-07-21 15:04:48 -04:00
|
|
|
```
|
|
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
## 🗄️ Database Schema
|
|
|
|
|
|
|
|
|
|
The application uses the following tables:
|
|
|
|
|
- `users` - User accounts and authentication
|
|
|
|
|
- `cards` - Card information and metadata
|
|
|
|
|
- `user_cards` - User's card collections
|
|
|
|
|
- `collections` - Named card collections
|
|
|
|
|
- `collection_cards` - Cards in collections
|
|
|
|
|
- `decks` - Deck definitions
|
|
|
|
|
- `deck_cards` - Cards in decks
|
|
|
|
|
|
|
|
|
|
## 🔧 API Endpoints
|
|
|
|
|
|
|
|
|
|
### Authentication
|
|
|
|
|
- `POST /api/auth/register` - User registration
|
|
|
|
|
- `POST /api/auth/login` - User login
|
|
|
|
|
|
|
|
|
|
### Admin
|
|
|
|
|
- `GET /api/admin` - Admin panel data
|
|
|
|
|
|
|
|
|
|
### Health Check
|
|
|
|
|
- `GET /api/health` - Application health
|
|
|
|
|
- `GET /api/test-db` - Database connection test
|
|
|
|
|
|
|
|
|
|
## 🚀 Deployment
|
|
|
|
|
|
|
|
|
|
This app is configured for deployment on Vercel:
|
|
|
|
|
|
|
|
|
|
1. **Connect your repository** to Vercel
|
|
|
|
|
2. **Set environment variables** in Vercel dashboard
|
|
|
|
|
3. **Deploy automatically** on push to main branch
|
|
|
|
|
|
|
|
|
|
## 📁 Project Structure
|
2025-07-21 15:04:48 -04:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
tcg-vault/
|
2025-07-23 22:26:54 -04:00
|
|
|
├── pages/ # Next.js pages and API routes
|
|
|
|
|
│ ├── api/ # API endpoints
|
|
|
|
|
│ │ ├── auth/ # Authentication routes
|
|
|
|
|
│ │ └── admin/ # Admin routes
|
|
|
|
|
│ ├── _app.js # App wrapper
|
|
|
|
|
│ └── index.js # Home page
|
|
|
|
|
├── lib/ # Utility libraries
|
|
|
|
|
│ └── database.js # Database adapter
|
|
|
|
|
├── scripts/ # Database setup scripts
|
|
|
|
|
├── public/ # Static assets
|
|
|
|
|
└── .env.local # Environment variables
|
2025-07-21 15:04:48 -04:00
|
|
|
```
|
|
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
## 🔐 Default Admin Account
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
After running the database setup:
|
|
|
|
|
- **Email**: admin@tcgvault.com
|
|
|
|
|
- **Password**: admin123
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
## 🤝 Contributing
|
2025-07-21 15:04:48 -04:00
|
|
|
|
|
|
|
|
1. Fork the repository
|
|
|
|
|
2. Create a feature branch
|
|
|
|
|
3. Make your changes
|
2025-07-23 22:26:54 -04:00
|
|
|
4. Submit a pull request
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
## 📄 License
|
2025-07-21 15:04:48 -04:00
|
|
|
|
2025-07-23 22:26:54 -04:00
|
|
|
MIT License - see LICENSE file for details
|