# TCG Vault A modern trading card game collection manager built with Next.js and Neon Database. ## πŸš€ Features - **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 ## πŸ› οΈ Tech Stack - **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 ## πŸ“¦ Installation 1. **Clone the repository** ```bash git clone cd tcg-vault ``` 2. **Install dependencies** ```bash npm install ``` 3. **Set up environment variables** ```bash 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" ``` 4. **Set up the database** ```bash npm run setup-db ``` 5. **Start development server** ```bash npm run dev ``` ## πŸ—„οΈ 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 ## πŸš€ 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 ``` tcg-vault/ β”œβ”€β”€ 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 ``` ## πŸ” Default Admin Account After running the database setup: - **Email**: admin@tcgvault.com - **Password**: admin123 ## 🀝 Contributing 1. Fork the repository 2. Create a feature branch 3. Make your changes 4. Submit a pull request ## πŸ“„ License MIT License - see LICENSE file for details